I have the following services offered by a stateful session bean. When a 
business exception is thrown by the bean there is no problem, but when there is 
a unchecked exception (like a Runtime Exception) the bean seems to be removed. 
I don't see any messages indicating the removal of the bean itself, but any 
call to the bean after the runtime exception caused a EJBNoSuchObjectException 
on the client. 
  
  | @Stateful
  | public class AddressBookBean implements AddressBookRemote, AddressBookLocal
  | {
  | ..
  | public String ping(String ping)
  | {
  |   return ping;
  | }
  |   
  | public void createException() throws ContactNotFoundException
  | {
  |   throw new ContactNotFoundException("Testing Exception Handling");
  | }
  |   
  | public void createRuntimeException() throws RuntimeException
  | {
  |   throw new RuntimeException("Testing Runtime Exception Handling");
  | }
  | ..
  | }
  | 

Here is the client side code:

    
  | System.out.println(addressBook.ping("Message"));
  | try
  | {
  |   addressBook.createException();      
  | }
  | catch (ContactNotFoundException cnfe)
  | {
  | System.err.println("Expected exception received : 
"+cnfe.getClass().getName());
  | //This exception is throws correctly
  | }
  | 
  | System.out.println(addressBook.ping("Message"));
  | try
  | {
  |    addressBook.createRuntimeException();      
  | }
  | catch (EJBException ee)
  | {
  |    Exception rootException = ee.getCausedByException();
  |    System.err.println("Root Expected exception received : 
"+rootException.getClass().getName());      
  | //The runtime exception is encapsulated in an EJBException
  | }
  | catch (RuntimeException re)
  | {
  | System.err.println("Expected exception received : 
"+re.getClass().getName());
  | }
  | 
  | //THIS CALL CAUSES THE javax.ejb.EJBNoSuchObjectException: Could not find 
Stateful bean:
  | System.out.println(addressBook.ping("Message"));
  | 

I don't know if this is specified in the EJB3 Spec to behave like this, but it 
does feel a bit like a bug. Any input on this issue would help me a great deal.




View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3942651#3942651

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3942651


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to