[GeoNetwork-users] create scripts in 3.0

Dear Community

I have installed version 3.0 and I am trying to switch from H2 to a postgis
database.

When I start up my app in the Tomcat manager, I get these errors (among
others) :

2015-05-12 10:35:27,936 WARN [geonetwork] - Database does not contain
any version information. Check that the database is a GeoNetwork database
with data. Migration step aborted.

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'entityManagerFactory' defined in URL
[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.
0.0-0.jar!/config-spring-geonetwork.xml]: Cannot resolve reference to bean
'jdbcDataSource' while setting bean property 'dataSource'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'jdbcDataSource': Post-processing of the FactoryBean's object
failed; nested exception is java.lang.RuntimeException:
org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled.

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:329)

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:107)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1158)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:458)

        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:296)

        .

        .

Now, I noticed that the directory with database create scripts is not
included in the war file .
/tomcat/webapps/geonetwork/WEB-INF/classes/setup/sql/ - this directory only
has "data" and "migrate" subdirectories. I wanted to run the create scripts
manually to see if that would resolve my problem . but they are not there.

I have the previous version installed on another local server - it has the
"create" directory and scripts. Would it be ok if I use that for creating a
database for the v3.0 server? Where else would I be able to find the create
scripts for a v3.0 postgis database?

Many thanks

Erik

Erik Voges
Systems Engineer - OADC/KE

DISCLAIMER & COPYRIGHT
This email and any accompanying attachments may contain confidential,
proprietary information and attached artwork which is subject to
international copyright laws. This information is private and protected by
law and, accordingly if you are not the intended recipient, you are
requested to delete this entire communication immediately and are notified
that any disclosure, copying or distribution of or taking any action based
on this information is prohibited.

(attachments)

image001.jpg

Hi Erik,

2015-05-12 11:03 GMT+02:00 Erik Voges <erik.voges@anonymised.com>:

Dear Community

I have installed version 3.0 and I am trying to switch from H2 to a postgis
database.

When I start up my app in the Tomcat manager, I get these errors (among
others) :

2015-05-12 10:35:27,936 WARN [geonetwork] - Database does not
contain
any version information. Check that the database is a GeoNetwork database
with data. Migration step aborted.

org.springframework.beans.factory.BeanCreationException: Error creating
bean
with name 'entityManagerFactory' defined in URL

[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.
0.0-0.jar!/config-spring-geonetwork.xml]: Cannot resolve reference to bean
'jdbcDataSource' while setting bean property 'dataSource'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'jdbcDataSource': Post-processing of the FactoryBean's
object
failed; nested exception is java.lang.RuntimeException:
org.postgresql.util.PSQLException: Cannot commit when autoCommit is
enabled.

        at

org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:329)

        at

org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:107)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1158)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:458)

        at

org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:296)

How did you configure the db connection ?
http://osgeo-org.1560.x6.nabble.com/Configure-Data-Base-version-3-td5203785.html#a5203932
may help

Now, I noticed that the directory with database create scripts is not
included in the war file .
/tomcat/webapps/geonetwork/WEB-INF/classes/setup/sql/ - this directory
only
has "data" and "migrate" subdirectories. I wanted to run the create scripts
manually to see if that would resolve my problem . but they are not there.

I have the previous version installed on another local server - it has the
"create" directory and scripts. Would it be ok if I use that for creating a
database for the v3.0 server? Where else would I be able to find the create
scripts for a v3.0 postgis database?

The database in 3.0 is create by the application (JPA) so there is no SQL
script for the structure. Only a script to populate the data and to handle
migration in case JPA can not deal with it.

HTH

Francois

Many thanks

Erik

Erik Voges
Systems Engineer - OADC/KE

DISCLAIMER & COPYRIGHT
This email and any accompanying attachments may contain confidential,
proprietary information and attached artwork which is subject to
international copyright laws. This information is private and protected by
law and, accordingly if you are not the intended recipient, you are
requested to delete this entire communication immediately and are notified
that any disclosure, copying or distribution of or taking any action based
on this information is prohibited.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
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

Hi,

2015-05-12 12:11 GMT+02:00 Erik Voges <erik.voges@anonymised.com>:

Thanks Francois

1.) I have changed the ../WEB-INF/config-node/srv.xml file and

uncommented this line:

    <import resource="../config-db/jndi-postgres-postgis.xml"/>

If doing step by step, I would try first to enable postgres
<import resource="../config-db/postgres.xml"/>
then enable postgis
and then move to JNDI.

