Hi all
I solved the problem inserting directly in the file defaultJdbcDataSource.xml the variable values .
<bean id="jdbcDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="JmxName" value="jdbcDataSource"/>
<property name="driverClassName" ref="jdbcDriverClassName"/>
<property name="url" value="jdbc:postgresql://10.X.X.X:5432/geonetwork_4_2"/>
<property name="username" value="geonetwork"/>
<property name="password" value="paswd"/>
<property name="removeAbandonedOnBorrow" value="true"/>
<property name="removeAbandonedOnMaintenance" value="true"/>
<property name="removeAbandonedTimeout" value="300"/>
<property name="maxTotal" value="30"/>
<property name="maxIdle" value="10"/>
<property name="maxWaitMillis" value="500"/>
<property name="testOnBorrow" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="1000"/>
<property name="minEvictableIdleTimeMillis" value="1800000"/>
<property name="testWhileIdle" value="true"/>
<property name="numTestsPerEvictionRun" value="5"/>
<property name="poolPreparedStatements" value="true"/>
<property name="maxOpenPreparedStatements" value="1200"/>
<property name="validationQuery" value="SELECT 1"/>
<property name="defaultReadOnly" value="false"/>
<property name="defaultAutoCommit" value="false"/>
<property name="initialSize" value="10"/>
I do not know why it was not reading them correctly.
Hope this could help someone else
cheers,
Bartolomeo
________________________________
From: Bodley Peter Alexander <peter-alexander.bodley@...1980...>
Sent: Tuesday, November 7, 2023 18:45
To: Ventura Bartolomeo <bartolomeo.ventura@...1518...>; geonetwork-users@lists.sourceforge.net <geonetwork-users@lists.sourceforge.net>
Subject: Sv: [EXTERNT] [GeoNetwork-users] Geonetwork 4.2.6 configuring Postgres DB
Hi
Yes, this is strange.
The next thing to check is the line endings in the jdbc.properties file. I have seen problems in Geonetwork where files has mixed line endings (windows vs linux).
If you have something like notepad++ you can see what end of line (EOL) encoding the file has and even convert the file to have consistent EOL.
I hope this helps.
/Pete
Från: Ventura Bartolomeo <bartolomeo.ventura@...1518...>
Skickat: den 7 november 2023 17:02
Till: Bodley Peter Alexander <peter-alexander.bodley@...1980...>; geonetwork-users@lists.sourceforge.net
Ämne: Re: [EXTERNT] [GeoNetwork-users] Geonetwork 4.2.6 configuring Postgres DB
Hi,
everything is exactly the same. There are no spaces or typo. This is why I'm really confused!!
cheers,
Bartolomeo
________________________________
From: Bodley Peter Alexander <peter-alexander.bodley@...1980...<mailto:peter-alexander.bodley@…1980…>>
Sent: Tuesday, November 7, 2023 16:57
To: Ventura Bartolomeo <bartolomeo.ventura@...1518...<mailto:bartolomeo.ventura@…1518…>>; geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net> <geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net>>
Subject: Sv: [EXTERNT] [GeoNetwork-users] Geonetwork 4.2.6 configuring Postgres DB
You don't often get email from peter-alexander.bodley@...1980...<mailto:peter-alexander.bodley@…1980…>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Hi,
Please check your jdbc.properties file and make sure that you have the correct spelling and upper and lowercase letters for
jdbc.basic.removeAbandoned=true
There should be no space between the keyword (jdbc.basic.removeAbandoned=) and the value (true) and I am pretty sure that the keyword has to be exactly as written here.
This value is taken from my postgres instance of GN4 4.2.2.
Mvh
/Pete
Från: Ventura Bartolomeo <bartolomeo.ventura@...1518...<mailto:bartolomeo.ventura@…1518…>>
Skickat: den 7 november 2023 16:19
Till: Bodley Peter Alexander <peter-alexander.bodley@...1980...<mailto:peter-alexander.bodley@…1980…>>; geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net>
Ämne: Re: [EXTERNT] [GeoNetwork-users] Geonetwork 4.2.6 configuring Postgres DB
Hi,
I just changed the value as you suggested but now I got a similar error on "removeAbandonedOnBorrow" value
2023-11-07T16:17:20,599 WARN [jeeves.config.springutil.JeevesApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/lib/gn-domain-4.2.6-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' defined in URL [file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/defaultJdbcDataSource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'removeAbandonedOnBorrow'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${jdbc.basic.removeAbandoned}]
2023-11-07T16:17:20,609 ERROR [jeeves] - JeevesContextLoaderListener: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/lib/gn-domain-4.2.6-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' defined in URL [file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/defaultJdbcDataSource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'removeAbandonedOnBorrow'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${jdbc.basic.removeAbandoned}]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/lib/gn-domain-4.2.6-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' defined in URL [file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/defaultJdbcDataSource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'boolean' for property 'removeAbandonedOnBorrow'; nested exception is java.lang.IllegalArgumentException: Invalid boolean value [${jdbc.basic.removeAbandoned}]
Regards,
Bartolomeo
________________________________
From: Bodley Peter Alexander <peter-alexander.bodley@...1980...<mailto:peter-alexander.bodley@…1980…>>
Sent: Tuesday, November 7, 2023 16:04
To: Ventura Bartolomeo <bartolomeo.ventura@...1518...<mailto:bartolomeo.ventura@…1518…>>; geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net> <geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net>>
Subject: Sv: [EXTERNT] [GeoNetwork-users] Geonetwork 4.2.6 configuring Postgres DB
[You don't often get email from peter-alexander.bodley@...1980...<mailto:peter-alexander.bodley@…1980…>. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Hej,
You have the values swapped for
jdbc.basic.removeAbandoned=300
jdbc.basic.removeAbandonedTimeout=true
they should be
jdbc.basic.removeAbandoned=true
jdbc.basic.removeAbandonedTimeout=300
Mvh
/Pete
-----Ursprungligt meddelande-----
Från: Ventura Bartolomeo via GeoNetwork-users <geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net>>
Skickat: den 7 november 2023 12:59
Till: geonetwork-users@lists.sourceforge.net<mailto:geonetwork-users@lists.sourceforge.net>
Ämne: [EXTERNT] [GeoNetwork-users] Geonetwork 4.2.6 configuring Postgres DB
OBS! Detta mejl kommer från en avsändare utanför vår IT-miljö. Klicka inte på länkar och öppna inte bifogade filer om du är osäker på avsändare eller innehåll. Kontakta Service Desk om du behöver råd och stöd.
Hi all,
I'm traying to configure a remote DB for my Geonetwork and these are the steps I did:
1.
I added the line
* <import resource="../config-db/postgres-postgis.xml"/>
into the file /opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-node/srv.xml
and I commented the one related to the h2.db
2.
I edited the file
/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/jdbc.properties
as indicated in the following
jdbc.username=geonetwork
jdbc.password=my_paswd
jdbc.database=geonetwork_4_2
jdbc.host=10.X.X.X
jdbc.port=5432
#jdbc.connectionProperties=#{systemEnvironment['GEONETWORK_DB_CONNECTION_PROPERTIES']}
jdbc.basic.removeAbandoned=300
jdbc.basic.removeAbandonedTimeout=true
jdbc.basic.logAbandoned=true
jdbc.basic.maxActive=30
jdbc.basic.maxIdle=10
jdbc.basic.initialSize=10
jdbc.basic.maxWait=500
jdbc.basic.testOnBorrow=true
jdbc.basic.timeBetweenEvictionRunsMillis=1000
jdbc.basic.minEvictableIdleTimeMillis=1800000
jdbc.basic.testWhileIdle=true
jdbc.basic.numTestsPerEvictionRun=5
jdbc.basic.poolPreparedStatements=true
jdbc.basic.maxOpenPreparedStatements=1200
jdbc.basic.validationQuery=SELECT 1
jdbc.basic.defaultReadOnly=false
jdbc.basic.defaultAutoCommit=false
but when I start GN I got this error
2023-11-07T12:16:27,324 WARN [jeeves.config.springutil.JeevesApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/lib/gn-domain-4.2.6-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' defined in URL [file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/defaultJdbcDataSource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'removeAbandonedTimeout'; nested exception is java.lang.NumberFormatException: For input string: "${jdbc.basic.removeAbandonedTimeout}"
2023-11-07T12:16:27,331 ERROR [jeeves] - JeevesContextLoaderListener: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/lib/gn-domain-4.2.6-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' defined in URL [file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/defaultJdbcDataSource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'removeAbandonedTimeout'; nested exception is java.lang.NumberFormatException: For input string: "${jdbc.basic.removeAbandonedTimeout}"
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/lib/gn-domain-4.2.6-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' defined in URL [file:/opt/geonetwork_4_2_6/web/geonetwork/WEB-INF/config-db/defaultJdbcDataSource.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'removeAbandonedTimeout'; nested exception is java.lang.NumberFormatException: For input string: "${jdbc.basic.removeAbandonedTimeout}"
I tried to change the value jdbc.basic.removeAbandoned to a boolean such as true but it did not work.
Could you please tell me what I'm doing wrong? I followed the guideline here<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeonetwork-opensource.org%2Fmanuals%2F4.0.x%2Fen%2Finstall-guide%2Fconfiguring-database.html&data=05|01|bartolomeo.ventura%40eurac.edu|ac24d6a68c184aee7eaf08dbdfa2cb52|9251326703e3401a80d4c58ed6674e3b|0|0|638349662558320999|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=WwmYiVK0tGmLnD1yxTQYURGGKm3r1%2FB1MXPLBv2%2F%2B%2Bg%3D&reserved=0<https://geonetwork-opensource.org/manuals/4.0.x/en/install-guide/configuring-database.html>>
thanks
Bartolomeo Ventura, PhD
Eurac Research
Institute for Earth Observation
T +39 0471 055 374
F +39 0471 055 389
bartolomeo.ventura@...1518...<mailto:bartolomeo.ventura@…1518…%3cmailto:bartolomeo.ventura@…1518…>>
Viale Druso 1
I-39100 Bolzano
www.eurac.edu<http://www.eurac.edu/>
This transmission is intended only for the use of the addressee and may contain confidential or legally privileged information.
If you receive this transmission by error, please notify the author immediately by mail and delete all copies of this transmission and any attachments.
Any use or dissemination of this communication is strictly prohibited by the "Privacy-Code", D.Lgs. 196/2003 and may lead to penal prosecution and liability for damages.
P Think before you print
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net<mailto:GeoNetwork-users@lists.sourceforge.net>
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fgeonetwork-users&data=05|01|bartolomeo.ventura%40eurac.edu|ac24d6a68c184aee7eaf08dbdfa2cb52|9251326703e3401a80d4c58ed6674e3b|0|0|638349662558320999|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=JhTtAh55TVhq7wsr2hxUVWuyMCNJ8JA2Mg%2F7hzlwNn4%3D&reserved=0<https://lists.sourceforge.net/lists/listinfo/geonetwork-users>
GeoNetwork OpenSource is maintained at https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgeonetwork&data=05|01|bartolomeo.ventura%40eurac.edu|ac24d6a68c184aee7eaf08dbdfa2cb52|9251326703e3401a80d4c58ed6674e3b|0|0|638349662558320999|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=4DOxZiFGUMA84nZOr6XK5XwZrtQveBwUwn68bIfozGw%3D&reserved=0<http://sourceforge.net/projects/geonetwork>