It SOUNDS like you might be picking up a couple versions of jaxb-xjc, but I'm 
not really sure.   I'm not really familliar with the ant classloaders so I'm 
not sure what to suggest.

You don't need any of the xjc jars at runtime, just build time.   Thus, I 
wouldn't put them in webinf/lib or anything like that.   I would keep them 
separate and just add the required xjc plugin jars as needed to the classpath 
of whatever you are using to call xjc.

Dan



On Friday 25 February 2011 12:57:12 PM KARR, DAVID (ATTSI) wrote:
> 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?

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to