Problem:
- Product Name: VisiBroker
- Product Version: 7.0
- Platform: All
CORBA clients in web applications with different web contexts causes java.rmi.MarshalException.
A web application (.war) create a CORBA client and bundle a copy of the vbjorb.jar. When multiple war files are loaded by the Tomcat container, a CORBA.MARSHAL error is thrown. A ClassCast exception has occurred when loading the VisiBroker's class for javax.rmi.CORBA.UtilClass property. If the JVM CORBA classes are used instead, the exception does not occur.
Exception:
java.rmi.MarshalException: CORBA MARSHAL 0[com.inprise.vbroker.GIOP.OutputStream cannot be cast to com.inprise.vbroker.orb.CDROutputStream]; nested exception is:
org.omg.CORBA.MARSHAL: com.inprise.vbroker.GIOP.OutputStream cannot be cast to com.inprise.vbroker.orb.CDROutputStream vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.inprise.vbroker.rmi.CORBA.UtilImpl.newInstance(Unknown Source)
at com.inprise.vbroker.rmi.CORBA.UtilImpl._mapSystemException(Unknown Source)
at com.inprise.vbroker.rmi.CORBA.UtilImpl.mapSystemException(Unknown Source)
at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at vue.service._MyService_Stub.doIt(_MyService_Stub.java:146)
at vue.client.CallService.run(CallService.java:19)
at vue.webapp.TestServlet.callService(TestServlet.java:45)
at vue.webapp.TestServlet.init(TestServlet.java:33)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
Resolution:
The UtilImpl class extends javax.rmi.CORBA.UtilDelegate and is loaded by javax.rmi.CORBA.Util(JVM's rt.jar). The Util class sets this instance as static(one per JVM). Since the vbjorb.jar is in the application level, the first webapp classloader loads this class and the second one cannot load the static class again.
A new UtilImplProxy class is introduced which creates a new instance of UtilImpl per classloader (if necesssary).
The "javax.rmi.CORBA.UtilClass" property should now be set with "com.inprise.vbroker.rmi.CORBA.UtilImplProxy" to take advantage of this enhancement. This class should be used when an application need to load two or more vbjorb.jar in a single JVM.
A new UtilImplProxy class is introduced which creates a new instance of UtilImpl per classloader (if necesssary).
The "javax.rmi.CORBA.UtilClass" property should now be set with "com.inprise.vbroker.rmi.CORBA.UtilImplProxy" to take advantage of this enhancement. This class should be used when an application need to load two or more vbjorb.jar in a single JVM.
#Security
#VisiBroker