• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.rmi.UnexpectedException ????

Anup Bansal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a stateless EJB server applicaton deployed on Websphere 5.1 applicaiton server. The client for this application is running on a different applcaiton server.
The client jar for the EJB application was built using the same tool as used to built the EJB applicaiton.

During normal inputs, the EJB server applicaiton is invoked properly.
However when the server is throwing a applicaiton exception, SOMETIMES, theexception being thrown is not of the wrapped applicaiton exception class.
The remote method being invoked has the following signature:
public void sendDocument(String BCDBNumber, String timestamp, byte[] document) throws FCAServerException

When the server is throwing any exception as FCAServerException, the client does not receive it as FCAServerException but as java.rmi.UnexpectedException.

I get the following messages in the logs: IDL:com/nl/_component/lite/fca/_exception/FCAServerEx:1.0

When i cheked the generated code (Stub and the tie classes) i see the following:
In the _EJSRemoteStatelessFCAServer_983a6b42_Tie
private org.omg.CORBA.portable.OutputStream sendDocument(org.omg.CORBA_2_3.portable.InputStream in , org.omg.CORBA.portable.ResponseHandler reply) throws Throwable {
String arg0 = (String) in.read_value(String.class);
String arg1 = (String) in.read_value(String.class);
byte[] arg2 = (byte[]) in.read_value(byte[].class);
try {
target.sendDocument(arg0, arg1, arg2);
} catch (FCAServerException ex) {
String id = "IDL:com/nl/component/lite/fca/_exception/FCAServerEx:1.0";
org.omg.CORBA_2_3.portable.OutputStream out =
(org.omg.CORBA_2_3.portable.OutputStream) reply.createExceptionReply();
return out;
org.omg.CORBA.portable.OutputStream out = reply.createReply();
return out;

In the _FCAServer_Stub class

public void sendDocument(String arg0, String arg1, byte[] arg2) throws FCAServerException, RemoteException {
if (!Util.isLocal(this)) {
try {
org.omg.CORBA_2_3.portable.InputStream in = null;
try {
org.omg.CORBA_2_3.portable.OutputStream out =
_request("sendDocument", true);
} catch (ApplicationException ex) {
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
String id = in.read_string();
if (id.equals("IDL:com/nl/component/lite/fca/_exception/FCAServerEx:1.0")) {
throw (FCAServerException) in.read_value(FCAServerException.class);
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
} finally {
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} else {
ServantObject so = _servant_preinvoke("sendDocument",com.nl.component.lite.fca.ejb.FCAServer.class);
if (so == null) {
sendDocument(arg0, arg1, arg2);
try {
Object[] copies = Util.copyObjects(new Object[]{arg0,arg1,arg2},_orb());
String arg0Copy = (String) copies[0];
String arg1Copy = (String) copies[1];
byte[] arg2Copy = (byte[]) copies[2];
((com.nl.component.lite.fca.ejb.FCAServer)so.servant).sendDocument(arg0Copy, arg1Copy, arg2Copy);
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
if (exCopy instanceof FCAServerException) {
throw (FCAServerException)exCopy;
throw Util.wrapException(exCopy);
} finally {

The exception id generated is the same in the classes but during invocation an underscore is added before component and hence the java.rmi.UnexpectedException is thrown.

I decompiled the generated classes in the cleint jar and the EJB server application and the ID mentioned is the same.

I do not understand why this IDL:com/nl/_component/lite/fca/_exception/FCAServerEx:1.0 is being generated different. This problem seems to occur only sometimes and not always. I do not do anything special for it to work but sometimes it just works and once it does it keep working.

If I redeploy the applicaiton again, it fails again and later after some time it works again.

I know my description sounds really wierd but it is.

Can anyone please help?

Thanks & reagrds,
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic