EJB programming & troubleshooting: Remote EJB lookup problem on Websphere 6.1
Hi, i have developed a simple stateless session bean and deployed it to the WAS 6.1 I need to get ejb by remote lookup method without using application client container. Server and my code are running on separate machines. My Context.PROVIDER_URL is like this "corbaloc:iiop:serverip:2809" and jndi name is like this "ejb/DemoHome" When i try this i get the "javax.naming.ConfigurationException:Name space accessor for the java : name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment" How can i get an ejb reference from a client by remote lookup method ? I do not want to install application client container.. I can do the same thing on JBoss without any problem.I am using "jnp://localhost:1099" and it's working great. Isn't it possible on WAS 6.1 to get ejb reference remotely within any java application without installing any container on the client ? Could you help me please ? Thanks...
- Posted by: Koray Gazezoglu
- Posted on: November 06 2006 12:37 EST
Are you doing something like this: Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory"); prop.put(Context.PROVIDER_URL,"iiop:/localhost:900"); Context ctx = new InitialContext(prop); cheers, http://www.javaicillusion.blogspot.com/
Yes..I do not want to run application within container, because test tools can not catch the main application for performance tests. here is my code Hashtable p = new Hashtable() p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WSInitialContextFactory"); p.put(Context.PROVIDER_URL,"corbaloc:iiop:server_ip:2809"); // tried iiop:// also InitialContext ctx = new InitialContext(p); Object objRef = ctx.lookup(jndi_name); // "cell/node1/servers/server1/ejb/ejbs/TestHome" myHome = (TestHome) PortableRemoteObject.narrow(objRef, TestHome.class); When i run this code, i am getting this error message javax.naming.NameException: Failed to initialize the ORB [Root exception is org.omg.CORBA.INITIALIZE: Unable to init plugins vmcid: IBM minor code: 504]
I switched to SUN JRE 1.5 When i use "com.sun.jndi.cosnaming.CNCtxFactory" as PROVIDER_URL ,InitialContext.lookup returning object reference as null... Do you know the reason ?
check these url: http://forum.java.sun.com/thread.jspa?threadID=546489&start=15 cheers, http://www.javaicillusion.blogspot.com/