5 Replies Latest reply: Apr 13, 2012 12:59 PM by Carlos Celis Osorio RSS

Caused by javax.naming.NameNotFoundException with message: "<ProjectName> not bound"

Gerhard Kaulsdorf Newbie

Dear seam-Experts,


I am a beginner to JBoss administration and JBoss Seam. It seems, that I have a JNDI-naming service problem here.


Stack Trace :


Caused by org.jboss.seam.InstantiationException with message: "Could not instantiate Seam component: userhandler"

org.jboss.seam.Component.newInstance(Component.java:2170)
org.jboss.seam.Component.getInstance(Component.java:2024)
org.jboss.seam.Component.getInstance(Component.java:1986)
org.jboss.seam.Component.getInstance(Component.java:1980)
org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:387)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
java.lang.Thread.run(Thread.java:662)



Caused by javax.naming.NameNotFoundException with message: "Hotel not bound"

org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
org.jnp.server.NamingServer.getObject(NamingServer.java:543)
org.jnp.server.NamingServer.lookup(NamingServer.java:267)
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
javax.naming.InitialContext.lookup(InitialContext.java:392)
org.jboss.seam.Component.instantiateSessionBean(Component.java:1403)
org.jboss.seam.Component.instantiate(Component.java:1367)
org.jboss.seam.Component.newInstance(Component.java:2148)
org.jboss.seam.Component.getInstance(Component.java:2024)
org.jboss.seam.Component.getInstance(Component.java:1986)
org.jboss.seam.Component.getInstance(Component.java:1980)
org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
org.jboss.el.parser.AstValue.getTarget(AstValue.java:34)
org.jboss.el.parser.AstValue.invoke(AstValue.java:95)
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:387)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
java.lang.Thread.run(Thread.java:662)



In my build.xml there is the entry :


"<property name="ejbJndiPattern" value="${project.name}/#{ejbName}/local"/>"



It seams, that the project is not bound ?  What could be the cause ? Every hint is appreciated, because there isn't any help in the documentation for that issue.








Thanks in advance


Gerhard

  • 1. Re: Caused by javax.naming.NameNotFoundException with message: "<ProjectName> not bound"
    Gerhard Kaulsdorf Newbie

    The userhandler has the following code :


    
    import javax.ejb.Local;
    
    @Local
    public interface UserHandler {
    
         /**
          * Method to persist UserData.
          * */
          public void persistUserData();
    
         /**
          * Method needed for Contexthandling.
          * */
          public void destroy();
         
    }
    



    Implementation :


    ...
    
    Name("userhandler")
    @Stateful
    @Scope(ScopeType.SESSION)
    public class UserHandlerImp implements UserHandler {
    
    
         @In (create=true, required=true)
         private User user;
    
         @PersistenceContext (type = PersistenceContextType.EXTENDED, unitName="Hotel")
         private EntityManager em;
    
         @In
         @Out
         private FacesMessages facesMessages;
         
         @Override
          public void persistUserData() {
          //check if a user with given username already exist
          List userExist = em.createQuery(("select u from User u where username like '")
          + this.user.getUsername()+"'").getResultList();
          if(userExist.size() == 0){
          //username doesn’t exist
          em.persist(this.user);
          facesMessages.add("user successfully created");
          } else{
          //username already exist
          facesMessages.add("user name already in use");}
          }
          
          @Override
          @Remove
          public void destroy() {
               
          }
         
    }
    


  • 2. Re: Caused by javax.naming.NameNotFoundException with message: "<ProjectName> not bound"
    Leo van den berg Master

    Hi,


    There are differnt causes for this error, but chack first if the component can be found. If you start the server you go to the root and you will see different admin-tools. Take for instance the JMX one and you will need to open the j2ee components and see if your component is registered an under which name. Depending on your build system some version numers are added to the final EAR which mustbe included in the pattern declaration.


    Leo

  • 3. Re: Caused by javax.naming.NameNotFoundException with message: "<ProjectName> not bound"
    Gerhard Kaulsdorf Newbie

    Hey,


    thanks for the reply. I scaffolded the project with seam-gen and did not change much on neither the seam nor the JBoss 4.2 configuration (in fact nothing). Moreover I was using .war. Is there a page in the documentary with hints, how to deploy when using wars with JBoss ?


    I finally switched to .ear and JBoss 6.0 and it works more or less. But JBoss in general seems to be unstable on my system when using hot-deployment. For example I just changed one view and reexploded and the app crashed with a lot of exceptions. You can say, that this kind of complications are to be expected with a free AS without experience. Sometimes it works, when just rebooting the JBoss, that is weird.


    Greetings,


    Gerhard

  • 4. Re: Caused by javax.naming.NameNotFoundException with message: "<ProjectName> not bound"
    Leo van den berg Master

    Hi,


    check your seetings for the ejbJndiPattern. For a WAR that should be


    #{ejbName}/local





    There is a chapter about Seam configuration and packaging. Be aware that for simple WAR applications you could use POJO instead of EJB. Much easier and basically the same.


    Leo

  • 5. Re: Caused by javax.naming.NameNotFoundException with message: "<ProjectName> not bound"
    Carlos Celis Osorio Newbie

    If your component "userhandler" is part of Global JNDI and you are deploying your project as a EAR project, you must add the "@JndiName" annotation in your class "UserHandlerImp" as your "jndiPattern" defined in components.properties file.

     

    For example, in your case:

     

    @Stateful

    @Scope(ScopeType.SESSION)

    @Name("userhandler")

    @JndiName("YOUR_EAR_FILE_NAME_WITHOUT_EAR_EXTENSION/UserHandlerImp/local")

     

    public class UserHandlerImp implements UserHandler {

         ... code is here

    }

     

    Your interface must be as follow:

     

    @Local

    public interface UserHandler extends Serializable {

         ... code is here

    }