1 Reply Latest reply on Aug 25, 2011 11:07 AM by Prasad Deshpande

    JBoss AS 7.0.1 JNDI bug

    Markus Dahm Novice

      Hi,

       

      I wrote a little utility MBean in our application for debugging purposes that lists the JNDI-Tree. It's basically is a simple replacement

      for the old JNDI-View MBean of earlier JBosses.

       

      In a nutshell it does the following:

       

       

      Context context = new InitialContext();
      
      for (final NamingEnumeration<NameClassPair> enumeration = context.list(""); enumeration.hasMoreElements();) {
              final NameClassPair pair = enumeration.nextElement();
              result.add(pair);
      }
      
      ... some recursion and printlns...
      

       

      This worked just fine in JBoss 7.0.0. which would print something like:

       

      12:26:35,180 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context:  /
      -->app: javax.naming.Reference X (Failed to get context with name app)
      -->comp: javax.naming.Reference X (Failed to get context with name comp)
      -->module: javax.naming.Reference X (Failed to get context with name module)
      -->global: javax.naming.Reference /
          -->devA: javax.naming.Context /
              -->ProduktGruppeServiceBean!com.meyle.deva.artikel.ProduktGruppeService: org.jboss.as.naming.context.ModularReference X (devA/ProduktGruppeServiceBean!com.meyle.deva.artikel.ProduktGruppeService)
              -->ArtikelProzessDaoBean!com.meyle.deva.dao.ArtikelProzessDao: org.jboss.as.naming.context.ModularReference X (devA/ArtikelProzessDaoBean!com.meyle.deva.dao.ArtikelProzessDao)
              -->DevaTestEnvironmentSetupBean: org.jboss.as.naming.context.ModularReference X (devA/DevaTestEnvironmentSetupBean)
              -->ArtikelBeschreibungDaoBean!com.meyle.deva.dao.ArtikelBeschreibungDao: org.jboss.as.naming.context.ModularReference X (devA/ArtikelBeschreibungDaoBean!com.meyle.deva.dao.ArtikelBeschreibungDao)
              -->ArtikelDaoBean!com.meyle.deva.dao.ArtikelDao: org.jboss.as.naming.context.ModularReference X (devA/ArtikelDaoBean!com.meyle.deva.dao.ArtikelDao)
              -->KomponenteDaoBean!com.meyle.deva.dao.KomponenteDao: org.jboss.as.naming.context.ModularReference X (devA/KomponenteDaoBean!com.meyle.deva.dao.KomponenteDao)
              -->ZubehoerDaoBean!com.meyle.deva.dao.ZubehoerDao: org.jboss.as.naming.context.ModularReference X (devA/ZubehoerDaoBean!com.meyle.deva.dao.ZubehoerDao)
              -->ProduktGruppeDaoBean: org.jboss.as.naming.context.ModularReference X (devA/ProduktGruppeDaoBean)
              -->ZubehoerDaoBean: org.jboss.as.naming.context.ModularReference X (devA/ZubehoerDaoBean)
              -->FirmaServiceBean: org.jboss.as.naming.context.ModularReference X (devA/FirmaServiceBean)
              -->JndiView!com.meyle.deva.administration.JndiViewMBean: org.jboss.as.naming.context.ModularReference X (devA/JndiView!com.meyle.deva.administration.JndiViewMBean)
              -->FirmaDaoBean!com.meyle.deva.dao.FirmaDao: org.jboss.as.naming.context.ModularReference X (devA/FirmaDaoBean!com.meyle.deva.dao.FirmaDao)
              -->ArtikelBeschreibungDaoBean: org.jboss.as.naming.context.ModularReference X (devA/ArtikelBeschreibungDaoBean)
              -->ProduktGruppeDaoBean!com.meyle.deva.dao.ProduktGruppeDao: org.jboss.as.naming.context.ModularReference X (devA/ProduktGruppeDaoBean!com.meyle.deva.dao.ProduktGruppeDao)
              -->JndiView: org.jboss.as.naming.context.ModularReference X (devA/JndiView)
              -->ArtikelDaoBean: org.jboss.as.naming.context.ModularReference X (devA/ArtikelDaoBean)
              -->ArtikelProzessManagementServiceBean!com.meyle.deva.processmanagement.ArtikelProzessManagementService: org.jboss.as.naming.context.ModularReference X (devA/ArtikelProzessManagementServiceBean!com.meyle.deva.processmanagement.ArtikelProzessManagementService)
              -->ArtikelProzessDaoBean: org.jboss.as.naming.context.ModularReference X (devA/ArtikelProzessDaoBean)
              -->ArtikelServiceBean!com.meyle.deva.artikel.ArtikelService: org.jboss.as.naming.context.ModularReference X (devA/ArtikelServiceBean!com.meyle.deva.artikel.ArtikelService)
              -->DevaTestEnvironmentSetupBean!com.meyle.deva.bootstrap.DevaTestEnvironmentSetupBean: org.jboss.as.naming.context.ModularReference X (devA/DevaTestEnvironmentSetupBean!com.meyle.deva.bootstrap.DevaTestEnvironmentSetupBean)
              -->ArtikelServiceBean: org.jboss.as.naming.context.ModularReference X (devA/ArtikelServiceBean)
              -->FirmaServiceBean!com.meyle.deva.artikel.FirmaService: org.jboss.as.naming.context.ModularReference X (devA/FirmaServiceBean!com.meyle.deva.artikel.FirmaService)
              -->ArtikelProzessManagementServiceBean: org.jboss.as.naming.context.ModularReference X (devA/ArtikelProzessManagementServiceBean)
              -->KomponenteDaoBean: org.jboss.as.naming.context.ModularReference X (devA/KomponenteDaoBean)
              -->ProduktGruppeServiceBean: org.jboss.as.naming.context.ModularReference X (devA/ProduktGruppeServiceBean)
              -->FirmaDaoBean: org.jboss.as.naming.context.ModularReference X (devA/FirmaDaoBean)
      -->jboss: javax.naming.Reference /
          -->jaas: org.jboss.as.naming.context.ModularReference X (jaas)
          -->TransactionManager: org.jboss.as.naming.context.ModularReference X (TransactionManager)
          -->datasources: javax.naming.Context /
              -->Meyle-devA-DS: org.jboss.as.naming.context.ModularReference X (datasources/Meyle-devA-DS)
              -->ExampleDS: org.jboss.as.naming.context.ModularReference X (datasources/ExampleDS)
          -->infinispan: javax.naming.Context /
              -->hibernate: org.jboss.as.naming.context.ModularReference X (infinispan/hibernate)
          -->TransactionSynchronizationRegistry: org.jboss.as.naming.context.ModularReference X (TransactionSynchronizationRegistry)
      

       

      In JBoss 7.0.1 nothing is printed!

       

      12:28:35,499 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context: 
      12:28:35,503 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context:  /
      

       

      Even an explicit context such as "global:" results in an error:

       

      12:38:36,552 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context: global:
      12:38:36,552 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context:  X (Name 'global:' not found in context '')
      

       

      Explicit lookups in contexts I know of (since the application would not work otherwise...) seem to work:

       

      java:jboss/datasources
      
      12:44:16,395 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(4)-127.0.0.1) Context:  /
      -->Meyle-devA-DS: org.jboss.as.naming.context.ModularReference X (datasources/Meyle-devA-DS)
      -->ExampleDS: org.jboss.as.naming.context.ModularReference X (datasources/ExampleDS)
      

       

      What went wrong here?

       

      Cheers

         Markus

        • 1. Re: JBoss AS 7.0.1 JNDI bug
          Prasad Deshpande Expert

          From 7.0.1 onwards there are going to be only 5 namesspaces, "java:comp/", "java:global/", "java:app/", "java:module/" & "java:jboss/". Have a look at http://lists.jboss.org/pipermail/jboss-as7-dev/2011-July/002890.html.

           

           

          Markus Dahm wrote:

          Context context = new InitialContext();
           
          for (final NamingEnumeration<NameClassPair> enumeration = context.list(""); enumeration.hasMoreElements();) {
                  final NameClassPair pair = enumeration.nextElement();
                  result.add(pair);
          }
           
          ... some recursion and printlns...
          

          To get listing, you'll need to provide initial namespace like "java:global/" etc.. for either/all 5.

           

           

          Even an explicit context such as "global:" results in an error:

           

          12:38:36,552 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context: global:
          12:38:36,552 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(3)-127.0.0.1) Context:  X (Name 'global:' not found in context '')
          

          this is because there is nothing suhc as "global:", if you need global namespace use "java:global/".

           

           

          Explicit lookups in contexts I know of (since the application would not work otherwise...) seem to work:

           

          java:jboss/datasources
          
          12:44:16,395 INFO  [com.meyle.deva.administration.JNDITree] (RMI TCP Connection(4)-127.0.0.1) Context:  /
          -->Meyle-devA-DS: org.jboss.as.naming.context.ModularReference X (datasources/Meyle-devA-DS)
          -->ExampleDS: org.jboss.as.naming.context.ModularReference X (datasources/ExampleDS)
          

           

           

          Again, have alook at http://lists.jboss.org/pipermail/jboss-as7-dev/2011-July/002890.html. Rules clearly answers reason behind "java:jboss/" working.