Websphere App Server vs Sun java client

ufis

Banned for trolling & disrupting the forum
Joined
May 4, 2007
Messages
1,088
Reaction score
1
Can anyone help me with how to access an EJB / DataSource on a WebSphere Application Server from a client that is running Sun's java.

So far I have:
PHP:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://someserver:1234");
env.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");

Context ctx = new InitialContext("path/to/the/ejb");
    
Object o = ctx.lookup(ejbURL);
With this I have added multiple jars from the WAS installation to my classpath, one at a time to fix whetever the current Exception was I was getting.
But this seems to be a never ending process.

Any help is appreciated.
 
Ok, I think you need these. Ps. This is for WAS 6 but I don't have running EJB container with me so I can't test but here goes:

Code:
bootstrap.jar
client.jar
commons-discovery.jar
commons-logging-api.jar
emf.jar
j2c.jar
j2cImpl.jar - Maybe??
j2ee.jar
naming.jar
ras.jar
runtime.jar
runtimeimpl.jar
runtime-utils.jar
security.jar
securityimpl.jar

AND

server.jar from your jdk
 
Otherwise post your stack trace and I will have a look after the meeting I almost have to run to.

Another way if you have a RAD install, create a Enterprise Application Client project and just take watever jars it adds to your classpath when you build the app. It's going to be a bit on the heavy side but it should cover all the needed jars.
 
Running WAS 6.0.x
Client Sun java 1.6

Would it solve my problems if I am able to get IBM jre on the client?

I have a couple of extra jars:
core.jar
ecutils.jar
ffdc.jar
ibmorb.jar
iwsorb.jar
namingclient.jar
wsexception.jar
that I included to fix some ClassNotFoundExceptions.

But I have now included all those on your list that I did not have, but my latest Exception is still the same:
Code:
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:314)
	at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:375)
	at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:113)
	at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:428)
	at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
	at javax.naming.InitialContext.lookup(Unknown Source)
	at mypackage.MyClass.myMethod(MyClass.java:xx)
	at mypackage.MyClass.main(MyClass.java:xx)
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(Unknown Source)
	at org.omg.CORBA.ORB.init(Unknown Source)
	at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:85)
	at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
	at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:97)
	at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:73)
	at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
	at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:305)
	... 7 more
Caused by: java.lang.UnsatisfiedLinkError: com.ibm.jvm.ExtendedSystem.registerNatives()V
	at com.ibm.jvm.ExtendedSystem.registerNatives(Native Method)
	at com.ibm.jvm.ExtendedSystem.<clinit>(ExtendedSystem.java:186)
	at com.ibm.rmi.util.JDKBridge.setCodebaseProperties(JDKBridge.java:227)
	at com.ibm.rmi.util.JDKBridge.<clinit>(JDKBridge.java:206)
	at com.ibm.rmi.util.RepositoryId.<clinit>(RepositoryId.java:128)
	at com.ibm.rmi.iiop.CDROutputStream.<clinit>(CDROutputStream.java:1104)
	at com.ibm.rmi.corba.ORB.<init>(ORB.java:271)
	at com.ibm.rmi.iiop.ORB.<init>(ORB.java:187)
	at com.ibm.CORBA.iiop.ORB.<init>(ORB.java:569)
	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 java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	... 15 more
 
I now have it working running in IBM jre.

But not all clients will be able/willing to to run/install the IBM jre, so the ideal would be to have it working from the sun jre.

Let me know if you find something. Even if you do not, thanks for the effort :)
 
Just a suggestion, in theory you don't need to instantiate your naming lookup context with the IBM classes. It's just a JNDI lookup, which, suppossedly is standard across implementations.

Have you tried to get your InitialContext using the sun classes? The acual path to the EJB might be a bit different though unless you are using aliases.

I assume you are trying to get to your EJB container from a fat client, sounds interesting, tell me more if you can.

Sorry I'm not much more help, I have working on JBoss and SEAM mostley the last year and a half.
 
Top
Sign up to the MyBroadband newsletter
X