2.) I have changed my jdbc.properties as follows:

jdbc.username=postgres

jdbc.password=secret_password

jdbc.database=geonetwork

jdbc.host=localhost

jdbc.basic.removeAbandoned=true

jdbc.basic.removeAbandonedTimeout=120

jdbc.basic.logAbandoned=true

jdbc.basic.maxActive=33

jdbc.basic.maxIdle=${jdbc.basic.maxActive}

jdbc.basic.initialSize=${jdbc.basic.maxActive}

jdbc.basic.maxWait=200

jdbc.basic.testOnBorrow=true

jdbc.basic.timeBetweenEvictionRunsMillis=10000

jdbc.basic.minEvictableIdleTimeMillis=1800000

jdbc.basic.testWhileIdle=true

jdbc.basic.numTestsPerEvictionRun=3

jdbc.basic.poolPreparedStatements=true

jdbc.basic.maxOpenPreparedStatements=1200

jdbc.basic.validationQuery=SELECT 1

jdbc.basic.defaultReadOnly=false

jdbc.basic.defaultAutoCommit=false

3.) I have created the geonetwork database (not sure if I should have

named it something else ..?)

4.) Next I changed my ../WEB-INF/config-db/jndi-postgres-postgis.xml

file as follows (changed the value of jndiName):

    <bean id="jdbcDataSource"

class="org.springframework.jndi.JndiObjectFactoryBean">

        <property name="jndiName" value="java:/comp/env/jdbc/PostGIS"/>

        <property name="cache" value="true"/>

        <property name="exposeAccessContext" value="false"/>

    </bean>

5.) I have also added this section inside my …/tomcat/conf/context.xml

file, inside the <context> tags.

  <Resource name="jdbc/PostGIS" auth="Container"

type="javax.sql.DataSource"

driverClassName="org.postgresql.Driver"

url="jdbc:postgresql://localhost:5432/geonetwork?relaxAutoCommit=true"
username="postgres" password="5455c4l_" maxActive="200" maxIdle="50"
maxWait="10000" />

6.) And I have replaced the postgres driver in ../WEB-INF/lib -

postgresql-9.1-901.jdbc4.jar with a later version -
postgresql-9.4-1201.jdbc41.jar , because I had some errors of a method that
wasn’t implemented – this seems to have fixed it.

Would be good to open ticket on github with description and error message
https://github.com/geonetwork/core-geonetwork/issues
to have this fixed in future release.

Thanks.

Francois

… and now I am here with the big rock in the middle of the road J

I am not sure if steps 4 and 5 were required… I tried it without those

changes, but then I got this error:

12-May-2015 12:10:06.099 INFO [localhost-startStop-2]

org.apache.catalina.core.ApplicationContext.log No Spring
WebApplicationInitializer types detected on classpath

org.springframework.beans.factory.BeanCreationException: Error creating

bean with name 'entityManagerFactory' defined in URL
[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.0.0-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

Thanks for your help

Erik

From: Francois Prunayre [mailto:fx.prunayre@anonymised.com]
Sent: 12 May 2015 10:21 AM
To: Erik Voges
Cc: Geonetwork-Users@anonymised.com
Subject: Re: [GeoNetwork-users] create scripts in 3.0

Hi Erik,

2015-05-12 11:03 GMT+02:00 Erik Voges <erik.voges@anonymised.com>:

Dear Community

I have installed version 3.0 and I am trying to switch from H2 to a

postgis

database.

When I start up my app in the Tomcat manager, I get these errors (among
others) :

2015-05-12 10:35:27,936 WARN [geonetwork] - Database does not

contain

any version information. Check that the database is a GeoNetwork database
with data. Migration step aborted.

org.springframework.beans.factory.BeanCreationException: Error creating

bean

with name 'entityManagerFactory' defined in URL

[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.

0.0-0.jar!/config-spring-geonetwork.xml]: Cannot resolve reference to bean
'jdbcDataSource' while setting bean property 'dataSource'; nested

exception

is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'jdbcDataSource': Post-processing of the FactoryBean's

object

failed; nested exception is java.lang.RuntimeException:
org.postgresql.util.PSQLException: Cannot commit when autoCommit is

enabled.

        at

org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv

eReference(BeanDefinitionValueResolver.java:329)

        at

org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv

eValueIfNecessary(BeanDefinitionValueResolver.java:107)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

.populateBean(AbstractAutowireCapableBeanFactory.java:1158)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

.createBean(AbstractAutowireCapableBeanFactory.java:458)

        at

org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab

stractBeanFactory.java:296)

