0

I am having trouble locating EJB 3.0 business interfaces on WebSphere Application server 8.0.0.5. When i run the dumpNamespace on the profile directory i get the classes registered on the different context than the one that com.ibm.websphere.naming.WsnInitialContextFactory is using. It seem as when i run the below code it looks for the interfaces on Context: DeveloperCell/nodes/DeveloperNode/servers/WebSphere_Portal when the dumpNameSpace locate the interfaces at (top)/nodes/DeveloperNode/servers/WebSphere_Portal/ejb/testEAR/{myejb.jar/fully-qualified interface name}

[note the content in the{} are placeholders for the real jar and the interface]

Hashtable env = new Hashtable();

        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
        env.put(Context.PROVIDER_URL, "iiop://localhost:10035");
        Context ctx = new InitialContext(env);

        Object obj = ctx.lookup(ProvinceServiceLocal.class.getName());
        ProvinceServiceLocal provinceService = (ProvinceServiceLocal) PortableRemoteObject.narrow(obj, ProvinceServiceLocal.class); 
Thakhani Tharage
  • 1,288
  • 16
  • 19

1 Answers1

0

Local interfaces are only accessible within the same JVM. It is not possible to perform a remote lookup of a local interface.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
  • my business interface implement both local and remote, during testing on my local machine i used local and it works but on the server side is not working. I assume maybe is because we are doing a context lookup as oppose to annotations. and yes the code is in the same JVM – Thakhani Tharage May 02 '13 at 08:47
  • What is the difference between "local machine" and "server side"? Are you using embeddable container on your local machine, or.. ? – Brett Kail May 02 '13 at 14:12
  • for local machine i ma referring to my laptop running WAS and for my local testing. The server is when i export my modules to the dev environment to integrate with other modules as we us MVC pattern – Thakhani Tharage May 04 '13 at 05:22
  • So this code somehow works in WAS on your laptop but not on the dev server? I have no idea why that would be, sorry. – Brett Kail May 04 '13 at 17:13