Expand my Community achievements bar.

SOLVED

Jars in the class path of a custom component

Avatar

Level 6

I am using the dom4j-1.6.1.jar library in a custom component, but my JBoss server has dom4j.jar in jboss\server\all\lib.  My custom component is throwing the following error:

DefFoundError message:org/dom4j/xpath/DefaultXPath while invoking service XmlToCsvService and operation convert and no fault routes were found to be configured.

This makes me suspect that the version of Dom4J in the lib directory of the server is taking precedence over the one in my component.  Any suggestions for how to deal with this?  Thanks.

Jared Langdon

1 Accepted Solution

Avatar

Correct answer by
Level 8

Even Marcel's suggestion may not always work, but it certainly is worth a quick try.  I seem to remember trying that and finding that one of the LiveCycle EAR files has a version of dom4j buried inside it (I don't remember which version of LC it was).

Of course altering an Adobe supplied EAR is not recommended and may violate your support ageement. There is an alternative, however; if changing the JBoss lib folder doesn't work.  To avoid the conflict you can use JarJar to rename the packages within the DOM4J class and deploy the renamed jar with your component to avoid the conflict.

http://code.google.com/p/jarjar/

You would then use the renamed classes in your component:

import org.mypackage.dom4j.Document;

import org.mypackage.dom4j.DocumentException;

import org.mypackage.dom4j.DocumentHelper;

import org.mypackage.dom4j.Element;

import org.mypackage.dom4j.Node;

import org.mypackage.dom4j.io.DOMReader;

import org.mypackage.dom4j.io.DOMWriter;

View solution in original post

3 Replies

Avatar

Employee

Jared,

You can't have 2 versions of DOM4J versions.

The only way I know to make this work is to replace the dom4j.jar that is in the jboss/lib folder with the dom4j-full.jar you want to use.

Avatar

Correct answer by
Level 8

Even Marcel's suggestion may not always work, but it certainly is worth a quick try.  I seem to remember trying that and finding that one of the LiveCycle EAR files has a version of dom4j buried inside it (I don't remember which version of LC it was).

Of course altering an Adobe supplied EAR is not recommended and may violate your support ageement. There is an alternative, however; if changing the JBoss lib folder doesn't work.  To avoid the conflict you can use JarJar to rename the packages within the DOM4J class and deploy the renamed jar with your component to avoid the conflict.

http://code.google.com/p/jarjar/

You would then use the renamed classes in your component:

import org.mypackage.dom4j.Document;

import org.mypackage.dom4j.DocumentException;

import org.mypackage.dom4j.DocumentHelper;

import org.mypackage.dom4j.Element;

import org.mypackage.dom4j.Node;

import org.mypackage.dom4j.io.DOMReader;

import org.mypackage.dom4j.io.DOMWriter;

Avatar

Level 6

Many thanks to both of you for your quick replies.