3 Replies Latest reply on Feb 9, 2006 6:14 PM by brianmb99

    JAXR ConnectionFactory problem in ActionHandler


      Hello, I hope someone can point me in the right direction with this because I've been working on it for while and am really stuck.

      I need to create a JAXR ConnectionFactory from within an ActionHandler implementation. I'm using the Sun JAXR implementation, so I'm setting my javax.xml.registry.ConnectionFactoryClass to com.sun.xml.registry.common.ConnectionFactoryImpl before calling ConnectionFactory.newInstance().

      This is the normal way I get a ConnectionFactory, and as I understand it it's the right way. It works just fine unless it's called from anywhere within an implementation of org.jbpm.graph.def.ActionHandler. I can call it before or during a jBPM transaction, but when it's called from within an ActionHandler I get:

      javax.xml.registry.JAXRException: Failed to create instance of:
       at javax.xml.registry.ConnectionFactory.newInstance(ConnectionFactory.java:60)
      Caused by: java.lang.ClassCastException: com.sun.xml.registry.common.ConnectionFactoryImpl
       at javax.xml.registry.ConnectionFactory.newInstance(ConnectionFactory.java:56)

      I'm sure that I have the jaxr_impl and other required libraries in the correct place for the jbpm classloader to see them, as when I remove them I get an appropriate exception (ClassNotFoundE).

      If anyone has _any_ ideas I'd appreciate them.



        • 1. Re: JAXR ConnectionFactory problem in ActionHandler

          No ideas? I think it might have something to do with the classloader settings (or lack thereof) for the jbpm service archive - if it was loading classes from a different class repository than the webapp that's signaling the process, and not loading first from the sar classpath I can theorize why that might cause this error. But I'm still trying to figure out what to do about it.



          • 2. Re: JAXR ConnectionFactory problem in ActionHandler


            You say the problem only appears when you get a JAXR connection factory from within an action handler. Handlers are loaded with the process class loader, whose parent is the loader for the jBPM library (i.e. the service archive loader). The context class loader is skipped (the classes and libraries in your webapp are not searched).

            In the end you don't specify where you actually place the libraries. That'd be useful. Right now I'd package them in the jBPM service archive (if you only use JAXR in jBPM processes) or put them in the lib/ subdirectory of the JBoss configuration you are using (if you use JAXR in other applications).

            • 3. Re: JAXR ConnectionFactory problem in ActionHandler

              Thanks a lot, Alejandro. That explains and helps a lot - particularly your explanation of why the context class loader isn't being used. I've been up and down all the documentation of JBoss classloading that I could find and hadn't figured that out - I'm relatively new to JBoss.

              I managed to get things working by putting my uddi and other ws calls in another service archive and calling them from jbpm through the exposed service interfaces.

              Thanks for your help!