Hi akhil,

nntp://news.gmane.org/gmane.group.name wrote:
Hi,

We have started facing this issue randomly on RC4.
Using PB API under AppServer. Called from SLSBs.
Each session calls the PBFactory().getdefaultBroker()... uses it and called
PB.close().
intermittently we are getting an SQLException which means the
PreparedStatement was closed (stack trace below)

Any ideas when/how this can happen ?

I think it happens because PBFactory.defaultPersistenceBroker() serves the same broker instance to all SBs.
So it may happen that one SB closes the broker (and closing the connection thus invalidating the prepared statements).
A different SB using the same broker instance is then confronted with closed resources an thus throws the exceptions you see.


You shoul use PBFactory.createPersistenceBroker(PBKey key) to obtain one broker instance for each SB.


Is there a non-caching alternative to "StatementsForClassImpl"
(just to build in the thaught... we wont face this if we do no cache
PreparedStatements)

you could implement your own class, but there is no alternative implementation shipping with the distro.


YOu could also use the ConnectionFactoryClass entry in OJB.properties to specify a ConnectionFactory that behaves differently.
Have a look at OJB.properties for more details


But as I've already mentioned, I think the problem is not related to problems with prepared statements or connections, but with running multiple SBs against one broker instance.


cheers, Thomas


TIA akhil

rethrown as org.apache.ojb.broker.PersistenceBrokerSQLException:
[IBM][JDBCDriver] CLI0601E Invalid statement handle or statement is
closed.SQLSTATE=S1000
at
org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedStmt(Sta
tementsForClassImpl.java:188)

at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(Stat
ementManager.java:680)

at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl
.java:266)

at org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:200)

at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIterator
FactoryImpl.java:95)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Pers
istenceBrokerImpl.java:2371)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Persis
tenceBrokerImpl.java:1712)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1343)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1515)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1551)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis
tenceBrokerImpl.java:1540)

at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Persistenc
eBrokerImpl.java:1802)

at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Dele
gatingPersistenceBroker.java:286)

at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Dele
gatingPersistenceBroker.java:286)






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to