This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am having reall issues with unit tests that call my EJB's from outside of websphere. I have used the 'universal test page' in wasad to check the jndi set up is ok and it all seems fine. I then run my app and I get this exception:
javax.naming.NamingException: The JNDI operation "lookup"on the context "localhost/nodes/localhost/servers/server1" with the name "ejb/AuthenticationManager" failed. Please get the root cause Throwable contained in this NamingException for more information. Root exception is java.lang.NoClassDefFoundError: com/ibm/ejs/jts/jts/CurrentFactory at com.ibm.ws.naming.jndicos.CNContextImpl.suspendTransaction(CNContextImpl.java:4064) at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3521) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1565) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1525) at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1225) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132) at javax.naming.InitialContext.lookup(InitialContext.java:360) at com.ibm.ivj.ejb.runtime.AbstractAccessBean.lookupAndCacheHome(AbstractAccessBean.java:203) at com.ibm.ivj.ejb.runtime.AbstractAccessBean.getGlobalHome(AbstractAccessBean.java:195) at com.ibm.ivj.ejb.runtime.AbstractAccessBean.getHome(AbstractAccessBean.java:229)
I have also tried using the eclipse plugin for jndi explorer and I get the same.
Ive looked around on line and can see nothing that I havent already tried.
When you set up your EJB Deployment Descriptor, did you add the bean and its EJB reference? That could cause JNDI issues. Also, make sure that you've got the ejb reference in your test application's deployment descriptor as well. When you look up the EJB to create the remote & home interfaces, you'll probably need to use "java:comp/env/ejb/YourEJBBean"
Hope that helps!
Joined: Mar 09, 2007
Yeah the deployment descriptor is fine. the app runs fine with clients that are within the container, so I dont see how its going to be a jndi issue, and as I said I have used the jndi explorer in the container test page and everything is there. Its only when trying to access the bean from outside of the container thats the problem.
It seems its connecting to the iiop port ok and then failing when its trying to get to the next step. But i dont think its got as far as the actual bean itself.
I am trying running a basic ejb application on RAD and am encountering the following similar error : The JNDI operation "lookup"on the context "wi1254SRJ91SNode01Cell/nodes/wi1254SRJ91SNode01/servers/server1" with the name "ejb/ejbs/AdviceHome" failed. Please get the root cause Throwable contained in this NamingException for more information. Root exception is java.lang.NoClassDefFoundError: com/ibm/ejs/jts/jts/CurrentFactory even adding of the naming.jar,namingclient.jar to the class path din't help...
Joined: Feb 28, 2007
Okay, so it seems strange to me that you'd have "jts" in the JNDI name twice... Is that a correct reference? If so, when you're creating the interfaces (home & remote component), make sure to use "java:comp/env/" prior to the name of your EJB reference (e.g. ejb/Advice) if you're writing your own code. If, on the other hand, you're using the ServiceLocatorManager that comes with WebSphere, you'll need code to locate the home interface using the service locator manager. For example: