users@glassfish.java.net

How to disable server-side exception chain propagation in Glassfish?

From: <glassfish_at_javadesktop.org>
Date: Wed, 13 Jun 2007 08:22:13 PDT

I developed a standalone client that calls a stateless EJB deployed in Glassfish. This EJB access a MySQL database using Hibernate. When inserting an object into the database, a constraint violation occurred. The MySQL driver throwed a [i]MySQLIntegrityConstraintViolationException[/i] (subclass of SQLException), that was wrapped by Hibernate into a [i]ConstraintViolationException[/i] (subclass of HibernateException). Since this last exception is a RuntimeException and it wasn't being handled in the EJB, it propagated to Glassfish.

The problem is that Glassfish wrapped the ConstraintViolationException inside a [i]TransactionRolledbackLocalException[/i] and propagated this last one to the caller. So the following exceptions were serialized to the client:

TransactionRolledbackLocalException ---> ConstraintViolationException (from Hibernate) ---> MySQLIntegrityConstraintViolationException (from MySQL)

But the client doesn't (and shouldn't) have the classes for Hibernate or the MySQL driver! This causes the de-serialization at the client side to fail with a [i]org.omg.CORBA.MARSHAL[/i] exception:

2007-jun-13 12:03:18 com.sun.corba.ee.impl.encoding.CDRInputStream_1_0 read_value
VARNING: "IOP00810257: (MARSHAL) Could not load class com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9197)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9212)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:994)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:848)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:254)
        at com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl.<init>(UEInfoServiceContextImpl.java:36)
        at com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults$5.create(ServiceContextDefaults.java:171)
        at com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl.unmarshal(ServiceContextsImpl.java:237)
        at com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl.get(ServiceContextsImpl.java:412)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:473)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:327)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:192)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:163)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:123)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:196)
        at com.spidexa.core.sonline.__UserFacade_Remote_DynamicStub.test(__UserFacade_Remote_DynamicStub.java)
        at com.spidexa.core.sonline._UserFacade_Wrapper.test(com.spidexa.core.sonline._UserFacade_Wrapper.java)
        at com.spidexa.core.Test.main(Test.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
2007-jun-13 12:03:18 com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl <init>
VARNING: "IOP00810261: (MARSHAL) Could not read exception from UEInfoServiceContext"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 261 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotReadInfo(ORBUtilSystemException.java:9311)
        at com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl.<init>(UEInfoServiceContextImpl.java:41)
        at com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults$5.create(ServiceContextDefaults.java:171)
        at com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl.unmarshal(ServiceContextsImpl.java:237)
        at com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl.get(ServiceContextsImpl.java:412)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:473)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:327)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:192)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:163)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:123)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:196)
        at com.spidexa.core.sonline.__UserFacade_Remote_DynamicStub.test(__UserFacade_Remote_DynamicStub.java)
        at com.spidexa.core.sonline._UserFacade_Wrapper.test(com.spidexa.core.sonline._UserFacade_Wrapper.java)
        at com.spidexa.core.Test.main(Test.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9197)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9212)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:994)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:848)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:254)
        at com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl.<init>(UEInfoServiceContextImpl.java:36)
        ... 17 more
Exception in thread "main" org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 261 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotReadInfo(ORBUtilSystemException.java:9311)
        at com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl.<init>(UEInfoServiceContextImpl.java:41)
        at com.sun.corba.ee.spi.servicecontext.ServiceContextDefaults$5.create(ServiceContextDefaults.java:171)
        at com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl.unmarshal(ServiceContextsImpl.java:237)
        at com.sun.corba.ee.impl.servicecontext.ServiceContextsImpl.get(ServiceContextsImpl.java:412)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:473)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:327)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:192)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:163)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:123)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:196)
        at com.spidexa.core.sonline.__UserFacade_Remote_DynamicStub.test(__UserFacade_Remote_DynamicStub.java)
        at com.spidexa.core.sonline._UserFacade_Wrapper.test(com.spidexa.core.sonline._UserFacade_Wrapper.java)
        at com.spidexa.core.Test.main(Test.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9197)
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9212)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:994)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:258)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1980)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2204)
        at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1212)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:393)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:326)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:292)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:918)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1004)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:848)
        at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:254)
        at com.sun.corba.ee.impl.servicecontext.UEInfoServiceContextImpl.<init>(UEInfoServiceContextImpl.java:36)
        ... 17 more


When I put [b]both[/b] Hibernate and MySQL driver on the classpath at the client I get the following stack trace instead:

Exception in thread "main" javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: org.hibernate.exception.ConstraintViolationException: could not insert: [com.spidexa.core.internal.domain.PartnerBank]
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: org.hibernate.exception.ConstraintViolationException: could not insert: [com.spidexa.core.internal.domain.PartnerBank]
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:191)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:176)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:123)
        at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:196)
        at com.spidexa.core.sonline.__UserFacade_Remote_DynamicStub.test(__UserFacade_Remote_DynamicStub.java)
        at com.spidexa.core.sonline._UserFacade_Wrapper.test(com.spidexa.core.sonline._UserFacade_Wrapper.java)
        at com.spidexa.core.Test.main(Test.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.rmi.RemoteException: null; nested exception is:
        javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: org.hibernate.exception.ConstraintViolationException: could not insert: [com.spidexa.core.internal.domain.PartnerBank]
        at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:237)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1337)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1267)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
        at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:104)
        at $Proxy285.test(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:125)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:658)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:198)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1821)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1681)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1063)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:179)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:781)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:538)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2542)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:502)
Caused by: javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: org.hibernate.exception.ConstraintViolationException: could not insert: [com.spidexa.core.internal.domain.PartnerBank]
        at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:3672)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3520)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1305)
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1267)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
        at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:114)
        at $Proxy281.test(Unknown Source)
        at com.spidexa.core.internal.facade.SOnlineFacadeBean.test(SOnlineFacadeBean.java:270)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1055)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:163)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2846)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3930)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
        ... 17 more
javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: null; nested exception is:
        javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: org.hibernate.exception.ConstraintViolationException: could not insert: [com.spidexa.core.internal.domain.PartnerBank]
        at com.spidexa.core.sonline._UserFacade_Wrapper.test(com.spidexa.core.sonline._UserFacade_Wrapper.java)
        at com.spidexa.core.Test.main(Test.java:30)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

This is wrong in my opinion, because the client shouldn't get MARSHAL exceptions from EJB invocations, only EJBException. I fully understand why this is happening in this case, but Glassfish shouldn't propagate arbitrary exceptions to the client code since it's not known if the client will have the class files available to de-serialize the full exception chain. Or the client-side stub implemented by Glassfish should be able to detect this situation and throw a EJBException at the client side.

Is it even possible by the spec for an EJB remote call to throw MARSHAL? I thought only EJBException (apart from the exceptions the EJB declared in its throw clause) was allowed.

So, my question is: Is there any option to turn off this exception chain propagation in Glassfish? I'd rather prefer not to have the cause at the client side than having to handle this MARSHAL exceptions.
[Message sent by forum member 'lbschenkel' (lbschenkel)]

http://forums.java.net/jive/thread.jspa?messageID=221953