Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassNotFoundException: org.jaxen.JaxenException in ear file

I'm baffled by what is going on here. I keep getting the following exception:

Caused by: java.lang.ClassNotFoundException: org.jaxen.JaxenException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        ... 51 more

Yet, this class file IS in my ear and also on the 'Class-Path' attribute of both my ejb's manifest and my ear's manifest file. Is there somewhere else I need to add the jaxen jar to have it be seen by other jar's in the ear? Do all jar's in a ear share the same classpath?

EDIT #1

There is this too:

Caused by: 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.selectNodes(AbstractNode.java:164)

EDIT #2

I am deploying to glassfish v3.1 and the lib jars are at the root of the ear file, like so:

-foo.ear
--\META-INF
--lib1.jar
--lib2.jar
--jaxen-1.1.1.jar

EDIT #3

I have tried deploying to another version of GF and it appears to work, I think it might be a bug in the version I'm using. I've opened a forum thread here.

EDIT #4

I had dom4j in the app server lib directory but not jaxen on the server. Adding the jaxen lib fixed this.

like image 374
javamonkey79 Avatar asked Aug 16 '11 00:08

javamonkey79


2 Answers

you need the jaxen jar in your servers lib folder

http://jaxen.codehaus.org/releases.html

like image 64
Shawn Avatar answered Nov 10 '22 01:11

Shawn


Any jars that are in the lib/ directory of your EAR will automatically be loaded.

Another example is the common task of bundling a number of library JAR files with an application. By default, the lib directory under the application root is reserved for library files. Previously, you had to add a manifest entry to the application module, which could be a tedious task.

Source

like image 36
Jeremy Avatar answered Nov 10 '22 01:11

Jeremy