When using container managed datasources I run into the following problem: WARN [WrappedConnection] Closing a result set you left open! Please close it yourself.

414 views
Skip to first unread message

BorgmM

unread,
Nov 18, 2007, 12:24:36 PM11/18/07
to Hermes 2.0 Discussion List
I was trying to use container managed datasources (JBoss 4.0.5.GA) for
both embs and as2.
I made the following configuration changes to make it work:

- copy the corvus webapps directory to the server/default/deploy
directory and rename to corvus.war (no need to make an actual war
file).
- add a jboss-web.xml file to the corvus.war/WEB-INF directory with
the following contents:
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/as2db</res-ref-name>
<jndi-name>java:hermesAs2DS</jndi-name>
</resource-ref>

<resource-ref>
<res-ref-name>jdbc/ebms</res-ref-name>
<jndi-name>java:hermesEbmsDS</jndi-name>
</resource-ref>

<security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>
(I'm using the default jmx-security setup here)
- add the datasources to corvus.war/WEB-INF/web.xml:
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<web-app>

<display-name>Corvus</display-name>

.
.
.

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Corvus Restricted Area</realm-name>
</login-config>

<security-role>
<role-name>admin</role-name>
</security-role>

<resource-ref>
<res-ref-name>jdbc/as2db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<resource-ref>
<res-ref-name>jdbc/ebms</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

</web-app>
(I also simplified security a bit)

- modified ebms.module.xml to use the new datasource:

<component id="daofactory" name="System DAO Factory">
<!--
class>hk.hku.cecid.piazza.commons.dao.ds.SimpleDSDAOFactory</class>
<parameter name="driver" value="org.postgresql.Driver"/>
<parameter name="url" value="jdbc:postgresql://127.0.0.1:5432/ebms"/
>
<parameter name="username" value="corvus"/>
<parameter name="password" value="corvus"/>
<parameter name="pooling" value="true"/>
<parameter name="maxActive" value="30"/>
<parameter name="maxIdle" value="10"/>
<parameter name="maxWait" value="-1"/-->

<class>hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAOFactory</class>
<parameter name="datasource" value="java:/comp/env/jdbc/ebms" />
<parameter name="config">
hk/hku/cecid/ebms/spa/conf/DAOMessage.xml,
hk/hku/cecid/ebms/spa/conf/DAORepository.xml,
hk/hku/cecid/ebms/spa/conf/DAOOutbox.xml,
hk/hku/cecid/ebms/spa/conf/DAOInbox.xml,
hk/hku/cecid/ebms/spa/conf/DAOMessageServer.xml,
hk/hku/cecid/ebms/spa/conf/DAOPartnership.xml
</parameter>
</component>

- modified as2.module.core.xml to use the new datasource:

<component id="daofactory" name="AS2 DAO Factory">
<!--
class>hk.hku.cecid.piazza.commons.dao.ds.SimpleDSDAOFactory</class>
<parameter name="driver" value="org.postgresql.Driver"/>
<parameter name="url" value="jdbc:postgresql://127.0.0.1:5432/as2"/>
<parameter name="username" value="corvus"/>
<parameter name="password" value="corvus"/>
<parameter name="pooling" value="true"/>
<parameter name="maxActive" value="30"/>
<parameter name="maxIdle" value="10"/>
<parameter name="maxWait" value="-1"/-->
<class>hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAOFactory</
class>
<parameter name="datasource" value="java:/comp/env/jdbc/as2db" />
<parameter name="config" value="hk/hku/cecid/edi/as2/conf/
as2.dao.xml"/>
</component>

- I added the datasource definition files to the server/default/deploy
directory

And yes, it does work fine this way, but now my log files are rapidly
growing with the following warning messages

17:25:23,479 WARN [WrappedConnection] Closing a result set you left
open! Please close it yourself.
java.lang.Throwable: STACKTRACE
at
org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:
617)
at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:
237)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceQuery.doTransaction(DataSourceQuery.java:
88)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProcess.java:
89)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO.java:
413)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO.java:
392)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
324)
at
hk.hku.cecid.ebms.spa.dao.MessageDataSourceDAO.findMessagesByMessageBoxAndStatus(MessageDataSourceDAO.java:
97)
at
hk.hku.cecid.ebms.spa.task.OutboxCollector.getTaskList(OutboxCollector.java:
51)
at
hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModule.java:
137)
at
hk.hku.cecid.piazza.commons.module.ActiveModule.run(ActiveModule.java:
213)
at java.lang.Thread.run(Thread.java:613)
17:25:23,480 WARN [WrappedConnection] Closing a result set you left
open! Please close it yourself.
java.lang.Throwable: STACKTRACE
at
org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:
617)
at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:
237)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceQuery.doTransaction(DataSourceQuery.java:
88)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProcess.java:
89)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO.java:
413)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO.java:
392)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
324)
at
hk.hku.cecid.ebms.spa.dao.MessageDataSourceDAO.findMessagesByMessageBoxAndStatus(MessageDataSourceDAO.java:
97)
at
hk.hku.cecid.ebms.spa.task.InboxCollector.getTaskList(InboxCollector.java:
46)
at
hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModule.java:
137)
at
hk.hku.cecid.piazza.commons.module.ActiveModule.run(ActiveModule.java:
213)
at java.lang.Thread.run(Thread.java:613)
17:25:23,727 INFO [as2] Total number of messages recovered: 0
17:25:23,740 WARN [WrappedConnection] Closing a result set you left
open! Please close it yourself.
java.lang.Throwable: STACKTRACE
at
org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedStatement.java:
617)
at
org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:
237)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceQuery.doTransaction(DataSourceQuery.java:
88)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProcess.java:
89)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO.java:
413)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO.java:
392)
at
hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
324)
at
hk.hku.cecid.edi.as2.dao.MessageDataSourceDAO.findMessagesByStatus(MessageDataSourceDAO.java:
39)
at
hk.hku.cecid.edi.as2.module.IncomingMessageList.getTaskList(IncomingMessageList.java:
34)
at
hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModule.java:
137)
at
hk.hku.cecid.piazza.commons.module.ActiveModule.run(ActiveModule.java:
213)
at java.lang.Thread.run(Thread.java:613)
17:25:23,734 INFO [as2] AS2 server started up successfully

