This kind of problem is often caused by bad classloader relationships. If jaxen is loaded in a parent classloader to your app and jdom is loaded in your app's classloader then jdom will be able to load jaxen classes but jaxen classes will not be able to load jdom classes: it looks like this scenario is consistent with what you've shown us.

If this is the problem you can fix it by adding the jaxen jar as an app dependency (if its missing) and including either

<inverse-classloading/>

or

<hidden-classes>
  <filter>org.jaxen.</filter>
<hidden-classes>

near the end of the environment element in your geronimo plan.

thanks
david jencks

On Mar 6, 2008, at 12:55 AM, Łukasz Budnik wrote:

Hi All!

I'm using G2.1 and I have a very weird class loader problem.

My application uses JDOM and Jaxen.
Jaxen is by default shipped with G2.1, I had only to add JDOM jar into
G2.1 repository.
I have added proper dependencies into my openejb-jar.xml.

The thing is that it looks like Geronimo loads only some (for sure not
all!) classes from JDOM jar.

For example looking at the following stacktrace (see below) I know
that following classes were

loaded:
org.jdom.xpath.XPath, org.jdom.xpath.JaxenXPath, org.jaxen.jdom.JDOMXPath, and

org.jdom.JDOMException.

But class loader did not load org/jdom/Parent class (it is listed in JDOM jar).

The stacktrace:

07:59:42,921 ERROR [JDOMXMLUtils] JDOMException exception was thrown!
org.jdom.JDOMException: java.lang.NoClassDefFoundError:
org/jdom/Parent: org/jdom/Parent
        at org.jdom.xpath.XPath.newInstance(XPath.java:139)

...

java.lang.NoClassDefFoundError: org/jdom/Parent
        at org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:91)
        at org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:281)
        at org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:99)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at

sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39)
        at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.jdom.xpath.XPath.newInstance(XPath.java:129)

I had no idea what is going on...

It looks like classes that are explicitly defined work, classes that
are used/created by factories

don't.

any tips?

best regards
Łukasz

Reply via email to