You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by wazup80 <wa...@gmail.com> on 2009/11/24 02:34:29 UTC

JAXB integrating with AXIS2 - oader constraints violated when linking javax/xml/namespace/QName class

Hi,

I'm new to webservices, and axis2 and I've been stuck on this for a while
and can't seem to fix this issue.  There are alot on the net on this topic,
but I have looked at everything and seem to have no luck.  I'm hoping
someone can help me on this.  

I'm running jboss5.0.0 with Axis2.1.4 and using JAXB and jdk1.5.21.  I have
a webservice that will gather info, and then call another webservice.  I'm
able to call the other webservice and get the data, but now i'm trying to
parse the data.  This is where it fails and where i'm using JAXB.  

I have everything compiled and in the jar file (xxx.aar file).  That
includes the services.xml file and the jaxb generated classes.

Here is where it's failing at:

JAXBContext jc = JAXBContext.newInstance("my.package.name");

my.package.name is the package that contains the JAXB classes generated from
the schema.  When i run this, i get my.package.name" doesnt contain
ObjectFactory.class or jaxb.index. 

I read everywhere that it's a classloader issue, so I went ahead and tried
the following:

ClassLoader cl = my.package.name.ObjectFactory.class.getClassLoader();
JAXBContext jc = JAXBContext.newInstance("my.package.name", cl);

That gave me loader constraints violated when linking
javax/xml/namespace/QName class

I went ahead and removed my.package.name package from the jar file under
services and put it in axis2.war\WEB-INF\lib and used the
JAXBContext.newInstance("my.package.name") and this time I only got loader
constraints violated when linking javax/xml/namespace/QName class

I tried removing some of the jars that were in axis2/web-inf/lib directory
that contained the namespace/QName class and that didn't do anything.  Some
of the jars were:

axis2-saaj-api-1.4.1.jar
stax-api.jar from (jboss\lib\endorsed).

I've tried other things as well but I figured this email is long enough as
is.  In either case, I always get the loader constraint error.

One last thing to mention.  I have the same code tested in eclipse and it
works fine.  What I did was I loaded all the jar files that were needed from
axis2\lib and it worked fine.  What was interesting was I noticed that my
sdk contained rt.jar which contained the Qname class.  I wanted to see if my
eclipse was using this version of the class or if it was using it from the
axis2\lib jars.  So I removed the namespace package from the rt.jar and it
didn't work, even though I had the two jars stated above in my java build
path.  Not sure if this testing helps at all, but just wanted to point it
out.

Any help would be appreciated.

Thanks.






-- 
View this message in context: http://old.nabble.com/JAXB-integrating-with-AXIS2---oader-constraints-violated-when-linking-javax-xml-namespace-QName-class-tp26489184p26489184.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: JAXB integrating with AXIS2 - oader constraints violated when linking javax/xml/namespace/QName class

Posted by wazup80 <wa...@gmail.com>.
I have finally figured out the issue!! :) :)

For those who are having a similiar issue, it turned out that one of the
jars in my Axis2/WEB-INF/lib directory contained the namespace/QName class. 
I removed a couple a while back, but apparently missed the following:

woden-impl-dom-1.0M8.jar

The one that my app eventually used was the rt.jar from my jdk.  

Thanks

wazup80 wrote:
> 
> Hi,
> 
> I'm new to webservices, and axis2 and I've been stuck on this for a while
> and can't seem to fix this issue.  There are alot on the net on this
> topic, but I have looked at everything and seem to have no luck.  I'm
> hoping someone can help me on this.  
> 
> I'm running jboss5.0.0 with Axis2.1.4 and using JAXB and jdk1.5.21.  I
> have a webservice that will gather info, and then call another webservice. 
> I'm able to call the other webservice and get the data, but now i'm trying
> to parse the data.  This is where it fails and where i'm using JAXB.  
> 
> I have everything compiled and in the jar file (xxx.aar file).  That
> includes the services.xml file and the jaxb generated classes.
> 
> Here is where it's failing at:
> 
> JAXBContext jc = JAXBContext.newInstance("my.package.name");
> 
> my.package.name is the package that contains the JAXB classes generated
> from the schema.  When i run this, i get my.package.name" doesnt contain
> ObjectFactory.class or jaxb.index. 
> 
> I read everywhere that it's a classloader issue, so I went ahead and tried
> the following:
> 
> ClassLoader cl = my.package.name.ObjectFactory.class.getClassLoader();
> JAXBContext jc = JAXBContext.newInstance("my.package.name", cl);
> 
> That gave me loader constraints violated when linking
> javax/xml/namespace/QName class
> 
> I went ahead and removed my.package.name package from the jar file under
> services and put it in axis2.war\WEB-INF\lib and used the
> JAXBContext.newInstance("my.package.name") and this time I only got loader
> constraints violated when linking javax/xml/namespace/QName class
> 
> I tried removing some of the jars that were in axis2/web-inf/lib directory
> that contained the namespace/QName class and that didn't do anything. 
> Some of the jars were:
> 
> axis2-saaj-api-1.4.1.jar
> stax-api.jar from (jboss\lib\endorsed).
> 
> I've tried other things as well but I figured this email is long enough as
> is.  In either case, I always get the loader constraint error.
> 
> One last thing to mention.  I have the same code tested in eclipse and it
> works fine.  What I did was I loaded all the jar files that were needed
> from axis2\lib and it worked fine.  What was interesting was I noticed
> that my sdk contained rt.jar which contained the Qname class.  I wanted to
> see if my eclipse was using this version of the class or if it was using
> it from the axis2\lib jars.  So I removed the namespace package from the
> rt.jar and it didn't work, even though I had the two jars stated above in
> my java build path.  Not sure if this testing helps at all, but just
> wanted to point it out.
> 
> Any help would be appreciated.
> 
> Thanks.
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/JAXB-integrating-with-AXIS2---oader-constraints-violated-when-linking-javax-xml-namespace-QName-class-tp26489184p26506956.html
Sent from the Axis - User mailing list archive at Nabble.com.