Line number is not included from application client stack trace
 Technote (FAQ)
 
Problem
A NullPointerException occurs while calling an EJB™ method in an application client. The stack trace does not include line numbers; however, line numbers are returned when the EJB method is called from a servlet.
 
Cause
CORBA specifications define the behavior where:
  1. The bean method issues NullPointerException
  2. The remote wrapper (EJSRemoteStatelessTest) catches the exception in the Throwable clause
  3. Calls setUncheckedException
 
Solution
The following explains this behavior in detail:
The setUncheckedException wraps the NullPointerException in an UncheckedException with full information in the super base class Throwable and throws the exception from the EJSDeployedSupport() immediately; therefore, the newRemoteException() is not reached.

public void MyMethod() throws java.rmi.RemoteException {
EJSDeployedSupport _EJS_s = new EJSDeployedSupport();
try {
testpackage.TestBean beanRef = (testpackage.TestBean)container.
Invoke(this, 0, _EJS_s);
}
catch (java.rmi.RemoteException ex) {
_EJS_s.setUncheckedException(ex);
}
catch (Throwable ex) {
beanRef.MyMethod();
}
catch (java.rmi.RemoteException ex) {
_EJS_s.setUncheckedException(ex);
}
catch (Throwable ex) {
_EJS_s.setUncheckedException(ex);
throw new RemoteException("bean method raised unchecked
exception", ex);
}
finally {
container.postInvoke(this, 0, _EJS_s);
}
return ;
}


Afterward, the EJB Container performs the postInvoke process and return from the MyMethod() call with an UncheckedExcpetion(NullPointerException). The tie on the server side (_EJSRemoteStatelessTest_Tie) catches the UncheckedException in the Throwable clause and wraps the UncheckedException to the "org.omg.CORBA.portable.UnknownException".

This is the default semantics for CORBA compliance so the method can be called between Java™, C++, or other CORBA compliant service. At this time the call stack is stripped from the exception and not sent back to the client by the orb. The CORBA specification allows only a string to be passed, but not the full Java exception stack.


public org.omg.CORBA.portable.OutputStream _invoke(String method,
org.omg.CORBA.portable.InputStream _in, org.omg.CORBA.portable.
ResponseHandler reply) throws
org.omg.CORBA.SystemException {
try {
...
case 8:
if (method.equals("MyMethod")) {
target.MyMethod();
org.omg.CORBA.portable.OutputStream out =
reply.
return out;
}
...
throw new BAD_OPERATION();
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}


The EJB container has already passed the full exception to the ORB, but is removed due to CORBA compliant implementation.
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > EJB Container
Operating system(s): HP-UX
Software version: 4.0
Software edition:
Reference #: 1175655
IBM Group: Software Group
Modified date: Jul 30, 2004