You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ga...@ercgroup.com on 2003/03/03 04:13:48 UTC

Struts or DBCP?

Hi,
	I'm getting a strange exception in our application. We are using
Struts 1.0 with DBCP 1.0 on iPlanet.
	There is a particular URL in our application which does a lot of
data processing. It take approx 8 to 10 seconds to process and return data
back to the screen.
	If i click on this URL once, wait for 2 secs and then click on this
URL again then I get the exception shown below. It looks like its some kind
of a threading problem. I'm not sure where though..i.e. in our Struts action
class or in the DBCP implementation. I'm able to reproduce this problem only
around once in 25 times.
	The action class defines the connection locally...so there is no
problem there.
	Does anyone have any ideas?

Here's the exception trace

, root cause: java.sql.SQLException: Closed Statement
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
	at
oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:453
0)
	at
oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:6
66)
	at
oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1420)
	at
org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:
159)
	at
com.gecapital.erc.phoenix.entity.ProfileSite.populateColumns(Unknown Source)
	at
com.gecapital.erc.phoenix.entity.ProfileSite.loadCollection(Unknown Source)
	at com.gecapital.erc.phoenix.entity.Profile.loadProfileSites(Unknown
Source)
	at
com.gecapital.erc.phoenix.action.LoadProfileAction.perform(Unknown Source)
	at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja
va:1787)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)````

Thanks,
Gaurav


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Struts or DBCP?

Posted by David Haynes <da...@sympatico.ca>.
My guess, without seeing exactly what you are doing, is that your code
is checking whether it already has precompiled the statement and is
attempting to re-use that statement without having the same database
connection. During the re-use, the previous user is doing either a
stmt.close() or conn.close() method call (or the equivalent thereof).
Since statements are dependent upon their connections, this will cause
an exception like the one below.

Check to see whether you are trying to re-use the statement and either
(a) stop re-using it or (b) add checks around the connection and don't
allow it to be closed. Better yet, move all the database access into a
bean and use the bean's control scope to coordinate database access.

-david-

-----Original Message-----
From: Gaurav.Goyal@ercgroup.com [mailto:Gaurav.Goyal@ercgroup.com] 
Sent: March 2, 2003 10:14 PM
To: struts-user@jakarta.apache.org
Subject: Struts or DBCP?

Hi,
	I'm getting a strange exception in our application. We are using
Struts 1.0 with DBCP 1.0 on iPlanet.
	There is a particular URL in our application which does a lot of
data processing. It take approx 8 to 10 seconds to process and return
data
back to the screen.
	If i click on this URL once, wait for 2 secs and then click on
this
URL again then I get the exception shown below. It looks like its some
kind
of a threading problem. I'm not sure where though..i.e. in our Struts
action
class or in the DBCP implementation. I'm able to reproduce this problem
only
around once in 25 times.
	The action class defines the connection locally...so there is no
problem there.
	Does anyone have any ideas?

Here's the exception trace

, root cause: java.sql.SQLException: Closed Statement
	at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
	at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
	at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
	at
oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java
:453
0)
	at
oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.ja
va:6
66)
	at
oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1420)
	at
org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.j
ava:
159)
	at
com.gecapital.erc.phoenix.entity.ProfileSite.populateColumns(Unknown
Source)
	at
com.gecapital.erc.phoenix.entity.ProfileSite.loadCollection(Unknown
Source)
	at
com.gecapital.erc.phoenix.entity.Profile.loadProfileSites(Unknown
Source)
	at
com.gecapital.erc.phoenix.action.LoadProfileAction.perform(Unknown
Source)
	at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServle
t.ja
va:1787)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)```
`

Thanks,
Gaurav


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org