Below开发者_如何学Python is the exception I am getting while initializing any ejb object. Could any one tell what is the reason of below exception and how can I resolve it???
Is is Application exception or Environment Exception???
Thanks in Advance... waiting for response ...
[7/12/10 5:05:24:226 EDT] 00000037 ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invoc
ation of method "init" on bean "BeanId(RDxEAR#vs-tle-beans-server.jar#VLSContextHome, C5E6CBE5-0129-4000-E000-C9DF093361B8)".
Exception data: java.rmi.RemoteException
at com.versata.tl.vls.ejb.VLSContextBean.init(VLSContextBean.java:298)
at com.versata.tl.vls.ejb.EJSRemoteStatefulVLSContextHome_acff79a1.init(Unknown Source)
at com.versata.tl.vls.ejb._EJSRemoteStatefulVLSContextHome_acff79a1_Tie.init(_EJSRemoteStatefulVLSContextHome_acff79a
1_Tie.java:2119)
at com.versata.tl.vls.ejb._EJSRemoteStatefulVLSContextHome_acff79a1_Tie._invoke(_EJSRemoteStatefulVLSContextHome_acff
79a1_Tie.java:395)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2703)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2577)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
[7/12/10 5:05:24:231 EDT] 00000037 LocalTranCoor E WLTC0017E: Resources rolled back due to setRollbackOnly() being called.
Looks like the 'Caused by' information is not there, but it seems by part of the stack trace that the Stateful bean's @Init method corresponding to the EJBHome.create() method is throwing a RuntimeException. The 'Resources rolled back' message is likely not the cause of the problem but simply the container carrying it it's job of cleaning up after the runtime exception.
First thing to do is either: 1. Surround the body of the init() method with something that catches and logs the RuntimeException so you can look at where the real source of the problem is, or better... 2. Put that exception logging into an interceptor so it can easily be reused on any other beans in the future.
If you do find the RuntimeException and determine it is an exception you do what to throw without a transaction rollback or your bean instance being destroyed you can use the @ApplicationException annotation on the exception class to turn it into an exception that is safe to throw. If it is a built in exception you can mark it in the ejb-jar.xml file. Note, though, that this affects all usage of the exception type, so be very careful and avoid doing things like java.lang.RuntimeException. Best to mark very specific subclasses of RuntimeException to avoid completely disabling the container's ability to clean up after unexpected exceptions.
精彩评论