2 Replies Latest reply on Apr 6, 2011 11:45 AM by Matteo Pardi

    HAJNDI javax.naming.NameNotFoundException

    Matteo Pardi Newbie

      Hi,

      I have a jboss cluster (4.2.3-GA)  with two nodes, and I have annotated an ejb class as

       

      @Stateless(name="SearchServiceBean")
      @Local(value=SearchServiceLocalInterface.class)
      @LocalBinding(jndiBinding="SearchServiceBean/local")
      @Remote(value=SearchServiceRemoteInterface.class)
      @RemoteBinding(jndiBinding="SearchServiceBean/remote")
      @PoolClass(value=org.jboss.ejb3.StrictMaxPool.class,maxSize=50)
      @Clustered
      @Depends("jboss.ha:service=HASingletonDeployer,type=Barrier")
      public class SearchServiceBean implements SearchServiceRemoteInterface {
       ...
      }
      

       

       

      On the client side, I instance a InititalCotext with the following codes

      Properties p = new Properties();  
      p.put(Context.INITIAL_CONTEXT_FACTORY,         "org.jnp.interfaces.NamingContextFactory");  
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");  
      p.put(Context.PROVIDER_URL, "nvm1:1100,nvm2:1100"); // HA-JNDI port.  
      return new InitialContext(p); 
      

       

       

      When both of nodes are running, I can lookup my ejb w/o any problems, but when a node fails sometime I get this exeception

       

      Caused by: javax.naming.NameNotFoundException: SearchServiceBean/remote
       at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:242)
       at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:155)
       at sun.reflect.GeneratedMethodAccessor1889.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.ha.framework.server.HARMIServerImpl.invoke(HARMIServerImpl.java:209)
      
      

       

      Anyone can help me ?

      Thanks

      Matteo

        • 1. HAJNDI javax.naming.NameNotFoundException
          Wolf-Dieter Fink Master

          I'm not sure how it is deployed if you set @...Binding.

          But you should see in the jmx-console JNDI-View how the bean is bind to the global context and adjust it

          • 2. Re: HAJNDI javax.naming.NameNotFoundException
            Matteo Pardi Newbie

            Hi Fink,

            thank you for your answer.

             

            I know what is the bind name of my ejb

             

            +- SearchServiceBean (class: org.jnp.interfaces.NamingContext)
              |   +- local (proxy: $Proxy374 implements interface com.neptuny.cpit.dh.core.SearchServiceLocalInterface,interface org.jboss.ejb3.JBossProxy)
              |   +- remote (proxy: $Proxy373 implements interface com.neptuny.cpit.dh.core.SearchServiceRemoteInterface,interface org.jboss.ejb3.JBossProxy)
            
            

             

            The problem seems to be in the HAJNDI.

             

            In fact let's suppose that the node nvm1 is down and nvm2 is up and run:

            • If I lookup the object with PROVIDER_URL = jnp://nvm1:1299 , I get the same exception above
            • If I lookup the object with PROVIDER_URL = jnp://nvm2:1299, everything works fine.

             

            Thanks