I am new to EJB's and First time creating EJB's in Websphere Version: 5.1.2. I have created the bean project in the Websphere and written a method myMethod() in which I have written "Hello Bean".
This is running absolutely fine when I test the Bean with the websphere's own JNDI explorer and its giving me the message what I have written in myMethod().
The same thing when I tried to Run using 1. Servlet OR 2. JSP OR 3. Plain Java class with main() (I created the new dynamic web project)I am not getting the desired output and getting the error.
There are no compilation error in the code also the packaging and placing of Beans is not an issue because the websphere is itself creating everything.
***********Error in Running servlet is ************
[2/27/07 16:01:46:950 IST] 7b388473 WebGroup I SRVE0180I: [HelloWeb] [/HelloWeb] [Servlet.LOG]: Test: init [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: jndiname: First component in name jndiname not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0 [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:968) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:1399) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1067) [2/27/07 16:01:47:294 IST] 7b388473 SystemErr R at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
Let me know if you need any further help from my side I can provide the code of my Home/Remore/Implementation class But as I said everything is created by Websphere and there is no problem with the code as its running fine with its own JNDI explorer.
**************My EJB deployment descriptor is as below (This is created by Websphere)**********
Hi, Thanks for showing interest in my thread. I am using the below code in my servlet. I also tried the same code in JSP as well as plain java class. The same JNDI name is appearing in my EJB deployment descriptor.
Do check out the jndi name of the interface on weblogic server. Since, what its shown in the log trace is weblogic server is unable to locate any object attached the jndi name what you are referring(or calling) through your client code.
I hope once you gonna call it with exact jndi name what server has assigned to your ejb interface then your problem get resolved.
Cheers !!! Sumit Malik
If at first you don't succeed, don't try skydiving
java.lang.NoClassDefFoundError: com.HelloBeanHome at Test.doGet(Test.java:31)
Looks like a classpath issue. Have you included the com.HelloBeanHome and the other related classes in the classpath of the application? [ February 28, 2007: Message edited by: Jaikiran Pai ]
Joined: Nov 13, 2006
Thanks for all your help. I got the solution now. The web.xml of my web project and EJB deployment of my EJB project were not on sync with each other. I studied both the files and the related entries for <ejb-ref> in both the files was corrected by me to Run my First EJB application.