I have created a Standalone Java application client using WSAD 5.0.1. The ear file is deployed into WAS 5.0 server. The application contains a Java file which uses local EJB (EJB1) to connect to a remote EJB (EJB2) running on Weblogic, and which updates the database.
Now, the problem I'm facing is that, the lookup appears to have been done properly. But I'm getting the error attached below :
It'd appear that the object returned is of type HomeImpl_WLStub and it cannot be casted into the home interface type (which my code is trying to do). The code snippet goes like this.......
// lookup of IIOP host
Properties env = new Properties();
initialCtx = null;
initialCtx = new InitialContext(env);
//Get home interface
Object objHome = initialCtx.lookup(jndi_name);
stubHome = (com.ibm.test.horizon.CompanionAdapterHome) PortableRemoteObject.narrow( objHome, com.ibm.test.horizon.CompanionAdapterHome.class);
retVal = stubHome.create();
I have the correct lookup details ( I know this because there's another application running on the same WAS machine which is using the same details as my EJB and is able to connect without any issues). I've tried to run the client using 'java' command and also 'launchclient' script. Both of them show me the same error.
Could someone please help me? This is really urgent and I've wasted 2 weeks investigating this issue.
It looks very bizzare problem. Can you please send out your complete Local bean class code. I assume you are not using any WebSphere specific imports in your local bean class.
If Weblogic Bean is correctly deploed I dont see any other problems except the Java Versions on which both the Weblogic and the WebSphere is running.
Have you tried looking up up your Weblogic Bean from standalone Java code by Using the same VM on which your WebSphere runs. If not I suggest to try that out.
I have included weblogic.jar in the classpath. Every other jar file that's required is in the classpath.
The Weblogic EJB has been deployed properly. The other application is able to access it fine. I'm sorry, I could not paste the entire code here, because of contractual issues. But, all I can say is that, the EJB is similar to what the other application is using to connect to the remote EJB. The part of the code that is connecting to the EJB, has been pasted in the original message itself.
Here's the list of libraries that I've imported:
Hope this was what you asked for. Do you think I need to add any specific VM arguments while launching the client? Please help!!!
Do not put weblogic.jar in websphere classpath (remove it if you have put it)instead bundle wl_client.jar (250 kb size jar file) in the EAR you are trying to deploy in WebSphere.
weblogic.jar shares lot of same package defined classes which will conflict with Websphere ones & make sure you are using right context factory which is bundled in client jar of weblogic.
I am unable to find this jar file wl_client.jar. Where can I download a copy. Or does it come installed with the Weblogic? The machine on which WebLogic is installed is out of bounds for us. Are there any version dependencies for this jar file?
If you have a copy of the jar file, could you please mail it to me at jyotsna_bk at yahoo dot com.
Thanks very much.
You can download this wlclient.jar. It is usually in the same folder from where you can find weblogic.jar.
Google "download wlclient.jar"
if you could not then download the evaluation version of weblogic and you are there.
That comes with weblogic server.
The problem , is you are trying to access a bean in different JVM from your call making JVM. That time the other JVM must be aware of your bean stub. That is the problem as I see.
As you told you are getting the JNDI reference perfectly. Then iterate through your JNDI tree and print all entries, see whether the OBJECT you are trying to access is present or not. Please make sure that the Stub must be present of that remote interface in the JNDI tree, If not it will not run.