How did you configure the db connection ?

http://osgeo-org.1560.x6.nabble.com/Configure-Data-Base-version-3-td5203785.html#a5203932
may help

Now, I noticed that the directory with database create scripts is not
included in the war file .
/tomcat/webapps/geonetwork/WEB-INF/classes/setup/sql/ - this directory

only

has "data" and "migrate" subdirectories. I wanted to run the create

scripts

manually to see if that would resolve my problem . but they are not there.

I have the previous version installed on another local server - it has the
"create" directory and scripts. Would it be ok if I use that for creating

a

database for the v3.0 server? Where else would I be able to find the

create

scripts for a v3.0 postgis database?

The database in 3.0 is create by the application (JPA) so there is no SQL

script for the structure. Only a script to populate the data and to handle
migration in case JPA can not deal with it.

HTH

Francois

Many thanks

Erik

Erik Voges
Systems Engineer - OADC/KE

DISCLAIMER & COPYRIGHT
This email and any accompanying attachments may contain confidential,
proprietary information and attached artwork which is subject to
international copyright laws. This information is private and protected by
law and, accordingly if you are not the intended recipient, you are
requested to delete this entire communication immediately and are notified
that any disclosure, copying or distribution of or taking any action based
on this information is prohibited.

------------------------------------------------------------------------------

One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
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

It was a good idea, thanks Francois

I switched to “postgres” and it started up, without any obvious problems. This automatically ran the “create” script as you explained and successfully created all the tables in my database. The application was running successfully.

I enabled the postgis extensions on the database (postgis and postgis-topology) and switch back to the jndi-postgres-postgis.xml mechanism … but I encountered the same error as before.

From: Francois Prunayre [mailto:fx.prunayre@anonymised.com]
Sent: 12 May 2015 11:22 AM
To: Erik Voges
Cc: Geonetwork-Users@anonymised.com
Subject: Re: [GeoNetwork-users] create scripts in 3.0

Hi,

2015-05-12 12:11 GMT+02:00 Erik Voges <erik.voges@anonymised.com <mailto:erik.voges@anonymised.com> >:

Thanks Francois

1.) I have changed the ../WEB-INF/config-node/srv.xml file and uncommented this line:

    <import resource="../config-db/jndi-postgres-postgis.xml"/>

If doing step by step, I would try first to enable postgres
<import resource="../config-db/postgres.xml"/>

then enable postgis
and then move to JNDI.

2.) I have changed my jdbc.properties as follows:

jdbc.username=postgres

jdbc.password=secret_password

jdbc.database=geonetwork

jdbc.host=localhost

jdbc.basic.removeAbandoned=true

jdbc.basic.removeAbandonedTimeout=120

jdbc.basic.logAbandoned=true

jdbc.basic.maxActive=33

jdbc.basic.maxIdle=${jdbc.basic.maxActive}

jdbc.basic.initialSize=${jdbc.basic.maxActive}

jdbc.basic.maxWait=200

jdbc.basic.testOnBorrow=true

jdbc.basic.timeBetweenEvictionRunsMillis=10000

jdbc.basic.minEvictableIdleTimeMillis=1800000

jdbc.basic.testWhileIdle=true

jdbc.basic.numTestsPerEvictionRun=3

jdbc.basic.poolPreparedStatements=true

jdbc.basic.maxOpenPreparedStatements=1200

jdbc.basic.validationQuery=SELECT 1

jdbc.basic.defaultReadOnly=false

jdbc.basic.defaultAutoCommit=false

3.) I have created the geonetwork database (not sure if I should have named it something else ..?)

4.) Next I changed my ../WEB-INF/config-db/jndi-postgres-postgis.xml file as follows (changed the value of jndiName):

    <bean id="jdbcDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">

        <property name="jndiName" value="java:/comp/env/jdbc/PostGIS"/>

        <property name="cache" value="true"/>

        <property name="exposeAccessContext" value="false"/>

    </bean>

5.) I have also added this section inside my …/tomcat/conf/context.xml file, inside the <context> tags.

  <Resource name="jdbc/PostGIS" auth="Container" type="javax.sql.DataSource"

driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/geonetwork?relaxAutoCommit=true" username="postgres" password="5455c4l_" maxActive="200" maxIdle="50" maxWait="10000" />

6.) And I have replaced the postgres driver in ../WEB-INF/lib - postgresql-9.1-901.jdbc4.jar with a later version - postgresql-9.4-1201.jdbc41.jar , because I had some errors of a method that wasn’t implemented – this seems to have fixed it.

Would be good to open ticket on github with description and error message

https://github.com/geonetwork/core-geonetwork/issues

to have this fixed in future release.

Thanks.

Francois

… and now I am here with the big rock in the middle of the road J

I am not sure if steps 4 and 5 were required… I tried it without those changes, but then I got this error:

12-May-2015 12:10:06.099 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.0.0-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

Thanks for your help

Erik

From: Francois Prunayre [mailto:fx.prunayre@anonymised.com <mailto:fx.prunayre@…54…> ]
Sent: 12 May 2015 10:21 AM
To: Erik Voges
Cc: Geonetwork-Users@anonymised.com <mailto:Geonetwork-Users@anonymised.com>
Subject: Re: [GeoNetwork-users] create scripts in 3.0

Hi Erik,

2015-05-12 11:03 GMT+02:00 Erik Voges <erik.voges@anonymised.com <mailto:erik.voges@anonymised.com> >:

Dear Community

I have installed version 3.0 and I am trying to switch from H2 to a postgis
database.

When I start up my app in the Tomcat manager, I get these errors (among
others) :

2015-05-12 10:35:27,936 WARN [geonetwork] - Database does not contain
any version information. Check that the database is a GeoNetwork database
with data. Migration step aborted.

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'entityManagerFactory' defined in URL
[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.
0.0-0.jar!/config-spring-geonetwork.xml]: Cannot resolve reference to bean
'jdbcDataSource' while setting bean property 'dataSource'; nested exception
is org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'jdbcDataSource': Post-processing of the FactoryBean's object
failed; nested exception is java.lang.RuntimeException:
org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled.

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eReference(BeanDefinitionValueResolver.java:329)

        at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
eValueIfNecessary(BeanDefinitionValueResolver.java:107)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.java:1158)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.java:458)

        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
stractBeanFactory.java:296)

How did you configure the db connection ?

http://osgeo-org.1560.x6.nabble.com/Configure-Data-Base-version-3-td5203785.html#a5203932 may help

Now, I noticed that the directory with database create scripts is not
included in the war file .
/tomcat/webapps/geonetwork/WEB-INF/classes/setup/sql/ - this directory only
has "data" and "migrate" subdirectories. I wanted to run the create scripts
manually to see if that would resolve my problem . but they are not there.

I have the previous version installed on another local server - it has the
"create" directory and scripts. Would it be ok if I use that for creating a
database for the v3.0 server? Where else would I be able to find the create
scripts for a v3.0 postgis database?

The database in 3.0 is create by the application (JPA) so there is no SQL script for the structure. Only a script to populate the data and to handle migration in case JPA can not deal with it.

HTH

Francois

Many thanks

Erik

Erik Voges
Systems Engineer - OADC/KE

DISCLAIMER & COPYRIGHT
This email and any accompanying attachments may contain confidential,
proprietary information and attached artwork which is subject to
international copyright laws. This information is private and protected by
law and, accordingly if you are not the intended recipient, you are
requested to delete this entire communication immediately and are notified
that any disclosure, copying or distribution of or taking any action based
on this information is prohibited.

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net <mailto:GeoNetwork-users@anonymised.comrceforge.net>
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Ok so there is probably something wrong with JNDI or the JNDI
configuration. Anyone having JNDI working with version 3?

Francois

2015-05-12 13:50 GMT+02:00 Erik Voges <erik.voges@anonymised.com>:

It was a good idea, thanks Francois

I switched to “postgres” and it started up, without any obvious problems.
This automatically ran the “create” script as you explained and
successfully created all the tables in my database. The application was
running successfully.

I enabled the postgis extensions on the database (postgis and
postgis-topology) and switch back to the jndi-postgres-postgis.xml
mechanism … but I encountered the same error as before.

*From:* Francois Prunayre [mailto:fx.prunayre@anonymised.com]
*Sent:* 12 May 2015 11:22 AM

*To:* Erik Voges
*Cc:* Geonetwork-Users@anonymised.com
*Subject:* Re: [GeoNetwork-users] create scripts in 3.0

Hi,

2015-05-12 12:11 GMT+02:00 Erik Voges <erik.voges@anonymised.com>:
>
> Thanks Francois
>
>
>
> 1.) I have changed the ../WEB-INF/config-node/srv.xml file and
uncommented this line:
>
> <import resource="../config-db/jndi-postgres-postgis.xml"/>

