-
1. Doesn't connect automatically after restarting PostgreSQL
mstruk Feb 2, 2011 4:54 AM (in response to kkas)When something doesn't work, there has to be an error message with a stack trace in the log.
Without the stacktrace we can't know what, and where exactly went wrong, we can only guess.
My guess is that the datasource connection recovery may be the problem. If you restarted the DB then connection pools containing active connections would keep containing the connections. A way to fix that might be to configure automatic connection checking on the datasource.
-
2. Re: Doesn't connect automatically after restarting PostgreSQL
kkas Feb 2, 2011 10:31 PM (in response to mstruk)Hi, Marko.
I've been trying to solve the connection checking problem but I can't...
I tested these following operations to see what stack traces I get:
[Operations:]
start PostgreSQL --> start GateIn --> access the portal(login as John) --> restart PostgreSQL --> access the portal --> SEE WHAT HAPPENS
[Test Cases:]
- (TestNo.1) with no modification
- (TestNo.2) with modification only to server.xml
- (TestNo.3) with modification to both server.xml and producer.server.xml
- (TestNo.4) with modification only to producer.server.xml
[Stack Trace:]
SEE THE ATTACHMENTS
This is what I've done and what I get.
in conf/server.xml:
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml"
validationQuery="select version()" testOnBorrow="true" /> <-------------put this
</GlobalNamingResources>
in conf/producer.server.xml:
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
validationQuery="select version()" testOnBorrow="true" > <-----------------------put this
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
As you guessed, I, too, think the active connections are closed when I restart the DB.
And I don't know how to set automatic connection checking other than what I did...
Thank you,
Kenta
-
3. Re: Doesn't connect automatically after restarting PostgreSQL
kkas Feb 6, 2011 9:25 PM (in response to kkas)Hi.
I've tried above configuration several times, but it doesn't work...
Does anyone know how to setup tomcat to reconnect to DB automatically?
I'm really stack...
Thank you,
Kenta
-
4. Doesn't connect automatically after restarting PostgreSQL
kkas Feb 17, 2011 4:27 AM (in response to kkas)I could successfully done this
by modifing "idm-configuration.xml" (for IDM)and "jcr-configuration.xml" (for JCR).
It only needs to be added "property" with some parameters depending on what you want
in those xml files and there we go.
e.g.
<property name="validationQuery" value="select version();"/>
<property name="testOnBorrow" value="true"/>
Thank you,
Kenta