File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes UnknownException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "UnknownException" Watch "UnknownException" New topic


Anupreet Arora
Ranch Hand

Joined: Jun 17, 2003
Posts: 81
Whenever any unchecked runtime exeption (For Ex
Nullpointer) is thrown from beyond the EJB layer in our application, it is
getting converted to Corba Unknown Exception (org.omg.CORBA.portable.UnknownException) and shown to the user on the
error screen.

This is misleading as the actual error gets lost. This happens in WSAD as well as WAS server (Version 5.1) where the application is deployed.

Early investigation shows that there is some problem with the stubs and ties being generated by websphere.

Has anybody faced similar problem using Websphere 5.1 and is there a fix or workaround.

Many Thanks
Dileep Kamath

Joined: Jul 15, 2006
Posts: 19
EJB 2.0 specification says that RuntimeExceptions should no be thrown across the EJB layer:

Found this in the ejb 2.0 specification (Chapter 18, downloaded from 2.0 Final Release Specification):

An application exception class must be a subclass (direct or indirect) of java.lang.Exception.
An application exception class must not be defined as a subclass of the java.lang.RuntimeException,
or of the java.rmi.RemoteException. These are reserved for system exceptions.
(See next subsection).

The Bean Provider is also responsible for using the standard EJB application exceptions
(javax.ejb.CreateException, javax.ejb.RemoveException, javax.ejb.FinderException,
and subclasses thereof) as described in Subsections 10.5.8 and 12.1.8.
Anupreet Arora
Ranch Hand

Joined: Jun 17, 2003
Posts: 81

Thanks for your response. The exceptions I am talking about would come under the 18.2.2 System exceptions section of the specs.

What is happening is, if a NullPointer comes for some unknown reason, it is to be thrown as is .. it gets propagated across the tiers of the application till it reaches EJB stubs and skeleton, which are supposed to convert it to remote exception.
"The Container catches a non-application exception; logs it (which can result in alerting the SystemAdministrator); and, unless the bean is a message-driven bean, throws the java.rmi.RemoteException(or subclass thereof) to the client if the client is a remote client, or throws the javax.ejb.EJBException (or subclass thereof) to the client if the client is a local client. TheBean Provider can rely on the Container to perform the following tasks when catching a non-applicationexception:
The transaction in which the bean method participated will be rolled back.
No other method will be invoked on an instance that threw a non-application exception.

But sth goes wrong, and all we get is Corba Unknown Exception (org.omg.CORBA.portable.UnknownException)
I agree. Here's the link:
subject: UnknownException
It's not a secret anymore!