I'm working on two modules that are both going into a large EAR.  One of
them uses CXF and JAXB, and the other just uses JAXB.  I had set up the
skeleton of the build for the non-CXF project a while ago, and the xjc
Ant task was working fine.  I then later set up the build for the CXF
project.  We've been asked to put all of our library jars into a common
location, so both projects are referencing the same jars at build time.
At deployment time, all the jars will be in the EAR's "lib" directory.

After I got my CXF project to a reasonable milestone, I then went back
to do some work on the non-CXF project.  When I run the xjc task, I see
the following error:

java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider
com.sun.tools.xjc.addon.apache_cxf.bug671.Bug671Plugin could not be
instantiated: java.lang.LinkageError: loader constraint violation: when
resolving method
"org.apache.cxf.xjc.bug671.Bug671Plugin.<init>(Lcom/sun/tools/xjc/Plugin
;)V" the class loader (instance of
com/sun/istack/tools/ParallelWorldClassLoader) of the current class,
com/sun/tools/xjc/addon/apache_cxf/bug671/Bug671Plugin, and the class
loader (instance of org/apache/tools/ant/AntClassLoader) for resolved
class, org/apache/cxf/xjc/bug671/Bug671Plugin, have different Class
objects for the type com/sun/tools/xjc/Plugin used in the signature

It's clear that the addition of the CXF "xjc" jar files has caused a
problem for the non-CXF project.  It's possible that I could move the
CXF "xjc" jars to the WEB-INF/lib of the CXF-using project, so the
non-CXF project doesn't have those jars in the build or deployment
classpath.  Is it likely that this will fix this problem?  Will it cause
other problems?

Reply via email to