If doing step by step, I would try first to enable postgres
<import resource="../config-db/postgres.xml"/>

then enable postgis
and then move to JNDI.

> 2.) I have changed my jdbc.properties as follows:
>
> jdbc.username=postgres
>
> jdbc.password=secret_password
>
> jdbc.database=geonetwork
>
> jdbc.host=localhost
>
> jdbc.basic.removeAbandoned=true
>
> jdbc.basic.removeAbandonedTimeout=120
>
> jdbc.basic.logAbandoned=true
>
> jdbc.basic.maxActive=33
>
> jdbc.basic.maxIdle=${jdbc.basic.maxActive}
>
> jdbc.basic.initialSize=${jdbc.basic.maxActive}
>
> jdbc.basic.maxWait=200
>
> jdbc.basic.testOnBorrow=true
>
> jdbc.basic.timeBetweenEvictionRunsMillis=10000
>
> jdbc.basic.minEvictableIdleTimeMillis=1800000
>
> jdbc.basic.testWhileIdle=true
>
> jdbc.basic.numTestsPerEvictionRun=3
>
> jdbc.basic.poolPreparedStatements=true
>
> jdbc.basic.maxOpenPreparedStatements=1200
>
> jdbc.basic.validationQuery=SELECT 1
>
> jdbc.basic.defaultReadOnly=false
>
> jdbc.basic.defaultAutoCommit=false
>
>
>
> 3.) I have created the geonetwork database (not sure if I should have
named it something else ..?)
>
> 4.) Next I changed my ../WEB-INF/config-db/jndi-postgres-postgis.xml
file as follows (changed the value of jndiName):
>
>
>
> <bean id="jdbcDataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
>
> <property name="jndiName" value="java:/comp/env/jdbc/PostGIS"/>
>
> <property name="cache" value="true"/>
>
> <property name="exposeAccessContext" value="false"/>
>
> </bean>
>
>
>
> 5.) I have also added this section inside my
…/tomcat/conf/context.xml file, inside the <context> tags.
>
>
>
> <Resource name="jdbc/PostGIS" auth="Container"
type="javax.sql.DataSource"
>
> driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/geonetwork?relaxAutoCommit=true"
username="postgres" password="5455c4l_" maxActive="200" maxIdle="50"
maxWait="10000" />
>
>
>
> 6.) And I have replaced the postgres driver in ../WEB-INF/lib -
postgresql-9.1-901.jdbc4.jar with a later version -
postgresql-9.4-1201.jdbc41.jar , because I had some errors of a method that
wasn’t implemented – this seems to have fixed it.

Would be good to open ticket on github with description and error message

https://github.com/geonetwork/core-geonetwork/issues

to have this fixed in future release.

Thanks.

Francois

