Running EJB Client

Hello, I have written a simple EJB and succesfully deployed the same on the WebSphere AppServer 3.4 edition.My client is a JSP ,when i try to run the the client I get the following message,can anybody help me on this.

Hi, Now I have a problem running the client.The client stops running with an exception NameNotFoundException. While genrating deployment descriptor using the jetace tool I have specified the JNDI name and using the same in my client programme too.And I delpoy it successfully using the admin console. I don't exactly why i getting this problem..have i missed out something while installing or should I take care of something else which I haven't done.Please help me out. My client code goes this way... import com.gdii.helloworld.* ; import java.util.*; import java.rmi.*; import javax.naming.*; import javax.ejb.*; import javax.rmi.PortableRemoteObject; public class HelloClient{ public static void main(String [] args) { try { // Properties props = System.getProperties() ; // Context ctx = new InitialContext(props) ; System.out.println("1"); Properties properties = new Properties(); System.out.println("2"); properties.put(javax.naming.Context.PROVIDER_URL,"iiop://192.168.3.134"); properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");

Hi Prashanth I have deployed the bean one which is there in the examples of Websphere 3.5 Application server using the Admin Console and it says the Hello Bean is deployed but when i am running the Client program i am getting the following error N [Root Exception is java.lang.ClassNotFoundException:com.ibm.ejs.ns.jndi.CNInitialContextFactory]javax.Naming.NoInitialContextException:cannot Instantiate class:com.ibm.ejs.ns.jndi.CNInitialContextFactory at java.naming.spi.NamingManager.getDefaultInitialContextFactory(NamingManager.java:720) at java.naming.spi.NamingManager.getInitialContext(NamingManager.java:768) at java.naming.InitialContext.getDefaultInitialContextFactory(InitialContext.java:169) at java.naming.InitialContext.<init><InitialContext.java:148)> at HelloClient.main(HelloClient.java:25) Please can you help me out i am providing the following client code

[This message has been edited by sravan mandala (edited March 13, 2001).]

Ram Pra
Ranch Hand

Joined: Feb 06, 2001
Posts: 37

posted Mar 13, 2001 09:51:00

0

Hey Shrava, Right_Click on the Hello Bean from the admin console and say run.Try running the client then....you should be succesfull Prashanth

Ram Pra
Ranch Hand

Joined: Feb 06, 2001
Posts: 37

posted Mar 14, 2001 10:23:00

0

Hello Sravan, I saw in your client program: You are using my ipaddress instead of urs. **********wrong********************************************* properties.put(javax.naming.Context.PROVIDER_URL,"iiop://192.168.3.134"); ************************************************************* you should be using the follwing.. roperties.put(javax.naming.Context.PROVIDER_URL,"iiop://your ipaddress"); *************************************************************** If you don't know the ip address just go to the dos prompt and type ipconfig You'll get the ip address of ur m/c Prashanth

sravan mandala
Greenhorn

Joined: Mar 13, 2001
Posts: 7

posted Apr 02, 2001 08:32:00

0

Hi Prashanth, Can you help please i have deployed a bean using jetace tool and then when i am running the client program its giving the following error E:\WebSphere\samples>java HelloClient 1 2 3iiop://192.168.0.11 com.ibm.ejs.ns.jndi.CNInitialContextFactory Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/rmi/iiop/ORB at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:477) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:109) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$1(URLClassLoader.java:216) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:191) at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:285) at java.lang.ClassLoader.loadClass(ClassLoader.java:255) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:314) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:199) at org.omg.CORBA.ORB.create_impl(ORB.java:303) at org.omg.CORBA.ORB.init(ORB.java:352) at com.ibm.CORBA.iiop.GlobalORBFactory.init(GlobalORBFactory.java:42) at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:196) at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java, Compiled Code) at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:65) at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:47) at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:343) at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initORB(CNInitialContextFactory.java:355) at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNInitialContextFactory.java:196) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:250) at javax.naming.InitialContext.init(InitialContext.java:226) at javax.naming.InitialContext.<init>(InitialContext.java:202) at HelloClient.main(HelloClient.java:25) and my client program is HelloClient.java

Dear Prashant I have deployed an EJB successfully on WebSphere4.0. I have a client written as a java application. In that I have provided my machine's IP address as PROVIDER_URL and the rest of the code is same as of yours. Still It is giving me ClassNotFoundException for com.ibm.ejs.ns.jndi.CNInitialContextFactory. and you suggested to run the EJB from admin console but that option is also not available in WebSphere Advance Single Server Edition 4.0. Please help Thanks -Sheetal

This is really helpful but not all the way there - now I need to figure out what is proprietary to IBM MQSeries - from my research I believe I need to pass a properties object when I create the initial context - something like: Properties env = new Properties(); env.put(Context.PROVIDER_URL, "?"); env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");InitialContext jndi = new InitialContext(env); When I add this, which seems to be critical or I get(javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial) to the sample in the above link I get this error: Could not create JNDI API context: javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.ejs.ns.jndi.CNInitialContextFactory [Root exception is java.lang.ClassNotFoundException: com.ibm.ejs.ns.jndi.CNInitialContextFactory] So, what are the property values I need for IBM MQ - or what am I missing? Thanks a lot!!!

Hello Sheetal and Richard Exception clearly says "ClassNotFoundException". Please make sure ibmwebas.jar (Im not sure as I left 3.5 long back, but check it out. If my memory is correct, it is the one containing that ConectFactroyImpl class) is in your classpath where the client program is running. Srilatha your problem is , there is no properties specified by you for the InitialContext. Give PROVIDER_URL and INITIAL_CONTEXTFACTORY parameters in the property file or hashmap