4 Replies Latest reply on Feb 22, 2012 8:13 AM by lordsephiroth

    7.1 JNDI erratic NameNotFoundException

    lordsephiroth

      Hi there,

      I'm facing some kind of "random" error during JBoss start. The word "random" is really the best for what I do see.

      First of all, here is the exact error message :

       

       

        Caused by : javax.naming.NameNotFoundException: prest_webgui_ear-1.0.0-SNAPSHOT/prest_ejb-1.0.0-SNAPSHOT/PoliceApplicationServiceBean -- service jboss.naming.context.java.global."prest_webgui_ear-1.0.0-SNAPSHOT"."prest_ejb-1.0.0-SNAPSHOT".PoliceApplicationServiceBean
      

       

      This message is generally perfectly clear and indicates a wrong JNDI name. But, a few lines of logs before, here is the deployment of my Stateless bean :

       

        11:05:07,680 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named PoliceApplicationServiceBean in deployment unit subdeployment "prest_ejb-1.0.0-SNAPSHOT.jar" of deployment "prest_webgui_ear-1.0.0-SNAPSHOT.ear" are as follows:
      
      java:global/prest_webgui_ear-1.0.0-SNAPSHOT/prest_ejb-1.0.0-SNAPSHOT/PoliceApplicationServiceBean!ch.mobi.prest.common.application.PoliceApplicationService
      java:app/prest_ejb-1.0.0-SNAPSHOT/PoliceApplicationServiceBean!ch.mobi.prest.common.application.PoliceApplicationService
      java:module/PoliceApplicationServiceBean!ch.mobi.prest.common.application.PoliceApplicationService
      java:global/prest_webgui_ear-1.0.0-SNAPSHOT/prest_ejb-1.0.0-SNAPSHOT/PoliceApplicationServiceBean
      java:app/prest_ejb-1.0.0-SNAPSHOT/PoliceApplicationServiceBean
      java:module/PoliceApplicationServiceBean
      
      

      The NameNotFoundException indicates the same name than the 4-th JNDI binding from the bean deployment.

       

      Maybe this is important, the code calling JNDI is placed in a Listener referenced in web.xml. This code is then executed during deployment :

      InitialContext context = new InitialContext();
      context.lookup("java:global/prest_webgui_ear-1.0.0-SNAPSHOT/prest_ejb-1.0.0-SNAPSHOT/PoliceApplicationServiceBean");
      

       

      Now, for the "random" part : I can start and stop my JBoss without touching anything. Just calling "restart server" and "restart in debug mode" from Eclipse. It works most of the time when starting the server in normal mode (but fails sometimes). It fails most of the time when starting the server in debug mode (but succeed sometimes). The behavior is just... unpredictable. And of course, it fails nearly all the time on servers similar to our productive environment (on Linux).

       

      This has never happened when I was working on JBoss 5.1.0. This happens rarely on 7.0.2. This happens very often on 7.1.0.

       

      Does anyone have any suggestion ? It looks like a dependency error, but I cannot figure out why the WAR would not have access to the EJB-JAR when deployed together in an EAR archive...

       

      Any help will be greatly appreciated.

      Best regards,

      Patrick