9 Replies Latest reply on Dec 9, 2005 2:32 AM by asrichas2can

    How can I use xpath with dom4j under JBoss?

    lovejesus


      the problem is--
      i want to use xpath api of dom4j,but the dom4j.jar under jboss4.0.3sp1 doesn't contain the xpath interface! i 'v been struggling for hours before i realize this,so i replaced dom4j.jar with the newest dom4j.jar in two places separately.

      But -- still it doesn't help ,because i have no means to let know jboss know where to locate the jaxen.jar which is needed when calling xpath api.
      the error stack is :

      java.lang.NoClassDefFoundError: org/jaxen/JaxenException
      at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)
      at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207)
      at org.dom4j.tree.AbstractNode.valueOf(AbstractNode.java:189)
      at cn.ios.issa.web.struts.action.NewslistAction.readPreference(NewslistAction.java:168)
      at cn.ios.issa.web.struts.action.NewslistAction.getMyNews(NewslistAction.java:155)
      at cn.ios.issa.web.struts.action.NewslistAction.execute(NewslistAction.java:127)
      ......






      so my question is , how can i let the jaxen.jar in jboss get to work,it is under the directory : %JBOSS_HOME%\server\all\deploy\ejb3.deployer

      i 'v tried to put the jaxen.jar under %JBOSS_HOME%\server\all\lib and %JBOSS_HOME%\lib and my own ear ,sadly ,that still doesn't change anything.

      responing would be much appreciated.thanks

        • 1. Re: How can I use xpath with dom4j under JBoss?
          redijedi

          Some will say that you only need to put saxpath.jar on your path. I tried this and it did not work. I believe it's a bug in 4.03SP1 because 4.02 does not behave like this. Let me know if you find an answer on this.

          • 2. Re: How can I use xpath with dom4j under JBoss?
            lovejesus

            no solution until now.
            how do you succeed in 4.0.2?the dom4j.jar in 4.0.2 doesn't have xpath package eighter,do you replace it with your own?and it works well?
            i don't konw why there are two dom4j.jar s in jboss.i hope the the AS would be more robust for our end users.

            • 3. Re: How can I use xpath with dom4j under JBoss?
              starksm64
              • 4. Re: How can I use xpath with dom4j under JBoss?
                lovejesus

                Thanks a lot

                • 5. Re: How can I use xpath with dom4j under JBoss?
                  asrichas2can

                  Can you describe what jars in which directories must be replaced?

                  If I replace all libs in /lib/endorsed, I get the following error:

                  2005-12-05 10:36:23,015 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.ReportElementEjb] Initializing CMP plugin for ReportElementEjb
                  2005-12-05 10:36:23,195 WARN [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/ReportElementEjb,service=EJB
                  java.lang.NoSuchMethodError: org.apache.bcel.generic.InstructionFactory.createNewArray(Lorg/apache/bcel/generic/Type;S)Lorg/apache/bcel/generic/Instruction;
                   at org.jboss.proxy.compiler.ProxyImplementationFactory.createProxyMethod(ProxyImplementationFactory.java:319)
                   at org.jboss.proxy.compiler.ProxyCompiler.getCode(ProxyCompiler.java:167)
                   at org.jboss.proxy.compiler.Runtime.makeProxyType(Runtime.java:69)
                   at org.jboss.proxy.compiler.ProxyCompiler.<init>(ProxyCompiler.java:76)
                   at org.jboss.proxy.compiler.Proxies$Impl.newTarget(Proxies.java:604)
                   at org.jboss.proxy.compiler.Proxies.newTarget(Proxies.java:78)


                  • 6. Re: How can I use xpath with dom4j under JBoss?
                    starksm64

                    The xalan.jar in lib/endoresed is all that should be replaced.

                    • 7. Re: How can I use xpath with dom4j under JBoss?
                      asrichas2can

                      Thanks.
                      But then I get other errors:

                      2005-12-08 08:41:50,068 ERROR [org.jboss.deployment.MainDeployer] Could not initialise deployment: file:/D:/jboss-4.0.3SP1/server/default/deploy/hsqldb-ds.xml
                      java.lang.IllegalAccessError: tried to access class org.apache.xml.serializer.ExtendedContentHandler from class org.apache.xalan.transformer.TransformerImpl
                       at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1152)
                       at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:981)
                       at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1187)
                       at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1170)


                      The only way I found to fix it was to copy saxpath.jar, jaxen-full.jar und dom4j.jar and all new xalan libs to this directory. These libraries should have been attached to only one EAR, not to the complete server.

                      I hope the next SP is fully compatible with Java 5 without user patches.

                      Thanks for your help!

                      • 8. Re: How can I use xpath with dom4j under JBoss?
                        ereztison

                        BTW: I managed to overcome the original problem described in this thread by:
                        1. replacing the jboss/lib/dom4j.jar file with the latest jar from dom4j site (dom4j-1.6.1.jar at the time of writing, rename to dom4j.jar)
                        2. placing jaxen.jar in jboss/lib/

                        perhaps this is a bit brutal, but it works for me (so far..)

                        • 9. Re: How can I use xpath with dom4j under JBoss?
                          asrichas2can

                          Thanks to ereztison.
                          That's it!