Hello Everybody,
Here's our configuration
- Weblogic 5.1 (sp10)
- Castor Jar (from cvs)
- Entity Beans (BMP) that use castor for persistence
- container managed transactions
- Required transaction attribute
We're seeing that if our EJB rolls back a transaction (by throwing an
EJBException) castor does not correctly release/close it's connection to the
database causing weblogic to raise resource not available exceptions on
subsequent database operations:
Here's an example..
We've got a UserEJB with the following create method
[UserEJBBean.java]
public Integer ejbCreate(User user) throws CreateException
{
Database db = null;
try
{
// grab the jdo from JNDI and get database
db = _jdoHelper.getDatabase();
// localize relationship objects into this transaction
Role role =
(Role)db.load(Role.class,user.getRole().getOid());
Region region =
(Region)db.load(Region.class,user.getRegion().getOid());
// create new user from passed in user
_user = new User();
_user.setFirstName(user.getFirstName());
_user.setLastName(user.getLastName());
_user.setRole(role);
_user.setRegion(region);
// create record and close db
db.create(_user);
db.close();
return _user.getOid();
}
catch (Exception e)
{
throw new EJBException(e);
}
finally
{
if (!db.isClosed())
db.close();
}
}
If an exception isn't raised within the try-catch block then this method
executes just fine. afterCompletion() is invoked on the db causing it to
correctly commit the transaction - works great. However if an exception is
raised, in order to roll back the transaction we throw an EJBException which
causes the transaction to get rolled back but does not correctly relinquish
the connection causing the app server to blow chunks on subsequent database
operations.
within afterCompletion() on DatabaseImpl.java the transaction status is
correctly set to Status.STATUS_ROLLEDBACK which invokes _ctx.rollback() and
then sets it to null. Should it be doing something else to relinquish the
current connection? Does it need to close it as well (_ctx.close());
Suggestions / Advice on how to debug this?
Is this a castor or a castor/weblogic integration issue?
Thanks in Advance!
-shehryar
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev