Problem:
- Product Name: VisiBroker Java
- Product Version: 6.x and above
- Product Component: Initialization
- Platform/OS version: All
- JDK/Compiler version: All
Resolution:
To start VisiBroker applications from pure java launcher, one needs to set the correct Classpath and necessary properties.
Classpath: Besides the obvious classpathes (i.e. core lib - vbjorb.jar; license modules - lm.jar and sanct6.jar; optionally, vbsec.jar - if Security Service is used, etc.), one also needs to provide the endorsed lib path to JVM - java.endorsed.dirs=$VBROKERDIR/lib/endorsed for updated API definitions from omg. (endorsed lib is the standard override mechanism (http://docs.oracle.com/javase/7/docs/technotes/guides/standards/) in JVM to incorporate newer versions of standards created outside of JCP. In VisiBroker's case, it's OMG specifications.) If java.endorsed.dirs property is not set it correctly, user might encounter errors like NoSuchMethodError reported on certain OMG classes.
Properties:
- ORB implementation plug-in properties:
Name Value org.omg.CORBA.ORBClass com.inprise.vbroker.orb.ORB org.omg.CORBA.ORBSingletonClass com.inprise.vbroker.orb.ORBSingleton These 2 properties are used by JVM to dynamically load ORB implementation at run time.
- RMI-IIOP implementation plug-in properties:
Name Value javax.rmi.CORBA.StubClass com.inprise.vbroker.rmi.CORBA.StubImpl javax.rmi.CORBA.UtilClass com.inprise.vbroker.rmi.CORBA.UtilImpl javax.rmi.CORBA.PortableRemoteObjectClass com.inprise.vbroker.rmi.CORBA.PortableRemoteObjectImpl These 3 properties are used by JVM to load RMI-IIOP implementation at run time.
-
License properties:
Name Value borland.enterprise.licenseDir $VBROKERDIR/var borland.enterprise.licenseDefaultDir $VBROKERDIR/license NOTE: These 2 properties have to be set at the system level (i.e. System.setProperties(...) or System.setProperty(...)) before the ORB is initialized.
Given that, one can either start VisiBroker application with java -D[name]=[value] for all the above properties, e.g.
java -Djava.endorsed.dirs=$VBROKERDIR/lib/endorsed -Djavax.rmi.CORBA.StubClass=com.inprise.vbroker.rmi.CORBA.StubImpl -Djavax.rmi.CORBA.UtilClass=com.inprise.vbroker.rmi.CORBA.UtilImpl -Djavax.rmi.CORBA.PortableRemoteObjectClass=com.inprise.vbroker.rmi.CORBA.PortableRemoteObjectImpl -Dorg.omg.CORBA.ORBClass=com.inprise.vbroker.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=com.inprise.vbroker.orb.ORBSingleton -Dborland.enterprise.licenseDir=$VBROKERDIR/var -Dborland.enterprise.licenseDefaultDir=$VBROKERDIR/license ...
( this is pretty similar to the output given by running the command "vbj -javacmd ...")
or embed these properties programmatically, for example:
...
// Set License Properties -- not necessary if it's a pure CORBA client application
System.setProperty("borland.enterprise.licenseDir", "C:\\\\MicroFocus\\\\VisiBroker85\\\\var");
System.setProperty("borland.enterprise.licenseDefaultDir", "C:\\\\MicroFocus\\\\VisiBroker85\\\\license");
java.util.Properties props = new java.util.Properties ();
// For ORB
props.put("org.omg.CORBA.ORBClass", "com.inprise.vbroker.orb.ORB");
props.put("org.omg.CORBA.ORBSingletonClass", "com.inprise.vbroker.orb.ORBSingleton");
// FOR RMI-IIOP -- not necessary it's a pure CORBA application
props.put("javax.rmi.CORBA.StubClass", "com.inprise.vbroker.rmi.CORBA.StubImpl");
props.put("javax.rmi.CORBA.UtilClass", "com.inprise.vbroker.rmi.CORBA.UtilImpl");
props.put("javax.rmi.CORBA.PortableRemoteObjectClass", "com.inprise.vbroker.rmi.CORBA.PortableRemoteObjectImpl");
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init((String[])null,props);
...
The implications of setting these properties incorrectly may cause error immediately or remain unnoticed for a long time. For instance, some customers encountered problems when incorrectly setting both ORBClass and ORBSingletonClass to com.inprise.vbroker.orb.ORB, which leads to NullPointerException with some misleading stack trace like this:
...
com.inprise.vbroker.Logging.LogRegistry.initProperties
com.inprise.vbroker.Logging.LogRegistry.
com.inprise.vbroker.orb.ORB.getRegistry
com.inprise.vbroker.orb.CDROutputStream.setup
com.inprise.vbroker.orb.CDROutputStream.
com.inprise.vbroker.orb.ORBSingleton.create_cdr_output_stream
...
or even memory leak.
#ORBSingletonClass
#ORBClass
#properties
#Java
#VisiBroker
#nullpointerexception
#Security
#NoSuchMethodError
#launcher