2 Replies Latest reply on Dec 5, 2007 6:06 PM by Chris Paul

    AXIS Web Service Cannot Perform JNDI Lookup/Cast

    Chris Paul Newbie

      Hello,This is probably an AXIS-specific issue, in which case I apologize for wasting anyone's time here, but I hope that someone who's had experience with it might be able to help.I am attempting to performing a JNDI lookup of an EJB from within my AXIS web service class. This works successfully and returns me a $Proxy object! The jmx-console JNDIview shows me that I am performing this lookup with the correct path, and also shows me that the $Proxy class implements the correct interface. However when I attempt to cast the returned object to this interface, I am receiving a ClassCastException. I read the JBoss WIKI entry on this, and assumed the exception was caused by deploying two instances of my interface -- which is in fact the case -- even though a displayClassInfo() in the jmx-console reveals only one instance is getting created by the class loader: ### Instance0 found in UCL: org.jboss.mx.loading.UnifiedClassLoader3@3fa5ac{ url=null ,addedOrder=2}If I try remedy this by removing the duplicate .jar anyway, my AXIS web service class fails to compile.My deployment looks like this:mydeployment.earmydeployment.war (AXIS web app)WEB-INF/lib/myjar.jar (duplicate JAR to compile WebService.jws)WebService.jws (AXIS class that performs JNDI lookup of EJB)myjar.jar (EJB and interfaces here)As you can see, I have two copies of myjar.jar. If I remove the second from WEB-INF/lib, the WebService.jws fails to compile when invoked. If I leave it there, it compiles fine and is able to perform a JNDI lookup but is not able to cast it to the proper interface... sort of a "damned if you do, damned if you don't" situation.Does anyone know why WebService.jws can't pick up the classes in mydeployment.ear/myjar.jar from within mydeployment.ear/mydeployment.war if I remove the duplicate jar?Does anyone with experience in this area have suggestions as to how I could configure this deployment to work?Many thanks in advance --Chris

        • 1. Re: AXIS Web Service Cannot Perform JNDI Lookup/Cast
          jaikiran pai Master

          I would have expected this to work when you remove the myjar.jar file from the WEB-INF/lib folder. Which version of JBoss do you use? Do you have a application.xml file and/or jboss-app.xml file in the application? If yes, what are it's contents? And any jboss-web.xml file in the war?

          • 2. Re: AXIS Web Service Cannot Perform JNDI Lookup/Cast
            Chris Paul Newbie

            Hi Jaikiran, thanks for your response.

            I found a workaround to my issue:

            AXIS required myjar.jar to be in the WEB-INF/lib directory in order to compile the web service class, but once compiled, the presence of this jar was preventing me from being able to do a successful JNDI lookup inside that web service class (due to the class cast exception mentioned above).

            To get around this, I have been providing AXIS with a compiled version of that web service class (in the WEB-INF/jwsClasses directory). I just deploy the .class file with the rest of my webapp. AXIS sees this and doesn't attempt to compile the .jws file, and there are also no class loader conflicts with the presence of the additional myjar.jar.