> … and now I am here with the big rock in the middle of the road J
>
>
>
> I am not sure if steps 4 and 5 were required… I tried it without those
changes, but then I got this error:
>
> 12-May-2015 12:10:06.099 INFO [localhost-startStop-2]
org.apache.catalina.core.ApplicationContext.log No Spring
WebApplicationInitializer types detected on classpath
>
> org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'entityManagerFactory' defined in URL
[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.0.0-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
>
>
>
>
>
> Thanks for your help
>
> Erik
>
>
>
> From: Francois Prunayre [mailto:fx.prunayre@anonymised.com]
> Sent: 12 May 2015 10:21 AM
> To: Erik Voges
> Cc: Geonetwork-Users@anonymised.com
> Subject: Re: [GeoNetwork-users] create scripts in 3.0
>
>
>
> Hi Erik,
>
>
>
> 2015-05-12 11:03 GMT+02:00 Erik Voges <erik.voges@anonymised.com>:
>
> Dear Community
>
>
>
> I have installed version 3.0 and I am trying to switch from H2 to a
postgis
> database.
>
>
>
> When I start up my app in the Tomcat manager, I get these errors (among
> others) :
>
>
>
> 2015-05-12 10:35:27,936 WARN [geonetwork] - Database does not
contain
> any version information. Check that the database is a GeoNetwork database
> with data. Migration step aborted.
>
> org.springframework.beans.factory.BeanCreationException: Error creating
bean
> with name 'entityManagerFactory' defined in URL
>
[jar:file:/opt/apache-tomcat-8.0.22/webapps/geonetwork/WEB-INF/lib/domain-3.
> 0.0-0.jar!/config-spring-geonetwork.xml]: Cannot resolve reference to
bean
> 'jdbcDataSource' while setting bean property 'dataSource'; nested
exception
> is org.springframework.beans.factory.BeanCreationException: Error
creating
> bean with name 'jdbcDataSource': Post-processing of the FactoryBean's
object
> failed; nested exception is java.lang.RuntimeException:
> org.postgresql.util.PSQLException: Cannot commit when autoCommit is
enabled.
>
> at
>
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
> eReference(BeanDefinitionValueResolver.java:329)
>
> at
>
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolv
> eValueIfNecessary(BeanDefinitionValueResolver.java:107)
>
> at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
> .applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1417)
>
> at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
> .populateBean(AbstractAutowireCapableBeanFactory.java:1158)
>
> at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
> .doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>
> at
>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
> .createBean(AbstractAutowireCapableBeanFactory.java:458)
>
> at
>
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab
> stractBeanFactory.java:296)
>
>
>
> How did you configure the db connection ?
>
>
http://osgeo-org.1560.x6.nabble.com/Configure-Data-Base-version-3-td5203785.html#a5203932
may help
>
>
>
>
>
> Now, I noticed that the directory with database create scripts is not
> included in the war file .
> /tomcat/webapps/geonetwork/WEB-INF/classes/setup/sql/ - this directory
only
> has "data" and "migrate" subdirectories. I wanted to run the create
scripts
> manually to see if that would resolve my problem . but they are not
there.
>
>
>
> I have the previous version installed on another local server - it has
the
> "create" directory and scripts. Would it be ok if I use that for
creating a
> database for the v3.0 server? Where else would I be able to find the
create
> scripts for a v3.0 postgis database?
>
>
>
> The database in 3.0 is create by the application (JPA) so there is no
SQL script for the structure. Only a script to populate the data and to
handle migration in case JPA can not deal with it.
>
>
>
> HTH
>
>
>
> Francois
>
>
>
>
>
>
>
>
>
> Many thanks
>
> Erik
>
>
>
> Erik Voges
> Systems Engineer - OADC/KE
>
>
>
> DISCLAIMER & COPYRIGHT
> This email and any accompanying attachments may contain confidential,
> proprietary information and attached artwork which is subject to
> international copyright laws. This information is private and protected
by
> law and, accordingly if you are not the intended recipient, you are
> requested to delete this entire communication immediately and are
notified
> that any disclosure, copying or distribution of or taking any action
based
> on this information is prohibited.
>
>
>
>
>
------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> 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
>
>

Hello.

I'm in the same situation / gap : deploy GeoNetwork 3.0.0 from the war file.

My config :
Debian 8.1 jessie
postgresql-9.4 postgis-2.1
java version "1.7.0_79"
tomcat 7

On the postgres database, I ran :
CREATE SCHEMA IF NOT EXISTS geonetwork_300 AUTHORIZATION geonetwork;
ALTER DATABASE catalogue SET search_path = geonetwork_300;

I configured these files to setup the database connexion :
/WEB-INF/config-db/jdbc.properties with connections infos
/WEB-INF/config-node/srv.xml to point /config-db/postgres.xml

restart tomcat.

all tables are created an filled up
BUT it crashed on hibernate sequence

+++++
Failed whilst adding the schema information. Exception message if any is
could not extract ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
ERROR [jeeves.engine] - Stack : OperationAbortedEx : Failed whilst
adding the schema information. Exception message if any is could not extract
ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException:
could not extract ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.postgresql.util.PSQLException: ERREUR: la relation «
hibernate_sequence » n'existe pas
  Position : 17

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/create-scripts-in-3-0-tp5205280p5213565.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi,

I already encountered this kind of error when fiddling around with
different schemas. The hibernate_sequence is created in the public schema
where it is supposed to be found into your custom schema.

+++++
Failed whilst adding the schema information. Exception message if any is
could not extract ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
ERROR [jeeves.engine] - Stack : OperationAbortedEx : Failed whilst
adding the schema information. Exception message if any is could not
extract
ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException:
could not extract ResultSet; SQL [n/a]; nested exception is
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: org.postgresql.util.PSQLException: ERREUR: la relation «
hibernate_sequence » n'existe pas
  Position : 17

Does it work when you try to set your database up into the public schema ?

-- Pierre

Hi Pierre

For me its a bug refrenced here :
https://github.com/geonetwork/core-geonetwork/issues/1081

It misses somewhere, in a fresh install process, the creation of the
hibernate sequence.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/create-scripts-in-3-0-tp5205280p5213599.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.