I am working with OC4J (nee Orion) and have found 2 really weird things going on involving EJBExceptions, and I was hoping someone else had run into these issues and could help me.
1) I thought that throwing an EJBExeption from a stateless session bean method in a Required transaction context was enough to roll back the transaction (and kill the bean instance). Calling SessionContext.setRollbackOnly() shouldn't be necessary. I have tried both approaches (just throwing EJBException and calling SessionContext.setRollbackOnly() when an exception is thrown), yet in both cases any database changes that have been made are not rolled back. Do I have to explicitly place the entity beans involved in a transaction context as well even if their methods are ultimately called by the session bean in question? I thought the transaction context just propagated all the way through....
2) I thought that when an EJB exception is thrown at the bean level, the client should receive a RemoteException (whose Throwable detail member contains the details of what happened). However, my test client is receiving a null.
For example, assume I have TestBean, TestHome, and Test, and Test (and TestBean of course) has a method called foo (original I know). The client uses TestHome.create() to get an instance of Test. He then does something akin to
Object o = Test.foo();
but TestBean.foo() throws an EJBException. I assumed that the client would receive a RemoteException in this case, but instead in my application foo() returns null. Thus any calls on the o reference throws a NullPointerException. Can anyone explain this?
I assume both these problems can be fixed by configuring something in one of OC4J's several deployment descriptors. If someone could let me know where and how to edit them, I would be very appreciative.
Thanks.
-
OC4J Problems (2 messages)
- Posted by: Neil Chaudhuri
- Posted on: August 28 2002 12:12 EDT
Threaded Messages (2)
- OC4J Problems by Andy Stefancik on August 29 2002 11:14 EDT
- OC4J Problems by Fedro Ponce de Leon on September 11 2002 14:17 EDT
-
OC4J Problems[ Go to top ]
- Posted by: Andy Stefancik
- Posted on: August 29 2002 11:14 EDT
- in response to Neil Chaudhuri
The only thing I can think of is that you have to use
a transaction enabled JDBC driver.
I had a weird one with oc4j also. It seems if I deploy
just one EJB session bean as an application, I am unable
to read an environment entry in ejb-jar.xml via the
initial context. However, if I deploy a second session
I am able to read the environment entry from each bean. -
OC4J Problems[ Go to top ]
- Posted by: Fedro Ponce de Leon
- Posted on: September 11 2002 14:17 EDT
- in response to Andy Stefancik
I am facing a similar problem with Session beans... I am not able to get environment entries in my session beans. Check my post in this forum.