This is the result of a minor error in DataSourceQuery.java, in the
doTransaction method the statement is closed before closing the
resultset, see below:
finally {
if (pStmt!=null) {
try {
pStmt.close();
}
catch (Exception ex) {
throw new DAOException("Error in closing prepared
statement: ", ex);
}
}
if (rs!=null) {
try {
rs.close();
}
catch (Exception ex) {
throw new DAOException("Error in closing result set: ",
ex);
}
}

Regards,

Martin Borgman.

BorgmM

unread,
Nov 18, 2007, 1:13:28 PM11/18/07
to Hermes 2.0 Discussion List
One additinal point:

You have to remove log4j.jar from corvus.war/WEB-INF/lib.

Regards,

Martin.

hoc...@gmail.com

unread,
Nov 18, 2007, 9:20:29 PM11/18/07
to Hermes 2.0 Discussion List
Hi Martin,

Thank you for your finding.
We would change closing PreparedStatement and ResultSet sequence in
next version of release after testing.
And you're right, it was mentioned by other member, it has to remove
log4.jar when using JBoss.

Regards,
Philip
> > 392)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
> > 324)
> > at
> > hk.hku.cecid.edi.as2.dao.MessageDataSourceDAO.findMessagesByStatus(MessageD ataSourceDAO.java:
> > 39)
> > at
> > hk.hku.cecid.edi.as2.module.IncomingMessageList.getTaskList(IncomingMessage List.java:
> > 34)
> > at
> > hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModul e.java:

hoc...@gmail.com

