开发者

JDOM + Jaxen + Websphere 7 = java.lang.NoClassDefFoundError: org.jaxen.BaseXPath

开发者 https://www.devze.com 2023-03-17 05:48 出处:网络
I would like to use JDOM in a Webapp project. This works just fine. But now I want to add some stuff using XPath, but if I try to work with an XPath, I just get an exception:

I would like to use JDOM in a Webapp project. This works just fine. But now I want to add some stuff using XPath, but if I try to work with an XPath, I just get an exception:

com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet MyServlet in application MyProjectEAR. Exception created : java.lang.NoClassDefFoundError: org.jaxen.BaseXPath
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
    at java.lang.Class.forNameImpl(Native Method)
    at java.lang.Class.forName(Class.java:136)
    at org.jdom.xpath.XPath.newInstance(XPath.java:126)
    at org.jdom.xpath.XPath.selectNodes(XPath.java:337)
    [..]

Caused by: java.lang.ClassNotFoundException: org.jaxen.BaseXPath
    at java.net.URLClassLoader.findClass(URLClassLoader.java:421)
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(E开发者_Python百科xtClassLoader.java:150)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:652)
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:90)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:540)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
    ... 35 more

The jaxen.jar is in my classpath, and the org.jaxen.BaseXPath class is there just fine. Why is Websphere not finding it? It works with all the other libraries I have there. When googling I found this, where someone says that he has a conflicting version somewhere and I should make sure that jars from my web app directory have precedence. In eclise' Built Path Configuration I set Web App Libraries above the WebSphere library (only the src dir is now above the web app libs), but that did not change anything. Unfortunatelly I did not really understand the part about the EAR which seems important...?

Update: In the meantime this gave me a new clue. I found on WebSphere's Administration Console the classpath and a list with all jars that are considered by the class loaders. These are quite a number and I searched them with a little grep and unzip -l magic and figured that the file /opt/ibm/WebSphere/PortalServer/wcm/prereq.wcm/wcm/shared/app/jdom.jar contains jdom (without the jaxen stuff). So maybe this jdom jar is loaded, but jaxen in an incompatible version is loaded from my lib directory?

Additionally I found in WebSphere's Administration Console the "parent first/last" setting for my application, but everything is grayed out! I can't switch to parent last :-(.

What can I do to find and fix the problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号