2 Replies Latest reply on Feb 29, 2004 9:24 PM by ericjee

    NoInitialContextException

    ericjee

      Hello,
      I have a most odd scenario trying to use Jboss, and was wondering if you had any insight.

      I have a Swing App connecting to Jboss using :
      Context c = new InitialContext( jndiProperties );

      This occurs to get some initial info from the server to my swing app. Later on, in a seperate thread, I also call the exact same block of code with the same arguements, and end up with a :

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory]
      at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
      at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)

      I do not understand how I was able to instantiate it before, and successfully get data from the server, and now cannot.

      I am getting the required classes from Jboss3.2.3's jbossall-client.jar (with the org.jnp stuff in it).

      It is specified in a Manifest file in the jar for my swing app. I tried it outside the manifest file with -cp arguements but that didn't help either.

      A more interesting thing is if I do NOT try to instantiate the initial context object, and instead use a statically initialized

      version from the very beggiing when it worked right, it connects to the server ok.

      Please help, I am hoping this is some kinda classpath conflict of some sort. I read JBoss has some odd thing about jdk 1.4

      interface caching being a problem causing classloading issues, and am curious if that applies here as well.

      Thanks,
      Eric

        • 1. Re: NoInitialContextException

          Sounds like you are doing something bizarre with your classloaders.

          Regards,
          Adrian

          • 2. Re: NoInitialContextException
            ericjee

            Yeah, the problem starts when a third party api recieves an event from the hardware. Then after that, I get the classnotfoundexception. Do you have any suggestion on how/what they could be doing bizarre with the classloaders so I could look out for it, and come up with a fix/workaround?

            I myself am not doing any custom classloaders, I am using the bootstrap in both situations, the working situation and the one which throughs the exception.

            I do know the third party API uses reflection to load classes dynamically, but browsing through their stuff didn't seem to suggest they were the problem.

            Let me know if you have any further pointers, it is much appreciated.

            -Eric