unread,
Nov 19, 2007, 10:21:41 PM11/19/07
to Hermes 2.0 Discussion List
Hi Martin,

Just curious. Do you know what's the problem exactly for the log4
library? Because the one packaged in H2O is too old and crash the same
library in JBoss?
Know what's the result (error log) if not remove the jar?

Thanks,
Philip

On Nov 19, 2:13 am, BorgmM <borgman.mar...@gmail.com> wrote:
> > org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedS tatement.java:
> > 617)
> > at
> > org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(Wrapp edPreparedStatement.java:
> > 237)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceQuery.doTransaction(DataSource Query.java:
> > 88)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProces s.java:
> > 89)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO .java:
> > 413)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO .java:
> > 392)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
> > 324)
> > at
> > hk.hku.cecid.ebms.spa.dao.MessageDataSourceDAO.findMessagesByMessageBoxAndS tatus(MessageDataSourceDAO.java:
> > 97)
> > at
> > hk.hku.cecid.ebms.spa.task.OutboxCollector.getTaskList(OutboxCollector.java :
> > 51)
> > at
> > hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModul e.java:
> > 137)
> > at
> > hk.hku.cecid.piazza.commons.module.ActiveModule.run(ActiveModule.java:
> > 213)
> > at java.lang.Thread.run(Thread.java:613)
> > 17:25:23,480 WARN [WrappedConnection] Closing a result set you left
> > open! Please close it yourself.
> > java.lang.Throwable: STACKTRACE
> > at
> > org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedS tatement.java:
> > 617)
> > at
> > org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(Wrapp edPreparedStatement.java:
> > 237)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceQuery.doTransaction(DataSource Query.java:
> > 88)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProces s.java:
> > 89)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO .java:
> > 413)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO .java:
> > 392)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
> > 324)
> > at
> > hk.hku.cecid.ebms.spa.dao.MessageDataSourceDAO.findMessagesByMessageBoxAndS tatus(MessageDataSourceDAO.java:
> > 97)
> > at
> > hk.hku.cecid.ebms.spa.task.InboxCollector.getTaskList(InboxCollector.java:
> > 46)
> > at
> > hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModul e.java:
> > 137)
> > at
> > hk.hku.cecid.piazza.commons.module.ActiveModule.run(ActiveModule.java:
> > 213)
> > at java.lang.Thread.run(Thread.java:613)
> > 17:25:23,727 INFO [as2] Total number of messages recovered: 0
> > 17:25:23,740 WARN [WrappedConnection] Closing a result set you left
> > open! Please close it yourself.
> > java.lang.Throwable: STACKTRACE
> > at
> > org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedS tatement.java:
> > 617)
> > at
> > org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(Wrapp edPreparedStatement.java:
> > 237)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceQuery.doTransaction(DataSource Query.java:
> > 88)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProces s.java:
> > 89)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO .java:
> > 413)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeQuery(DataSourceDAO .java:
> > 392)
> > at
> > hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.find(DataSourceDAO.java:
> > 324)
> > at
> > hk.hku.cecid.edi.as2.dao.MessageDataSourceDAO.findMessagesByStatus(MessageD ataSourceDAO.java:
> > 39)
> > at
> > hk.hku.cecid.edi.as2.module.IncomingMessageList.getTaskList(IncomingMessage List.java:
> > 34)
> > at
> > hk.hku.cecid.piazza.commons.module.ActiveTaskModule.execute(ActiveTaskModul e.java:

BorgmM

unread,
Dec 3, 2007, 2:14:08 PM12/3/07
to Hermes 2.0 Discussion List
Hi Philip,

The problem is a class loader exception because the log4j classes are
already loaded by JBoss.
This is a common problem in JBoss v.4.0.x and they fixed this in JBoss
v.4.2.x and up.

Regards,

Martin Borgman
> ...
>
> read more >>
Reply all
Reply to author
Forward
0 new messages