Le Vendredi 25 Novembre 2005 20:53, simone giannecchini a écrit :
Hi Simone,
As I am not sure my saturday's mail hit the list, I'm sending it again with
some new informations :
1) in the context file of tomcat (corrected from my initial mail) :
<Context docBase="/var/www/webapps/geoserver-1.3.0"
path="/geoserver-v1.3.0"
reloadable="true">
<Resource name="jdbc/EPSG" auth="Container"
type="javax.sql.DataSource"
username="Geotools" password="Geotools"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://127.0.0.1:5432/EPSG"
maxActive="8"
maxIdle="4"
maxWait="-1"/>
</Context>
2) It is then mandatory to have jdbcPostgres.jar in $CATALINA_HOME/common/lib
otherwise Tomcat does't find the driver. This leads to have that jar both in
$CATALINA_HOME/common/lib and in ~geoserver/WEB-INF/lib
3) in the ~geoserver/WEB-INF/web.xml (corrected from my initial mail) :
<description>
EPSG database for spatial reference systems
</description>
<res-ref-name>
jdbc/EPSG
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
4) the following code finds the EPSG database :
InitialContext initCtx= new InitialContext();
DataSource ds= (DataSource)initCtx.lookup("java:comp/env/jdbc/EPSG");
I don't know whether gt2 uses such a mecanism for retrieving named resources
as you mentionned in 1) of your mail ?
It seems that Tomcat retrieves the javax.sql.DataSource without problem (point
2 of your mail)
5) I had to fix, for postgresql, a NullException in the PostgreDataSource.java
(I sent you that file on saturday with CC to Martin Desruisseaux)
6) using svn geotools instead of the gt2 released with svn geoserver, I still
get the same error :
java.lang.AbstractMethodError:
org.geotools.referencing.factory.epsg.PostgreDataSource.createFactory(Lorg/geotools/referencing/factory/FactoryGroup;)Lorg/geotools/referencing/factory/AbstractAuthorityFactory;
at
org.geotools.referencing.factory.epsg.DefaultFactory.createFactory(DefaultFactory.java:250)
at
org.geotools.referencing.factory.epsg.DefaultFactory.createBackingStore(DefaultFactory.java:308)
at
org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:127)
at
org.geotools.referencing.factory.BufferedAuthorityFactory.isReady(BufferedAuthorityFactory.java:194)
at
org.geotools.referencing.factory.DeferredAuthorityFactory.isReady(DeferredAuthorityFactory.java:115)
at
org.geotools.factory.FactoryRegistry$1.filter(FactoryRegistry.java:81)
at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:793)
at javax.imageio.spi.FilterIterator.<init>(ServiceRegistry.java:787)
at
javax.imageio.spi.ServiceRegistry.getServiceProviders(ServiceRegistry.java:491)
at
org.geotools.factory.FactoryRegistry.getServiceProviders(FactoryRegistry.java:106)
at
org.geotools.referencing.FactoryFinder.getCRSAuthorityFactories(FactoryFinder.java:315)
at org.geotools.referencing.CRS.decode(CRS.java:217)
at
org.geotools.data.postgis.referencing.PostgisAuthorityFactory.createFromAuthority(PostgisAuthorityFactory.java:103)
at
org.geotools.data.postgis.referencing.PostgisAuthorityFactory.createCRS(PostgisAuthorityFactory.java:60)
at
org.geotools.data.postgis.PostgisDataStore.getGeometryAttribute(PostgisDataStore.java:947)
at
org.geotools.data.postgis.PostgisDataStore.buildAttributeType(PostgisDataStore.java:878)
at
org.geotools.data.jdbc.JDBC1DataStore.buildSchema(JDBC1DataStore.java:1150)
at
org.geotools.data.postgis.PostgisDataStore.buildSchema(PostgisDataStore.java:593)
at
org.geotools.data.jdbc.FeatureTypeHandler.getFeatureTypeInfo(FeatureTypeHandler.java:200)
at
org.geotools.data.jdbc.FeatureTypeHandler.getSchema(FeatureTypeHandler.java:168)
at
org.geotools.data.jdbc.JDBC1DataStore.getSchema(JDBC1DataStore.java:388)
at org.vfny.geoserver.global.Data.loadFeatureTypes(Data.java:345)
at org.vfny.geoserver.global.Data.load(Data.java:154)
at
org.vfny.geoserver.global.GeoServerPlugIn.init(GeoServerPlugIn.java:109)
at
org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
I am not sure the API are compatible ...
7) Suggestion: it would be great to have epsg-hsql.jar, epsg-postgresql.jar
along with epsg-wkt.jar and other gt2 jars. Using build.properties, one could
add a "prefered.epsg.jar" property that points to the epsg-*.jar to be put in
the war. Having epsg-*.jar would solve 6)
8) Once it works, I will put all these on the GEOSDOC wiki as Chris suggested.
Hi Didier,
thanks for the hint, I think on monday (maybe tuesday...) I will
compare this with the one I wrote for HSQL since I do not have my code
here, but I am still afraid that this won't help since this is exactly
the way I would do this ( I would still like to remark that I am not a
J2EE expert) and I am not surprised that it works for postgresql.
If you look at the HSQL implementations of an EPSG autorithy factory
in GeoTols, things are a bit different.
Anyway an easy solution would be switch from HSQL to postgresql!!! I
think I will get back to you next in order to perform this switch, but
before I would like to dig a bit more in this issue with HSQL.
Thanks a lot
Simone.
On 11/25/05, Richard didier <dgr@anonymised.com> wrote:
> Le Vendredi 25 Novembre 2005 15:23, simone giannecchini a écrit :
> > ---------- Forwarded message ----------
> > From: simone giannecchini <simboss1@anonymised.com>
> > Date: Nov 25, 2005 3:14 PM
> > Subject: HSQL and JNDI
> > To: "geotools-devel@lists.sourceforge.net", Martin Desruisseaux
> > <martin.desruisseaux@anonymised.com>
> >
> >
> > Hi list, hi Martin,
>
> Hi Simone,
>
> I didn't have checked if this is working completely but here is the
> tomcat
>
> (5.5 with Java 1.5 under Linux) setup I have for epsg-postgresql :
> > in the last weeks I have been working mainly on the geoserver WCS and
> > on the coverage branch. I have run into an annoying issue which maybe
> > you could help me to sort out.
> > I noticed that the epsg-hqsl plugin which relies on the hsql embedded
> > db tries to retrieve a DataSource from JNDI incase such a data source
> > has been registered.
> >
> > I am not a J2EE expert but I have been trying to register such a data
> > source using tomcat JNDI emulation without success.
> >
> > Problems in my opinion are:
> >
> > 1>Tomcat JNDI emulation puts resource under the java:comp/env context
> > and there is no wy can change that. At the same time the default
> > factory looks for a data source under the initial context without the
> > above mentioned name qualification. I am afraid that this won't ever
> > work on tomcat.
>
> in the context file of tomcat :
> <Context docBase="/var/www/webapps/geoserver-1.3.0"
> path="/geoserver-v1.3.0"
> reloadable="true">
> <Resource name="jdbc/Geotools" auth="Container"
> type="javax.sql.DataSource"
> username="Geotools" password="Geotools"
> driverClassName="org.postgresql.Driver"
> url="jdbc:postgresql://127.0.0.1:5432/EPSG"
> maxActive="8"
> maxIdle="4"
> maxWait="-1"/>
> </Context>
>
> > 2>The data source we are expecting to find in the JNDI is a sub
> > interface of javax.sql.DataSource but due to the connection pooling
> > mechanism that runs behind Tomcat we will never be able to retrieve
> > such an object.
>
> In the geoserverWEB-INF/web.xml :
>
> ...
> <resource-ref>
> <description>
> EPSG database for spatial reference systems
> </description>
> <res-ref-name>
> jdbc/Geotools
> </res-ref-name>
> <res-type>
> javax.sql.DataSource
> </res-type>
> <res-auth>
> Container
> </res-auth>
> </resource-ref>
>
> </web-app>
>
> > I might be completely wrong I know, any input will be greatly
> > appreciated.
>
> This might be adequte too for hsql-epsg i guess. Any feedback would be
> great !
>
> > Simone.
>
> didier
>
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > files for problems? Stop! Download the new AJAX search engine that
> > makes searching your log files as easy as surfing the web. DOWNLOAD
> > SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id865&op,ick
> > _______________________________________________
> > Geoserver-devel mailing list
> > Geoserver-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/geoserver-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op,ick
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel