This content has been marked as final.
Show 2 replies
-
1. Re: CMR IllegalStateException
hale2jo Feb 19, 2003 6:06 PM (in response to hale2jo)We figured out the solution. I thought I would post the answer in case anyone else comes across this problem....
Need to use Transactions....(This will also increase performance quite nicely.)
Put this code snipet around any calls to EJBs....
import javax.naming.InitialContext;
import javax.transaction.*;
UserTransaction tx = null;
try
{
// Start Transaction
InitialContext ctx = new InitialContext();
tx = (UserTransaction)ctx.lookup("UserTransaction");
tx.begin();
//EJB code calls, etc, go here...
if( tx.getStatus()==Status.STATUS_ACTIVE)
{
tx.commit();
}
}
catch(Exception e)
{
try
{
if( tx !=null)
tx.rollback();
}
catch(SystemException unused)
{
//do whatever
}
} -
2. Re: CMR IllegalStateException
frankielam Mar 22, 2003 5:43 AM (in response to hale2jo)A real lifesaver. Thanks!