Dear Geonetwork-users,
I'm struggling with the db-configuration for GN3 when trying to use the
JNDI setup. I have the current catalog running GN2.10 using a Tomcat JNDI
connection to Potsgis. Now I want to migrate to GN3, but start with an
empty setup. I duplicated the jndi resource configuration in Tomcat's
context.xml and changed the connection details to point to a new
postgis-db. I uncommented the import statement for jndi-postgis-datasource
in srv.xml. As far as I found documentation and mails this should be it.
However I wonder where to define which jndi context to use for GN3? For
GN2.10 in config.xml section main-db the resourceName of the jndi provider
is defined. But where is this configuration in GN3?
ATM I keep getting this error on startup:
2015-08-11 10:33:03,429 FATAL [jeeves.engine] - Stack :
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'entityManagerFactory' defined in URL
[jar:file:/usr/share/apache-tomcat-7/webapps/geonetwork3/WEB-INF/lib/domain-3.0.1-0.jar!/config-spring-geonetwork.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.ConversionNotSupportedException: Failed to
convert property value of type 'org.apache.naming.NamingContext' to
required type 'javax.sql.DataSource' for property 'dataSource'; nested
exception is java.lang.IllegalStateException: Cannot convert value of type
[org.apache.naming.NamingContext] to required type [javax.sql.DataSource]
for property 'dataSource': no matching editors or conversion strategy found
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at
jeeves.config.springutil.JeevesContextLoaderListener.contextInitialized(JeevesContextLoaderListener.java:56)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1081)
at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1877)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type 'org.apache.naming.NamingContext'
to required type 'javax.sql.DataSource' for property 'dataSource'; nested
exception is java.lang.IllegalStateException: Cannot convert value of type
[org.apache.naming.NamingContext] to required type [javax.sql.DataSource]
for property 'dataSource': no matching editors or conversion strategy found
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:463)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:494)
at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:488)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1463)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1422)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1158)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 22 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type
[org.apache.naming.NamingContext] to required type [javax.sql.DataSource]
for property 'dataSource': no matching editors or conversion strategy found
at
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267)
at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:448)
... 28 more
Thanks, Michael
--
-----------------------------------------------------------
Michael Schulz
Hi Michael,
I came up against the same problem and got it to work with the following
steps:
Ensure you have a jndi resource configuration in the servlet container
connecting to your postgres/postgis database (looks like you have this).
Uncomment the import statement for jndi-postgis-datasource in
WEB-INF/config-node/srv.xml, commenting out the import that was previously
uncommented (looks like you've done this).
In the WEB-INF/config-db/jndi-postgres-postgis.xml file, add the following
bean configuration (I put it immediately before the jdbcDataSource bean):
<bean id="jpaVendorAdapterDatabaseParam" class="java.lang.String">
<constructor-arg value="POSTGRESQL"/>
</bean>
Again in the WEB-INF/config-db/jndi-postgres-postgis.xml file, append the
resource name as defined in the jndi resource configuration (in my case
jdbc/geonetwork3) to the value of the jndiName in the jdbcDataSource bean
configuration:
<property name="jndiName" value="java:/comp/env"/>
becomes
<property name="jndiName" value="java:/comp/env/jdbc/geonetwork3"/>
I didn't configure anything in the jdbc.properties file, as the jndi
resource on the servlet container should handle all the db connection stuff.
With GN 2.10.x you had to define some connection details in GN's DB
configuration file when using a jndi data source as I believe this was
required by the geotools libraries used in certain GN functions. This may
be the case too with GN 3, which could require db settings in
jdbc.properties, although I'm yet to come across any issues. Pity if it is
the case as it kind of defeats the purpose of using a jndi data source.
Hope this is of some help.
Cheers,
Aaron.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GN3-JNDI-Postgis-configuration-tp5219324p5219847.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.
Hi Aaron,
thanks a lot for your answer, I'll try your suggestions... actually the one
thing I didn't do so far is adding the additional bean in
jndi-postgis-datasource.xml.
Cheers, Michael
2015-08-15 8:19 GMT+02:00 Aaron Sedgmen <Aaron.Sedgmen@anonymised.com>:
Hi Michael,
I came up against the same problem and got it to work with the following
steps:
Ensure you have a jndi resource configuration in the servlet container
connecting to your postgres/postgis database (looks like you have this).
Uncomment the import statement for jndi-postgis-datasource in
WEB-INF/config-node/srv.xml, commenting out the import that was previously
uncommented (looks like you've done this).
In the WEB-INF/config-db/jndi-postgres-postgis.xml file, add the following
bean configuration (I put it immediately before the jdbcDataSource bean):
<bean id="jpaVendorAdapterDatabaseParam" class="java.lang.String">
<constructor-arg value="POSTGRESQL"/>
</bean>
Again in the WEB-INF/config-db/jndi-postgres-postgis.xml file, append the
resource name as defined in the jndi resource configuration (in my case
jdbc/geonetwork3) to the value of the jndiName in the jdbcDataSource bean
configuration:
<property name="jndiName" value="java:/comp/env"/>
becomes
<property name="jndiName" value="java:/comp/env/jdbc/geonetwork3"/>
I didn't configure anything in the jdbc.properties file, as the jndi
resource on the servlet container should handle all the db connection
stuff.
With GN 2.10.x you had to define some connection details in GN's DB
configuration file when using a jndi data source as I believe this was
required by the geotools libraries used in certain GN functions. This may
be the case too with GN 3, which could require db settings in
jdbc.properties, although I'm yet to come across any issues. Pity if it is
the case as it kind of defeats the purpose of using a jndi data source.
Hope this is of some help.
Cheers,
Aaron.
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/GN3-JNDI-Postgis-configuration-tp5219324p5219847.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork
--
-----------------------------------------------------------
Michael Schulz
Johann-Sebastian-Bach-Str. 32
79104 Freiburg
Hi Aaron,
thanks a lot, that obviously did the trick. I'll continue now to try and
migrate our existing 2.10 db. This first success was on an empty db, but is
very promising.
Not sure, but should I file this as an issue/bug somewhere?
Cheers, Michael
2015-08-15 15:35 GMT+02:00 Michael Schulz <mandschulz@anonymised.com>:
Hi Aaron,
thanks a lot for your answer, I'll try your suggestions... actually the
one thing I didn't do so far is adding the additional bean in
jndi-postgis-datasource.xml.
Cheers, Michael
2015-08-15 8:19 GMT+02:00 Aaron Sedgmen <Aaron.Sedgmen@anonymised.com>:
Hi Michael,
I came up against the same problem and got it to work with the following
steps:
Ensure you have a jndi resource configuration in the servlet container
connecting to your postgres/postgis database (looks like you have this).
Uncomment the import statement for jndi-postgis-datasource in
WEB-INF/config-node/srv.xml, commenting out the import that was previously
uncommented (looks like you've done this).
In the WEB-INF/config-db/jndi-postgres-postgis.xml file, add the following
bean configuration (I put it immediately before the jdbcDataSource bean):
<bean id="jpaVendorAdapterDatabaseParam" class="java.lang.String">
<constructor-arg value="POSTGRESQL"/>
</bean>
Again in the WEB-INF/config-db/jndi-postgres-postgis.xml file, append the
resource name as defined in the jndi resource configuration (in my case
jdbc/geonetwork3) to the value of the jndiName in the jdbcDataSource bean
configuration:
<property name="jndiName" value="java:/comp/env"/>
becomes
<property name="jndiName" value="java:/comp/env/jdbc/geonetwork3"/>
I didn't configure anything in the jdbc.properties file, as the jndi
resource on the servlet container should handle all the db connection
stuff.
With GN 2.10.x you had to define some connection details in GN's DB
configuration file when using a jndi data source as I believe this was
required by the geotools libraries used in certain GN functions. This may
be the case too with GN 3, which could require db settings in
jdbc.properties, although I'm yet to come across any issues. Pity if it
is
the case as it kind of defeats the purpose of using a jndi data source.
Hope this is of some help.
Cheers,
Aaron.
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/GN3-JNDI-Postgis-configuration-tp5219324p5219847.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork
--
-----------------------------------------------------------
Michael Schulz
Johann-Sebastian-Bach-Str. 32
79104 Freiburg
--
-----------------------------------------------------------
Michael Schulz
Johann-Sebastian-Bach-Str. 32
79104 Freiburg