Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Problem in executing Java Program on Suns JRE

I have a java program(accessing remote methods of EJB on Websphere Applicaton Developer) which is compiled using IBM Websphere JDK.

The program works fine, if executed using the IBM's JRE.

I have to use the java program in PeopleSoft, and PeopleSoft only allows Sun's JDK.

But if the same program is executed using the Sun's JRE, then it throws the following exception.

javax.naming.NamingException: Failed to initialize the ORB [Root exception is

org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation com.ibm.CORBA.iiop.ORB

vmcid: 0x0 minor code: 0 completed: No]
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:293)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java: 366)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.try.jms.Connection.(Connection.java:45)
at com.try.jms.Connection.(Connection.java:33)
at com.try.jms.Sender.sendMessage(Sender.java:30)
at com.try.Screen.doUnload(Screen.java:242)
at com.try.Screen.access$1(Screen.java)
at com.try.Screen$2.mouseClicked(Screen.java:194)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
at java.awt.Component.processMouseEvent(Component.java:5103)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3207)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation

com.ibm.CORBA.iiop.ORB vmcid: 0x0 minor code: 0 completed: No
at org.omg.CORBA.ORB.create_impl(ORB.java:297)
at org.omg.CORBA.ORB.init(ORB.java:336)
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:77)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:98)
at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:74)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:284)
... 30 more
Caused by: java.lang.UnsatisfiedLinkError: registerNatives
at com.ibm.jvm.ExtendedSystem.registerNatives(Native Method)
at com.ibm.jvm.ExtendedSystem.(ExtendedSystem.java:181)
at com.ibm.rmi.util.JDKBridge.setCodebaseProperties(JDKBridge.java:227)
at com.ibm.rmi.util.JDKBridge.(JDKBridge.java:206)
at com.ibm.rmi.util.RepositoryId.(RepositoryId.java:127)
at com.ibm.rmi.iiop.CDROutputStream.(CDROutputStream.java:1127)
at com.ibm.rmi.corba.ORB.(ORB.java:260)
at com.ibm.rmi.iiop.ORB.(ORB.java:181)
at com.ibm.CORBA.iiop.ORB.(ORB.java:559)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:3 9)
at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImp l.java:

27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at org.omg.CORBA.ORB.create_impl(ORB.java:295)

I conclude here that the problem is only becuase of the Sun's JRE. But can there be any workaround to this? I have also found out about Pluggable Application Client that allows programs to access Websphere resources thoruhg Sun's JRE. more Info : http://www-128.ibm.com/developerworks/websphere/library/techarticles/0409_bhogal/0409_bhogal.html

Kindly help me out with this.
[4925 byte] By [shiwalee] at [2007-11-11 7:38:24]
# 1 Re: Problem in executing Java Program on Suns JRE
there are two possibile solutions which come to my mind:
1. you could try adding the jars for the ORB from the IBM JRE in the classpath. the packages are not available in the Sun JDK (the package name is different)
2. you could modify the startup script of your app server to set the "org.omg.CORBA.ORBClass" system property for the JVM to the com.sun.CORBA.iiop.ORB
it's worth a try.
aniseed at 2007-11-11 22:37:45 >