This discussion is archived
4 Replies Latest reply: Jun 7, 2013 4:00 AM by gimbal2 RSS

NameNotFoundException

User_Sep Newbie
Currently Being Moderated
Hi,
I tried to develop a sample project with reference to:

http://theopentutorials.com/examples/java-ee/ejb3/how-to-create-a-simple-ejb3-project-in-eclipse-jboss-7-1/

When I try to run the client, I get the following error
javax.naming.NameNotFoundException: ejb: not bound 
   at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) 
   at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) 
   at org.jnp.server.NamingServer.getObject(NamingServer.java:785) 
   at org.jnp.server.NamingServer.lookup(NamingServer.java:396) 
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
   at java.lang.reflect.Method.invoke(Unknown Source) 
   at org.jboss.naming.NamingService.invoke(NamingService.java:417) 
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
   at java.lang.reflect.Method.invoke(Unknown Source) 
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) 
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) 
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) 
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) 
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) 
   at org.jboss.invocation.http.servlet.InvokerServlet.processRequest(InvokerServlet.java:162) 
   at org.jboss.invocation.http.servlet.InvokerServlet.doPost(InvokerServlet.java:232) 
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) 
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) 
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) 
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) 
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) 
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) 
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) 
   at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) 
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
   at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) 
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) 
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) 
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) 
   at java.lang.Thread.run(Unknown Source) 
Exception in thread "main" java.lang.NullPointerException 
   at com.ibytecode.client.EJBApplicationClient.main(EJBApplicationClient.java:13)
-Arun
  • 1. Re: NameNotFoundException
    Kayaman Guru
    Currently Being Moderated
    user_sep wrote:
    When I try to run the client, I get the following error
    How are you running the client?

    Are you following the tutorial exactly?

    The exception is just telling you that there's nothing by that name in the registry. So either it's not bound correctly, or you're using the wrong name.
  • 2. Re: NameNotFoundException
    User_Sep Newbie
    Currently Being Moderated
    Thanks Kayaman for your reply,


    "The exception is just telling you that there's nothing by that name in the registry. So either it's not bound correctly, or you're using the wrong name."

    Am sorry, Can you please guide me. I don't understand
  • 3. Re: NameNotFoundException
    Kayaman Guru
    Currently Being Moderated
    user_sep wrote:
    "The exception is just telling you that there's nothing by that name in the registry. So either it's not bound correctly, or you're using the wrong name."

    Am sorry, Can you please guide me. I don't understand
    There's not much I can help you with. Either it's not bound at all, or you're using the wrong name (or you're connected to the wrong JNDI). In any case the result is the same, the EJB isn't found.
  • 4. Re: NameNotFoundException
    gimbal2 Guru
    Currently Being Moderated
    Name not found has five easily identifiable sources of misery:

    1. the EJB is in fact not deployed in the container. The container should have a management interface which can tell you what is deployed
    2. the EJB is deployed, but does not have a remote interface. A remote interface is required to be able to invoke it from a client application
    3. the EJB is deployed and has a remote interface, but it has a different name than you think. Again: the container's management interface should be able to tell you that
    4. The EJB is deployed perfectly, but the client is looking at the wrong server (jndi properties are wrong)
    5. The EJB is deployed perfectly, the client is talking to the right container, but the name in your client class code contains a typo.

    In any case: do you really need to make the client class work? Its not very common to want to invoke EJBs from a client application, generally you'd use them in server-deployed enterprise applications.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points