6 Replies Latest reply on Feb 7, 2003 8:53 AM by christophe

    How to plug JNDI SPI into JB3.0

    christophe Newbie

      Hi,

      I currently experiment an issue when pluging my JNDI SPI implementation into JBoss3.0.4. My SPI is a simple jar with a jndi.properties that defines an additional java.naming.factory.url.pkgs, as described in the JNDI specifications.

      My SPI was correctly plugged(& tested) into JBOSS2.4.7 by simply adding my jar in $JBOSS_HOME/lib/ext directory.

      Printing the InitialContext().getEnvironment() will output both the JbossNS properties (i.e JNP properties) and my SPI properties.

      BUT NOW the same test under JB3.0 (i.e by packaging a describing a deploy/xx-service.xml) print only JBOSSNS properties !

      I suppose this is a consequence to the new JB3.0 's classloader architecture. But i don't know where to add my SPI ? I tried /deploy/lib, /lib but without success. I even tried JBOSS_CLASSPATH !!, but this time, the consequence is that the JBossNS is no more read correctly ...

      Any helps are welcome !

      Chris.

        • 1. Re: How to plug JNDI SPI into JB3.0
          David Jencks Master

          if you are using the default configuration, either ..../default/lib or .../default/deploy should work. If they don't, study the ..../default/log/server.log carefully to see exactly what is happening when the .jar is being deployed.

          • 2. Re: How to plug JNDI SPI into JB3.0
            christophe Newbie

            My JNDI SPI' JB3 configuration that doesn't work is the following :

            /default/deploy
            ---- spi-service.xml

            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE server>

            <!-- Specify required library jars as needed.-->




            ---- spi.jar
            jndi.properties at the root's jar
            java.naming.factory.url.pkgs=com.domain

            Until now, my JB2.4.7 configuration that has perfectly worked was the following :
            --- /lib/ext/spi.jar
            jndi.properties
            --- /conf/catalina/jboss.cml



            The log server error simply displays the error stack on very first lookup from the MBean
            javax.naming.at NameNotFoundException: spi:SpiRoot not bound
            org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
            org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
            org.jnp.server.NamingServer.getObject(NamingServer.java:509)
            org.jnp.server.NamingServer.lookup(NamingServer.java:282)
            org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464)
            org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443)
            javax.naming.InitialContext.lookup(InitialContext.java:347)


            The most surprising thing is that the context is correctly initialized when the lookup is done from an web application. That's why i thought about a classloader side effects.

            What's wrong ? Any idea welcome...

            PS : i didn't configure ExternalContextMBean because my current packaging also works "like this" under other J2eeContainer ...

            Chris

            • 3. Re: How to plug JNDI SPI into JB3.0
              christophe Newbie

              My JNDI SPI' JB3 configuration that doesn't work is the following :

              /default/deploy
              ---- spi-service.xml

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE server>

              <!-- Specify required library jars as needed.-->




              ---- spi.jar
              jndi.properties at the root's jar
              java.naming.factory.url.pkgs=com.domain

              Until now, my JB2.4.7 configuration that has perfectly worked was the following :
              --- /lib/ext/spi.jar
              jndi.properties
              --- /conf/catalina/jboss.cml



              The log server error simply displays the error stack on very first lookup from the MBean
              javax.naming.at NameNotFoundException: spi:SpiRoot not bound
              org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
              org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
              org.jnp.server.NamingServer.getObject(NamingServer.java:509)
              org.jnp.server.NamingServer.lookup(NamingServer.java:282)
              org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464)
              org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443)
              javax.naming.InitialContext.lookup(InitialContext.java:347)


              The most surprising thing is that the context is correctly initialized when the lookup is done from an web application. That's why i thought about a classloader side effects.

              What's wrong ? Any idea welcome...

              PS : i didn't configure ExternalContextMBean because my current packaging also works "like this" under other J2eeContainer ...

              Chris

              • 4. Re: How to plug JNDI SPI into JB3.0
                christophe Newbie

                My JNDI SPI' JB3 configuration that doesn't work is the following :

                /default/deploy
                ---- spi-service.xml
                ---- spi.jar
                jndi.properties at the root's jar
                java.naming.factory.url.pkgs=com.domain

                Until now, my JB2.4.7 configuration that was ok was the following :
                --- /lib/ext/spi.jar
                jndi.properties
                --- /conf/catalina/jboss.cml with my MBean declaration


                The log server error simply displays the error stack on very first lookup from the MBean (the spi.jar is correctly loaded)
                javax.naming.at NameNotFoundException: spi:SpiRoot not bound
                org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                org.jnp.server.NamingServer.lookup(NamingServer.java:282)
                org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464)
                org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443)
                javax.naming.InitialContext.lookup(InitialContext.java:347)

                The most surprising thing is that the context is correctly initialized when the lookup is done from an web application. That's why i thought about a classloader side effects.

                What's wrong ? Any idea welcome...

                PS : i didn't configure ExternalContextMBean because my current packaging also works "like this" under other J2eeContainer ...

                Chris

                • 5. Re: How to plug JNDI SPI into JB3.0
                  christophe Newbie

                  The service is deployed under /default/deploy
                  Moreover, the MBean is correctly created, only the jndi lookup failed (NameNotFound when lookup("spi:Spi")
                  Doing the same lookup from a web application works.

                  Any idea welcome

                  • 6. Re: How to plug JNDI SPI into JB3.0
                    christophe Newbie

                    My JNDI SPI' JB3 configuration that doesn't work is the following :

                    /default/deploy
                    ---- spi-service.xml

                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE server>

                    <!-- Specify required library jars as needed.-->




                    ---- spi.jar
                    jndi.properties at the root's jar
                    java.naming.factory.url.pkgs=com.domain

                    Until now, my JB2.4.7 configuration that has perfectly worked was the following : --- /lib/ext/spi.jar
                    jndi.properties
                    --- /conf/catalina/jboss.cml
                    <mbean code="management.Spi"name="Plugin:spiservice=Spi"/>


                    The log server error simply displays the error stack on very first lookup from the MBean
                    javax.naming.at NameNotFoundException: spi:SpiRoot not bound
                    org.jnp.server.NamingServer.getBinding(NamingServer.java:495) org.jnp.server.NamingServer.getBinding(NamingServer.java:503) org.jnp.server.NamingServer.getObject(NamingServer.java:509) org.jnp.server.NamingServer.lookup(NamingServer.java:282) org.jnp.interfaces.NamingContext.lookup(NamingContext.java:464) org.jnp.interfaces.NamingContext.lookup(NamingContext.java:443) javax.naming.InitialContext.lookup(InitialContext.java:347)


                    The most surprising thing is that the context is correctly initialized when the lookup is done from an web application. That's why i thought about a classloader side effects.

                    What's wrong ? Any idea welcome...

                    PS : i didn't configure ExternalContextMBean because my current packaging also works "like this" under other J2eeContainer ...


                    Chris