2 Replies Latest reply on Jan 21, 2015 5:49 PM by yfeng1998

    Unable to run XSLT in a clustered server

    yfeng1998

      Hi,

       

      I am using WildFly 8.2 to create some distributed load balancing tasks in the cluster. I followed following example Need some example. It worked until I added some XSLT transform.

       

      I added following lines to call() method in a DistributedCallable implementation:

       

          StreamResult result = new StreamResult(new StringWriter());

          TransformerFactory tFactory = TransformerFactory.newInstance();

          Transformer transformer = tFactory.newTransformer(new StreamSource("path to your XSL file"));

       

      When it executes, local server A runs fine but remote server B throw exception:

       

      09:09:43,318 ERROR [org.infinispan.remoting.InboundInvocationHandlerImpl] (remote-thread-0) ISPN000260: Exception executing command: javax.xml.transform.TransformerConfigurationException: Translet class loaded, but unable to create translet instance.

              at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.defineTransletClasses(TemplatesImpl.java:369) [rt.jar:1.8.0_25]

              at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.getTransletInstance(TemplatesImpl.java:383) [rt.jar:1.8.0_25]

              at com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl.newTransformer(TemplatesImpl.java:418) [rt.jar:1.8.0_25]

              at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:767) [rt.jar:1.8.0_25]

              at __redirected.__TransformerFactory.newTransformer(__TransformerFactory.java:132) [jboss-modules.jar:1.3.3.Final]

              [at the new StreamSource() line shown above]

       

      If server B runs first, then it runs fine but server A throws the same exception.

       

      I was given some advice that it might be WildFly class loader issue. Is it true? If so, is there any workaround?

       

      Thanks for advice!

        • 1. Re: Unable to run XSLT in a clustered server
          pferraro

          Have you bundled any xslt jars with your application?  You probably need to export the requisite WildFly modules to get this to work correctly.  I would also recommend injecting a WildFly managed cache, rather than using using an Infinispan cache loaded from an infinispan xml file.  The primary difference is that WIldFly configures Infinispan's marshaller to resolve classes using WildFly's modular class loader, whereas Infinispan's native configuration will rely on the TCCL.

          Honestly, I have not yet tested Infinispan's distributed execution framework on WildFly - so there may likely be other classloading issues related to callable serialization that might prevent this from working.  Let me know if you get stuck.

          • 2. Re: Unable to run XSLT in a clustered server
            yfeng1998

            Paul, thanks for advice! Yes, I have bundled xalan jar with the application. When there is one server only, it works fine; and works fine with initiating server in the cluster, only remote server has error. I am still trying.

             

            Sorry for one newbie question -- would WildFly managed cache provide load-balancing feature as Infinispan does? Do you have any link for me to start looking at? I thought WildFly always uses Infinispan under the hood.

             

            Thanks!