2 Replies Latest reply on Mar 27, 2006 5:07 PM by matthew hawthorne

    JNDI bindings under java:comp not available when UseJBossWeb

    matthew hawthorne Newbie

      I've just spent way longer than I'd like to admit dealing with a JNDI problem, and I'd like to share what I found and ask a few questions.

      I'm using JBoss 4.0.3SP1 on Debian.

      Upon deploying my ear, I couldn't find anything in JNDI under java:comp/env. I didn't even have a java:comp.

      I wrote some code to debug JNDI, printing what was there and what wasn't, along with using the JNDI viewer MBean in the jmx-console. This confirmed my suspicions that I had nothing mapped under java:comp.

      Some vicious googling pointed me in the direction of the class org.jboss.web.AbstractWebDeployer. I then set the log4j level to trace for org.jboss.web.tomcat.tc5.TomcatDeployer, and saw that it was logging some classloader information prior to linking the environment, resources, ejbs, and security info into java:comp/env, and this gave me the idea that the problem may be classloader related.

      In jbossweb-tomcat55.sar/META-INF/jboss-service.xml, I changed UseJBossWebLoader to true (it defaults to false) and bingo -- problem solved. I now had the proper setup under java:comp/env (such as java:comp/env/security/securityMgr)

      Now to some perhaps obvious questions:

      1) Has anyone else experienced this problem?

      2) Is this a known problem to the JBoss developers? I can't see how it isn't, since the default JBoss/Tomcat config (with UseJBossWebLoader=false) doesn't seem to comply with the standard java:comp/env philosophy.

      3) Is there a workaround to keep UseJBossWebLoader=false, but still have a functional java:comp/env?

      Thanks in advance for any info!

        • 1. Re: JNDI bindings under java:comp not available when UseJBos
          Ernest Levesque Newbie

          Was there any resolution to this problem. I'm seeing the same thing in my JBoss server!!

          • 2. Re: JNDI bindings under java:comp not available when UseJBos
            matthew hawthorne Newbie

             

            "lev0207" wrote:
            Was there any resolution to this problem. I'm seeing the same thing in my JBoss server!!


            Resolution? No. But I will share some more info about my experience, and maybe it can help.

            Things were going fine and dandy with UseJBossWebLoader=true, until I attempted to deploy Jetspeed2 alongside my app, and everything went bonkers. ClassNotFoundExceptions, IncompatibleClassChangeErrors, etc. I experimented with different combinations of UseJBossWebLoader, Java2ClassLoadingCompliance, and also using custom loader-repositories in jboss-app.xml and jboss-web.xml for my ears/wars, respectively.

            I was never able to get Jetspeed2 working, but my app now works, and I actually have UseJBossWebLoader set to *false*. This somehow happened without me really noticing the significance. Now, the configuration seems to be the same as the original state, but now my app (and java:comp/env in JNDI) works, when before it didn't.

            The only difference that I notice is the value for FilteredPackages (in deploy/jbossweb/META-INF/jboss-service.xml). I believe that originally it was "javax.servlet,org.apache.commons.logging", but I have only "javax" instead of "javax.servlet". I did this while experimenting, and maybe it did the trick -- give it a try.