OK, you have done a nice simple Web service client, it runs fine in your tests, you bung it on JBoss and when ever you trigger it you get something like this
java.lang.LinkageError: loader constraint violation: when resolving method “javax.xml.ws.Service.(Ljava/net/URL;Ljavax/xml/namespace/QName;)V” the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, com/sun/j2ee/blueprints/opc/powebservice/XYZService, and the class loader (instance of ) for resolved class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature
You might miss the “loader constraint violation” part and think that its to do with the QName, or that your @WebServiceRef annotation is not working, well don’t bother, you have a clashing .Jar library, and its most likely going to be “stax-api” (which Jboss loads before you even get there with your app), so you will want to looking in your Lib directory ( which will be in the “WEB-INF” directory in your war file or build target directory ) of your packaged app to see if the little devil is in there, if you’re dealing with your libs manually then you are going to just have to remember why you put it there (although http://www.findjar.com/ can be a lot of help there), if you are using maven then the following command will tell what jar’s come from which libs
This gives you the following kind of display
You will now need to put in exclusions in your pom.xml to stop the jars that you don’t want from being loaded in, here is an example
You might have to add a number of these and check the dependency:tree each time to make sure another does not pop in, in order to get them all.
This SHOULD fix your problem, but sometimes you either want your version of the Jar file to be on the server or you simply cant seem to get rid of a jar field in your build, you can tell jboss to use your jars over its own one by adding a jboss-classloading.xml file in src/main/webapp/WEB-INF directory. and adding the following lines to it.
That should sort it out.
##### Ben Poole(23/04/2012 23:11:54 GDT)
This sort of shyte is why we love Java so.
##### Mark Myers(12/05/2012 13:23:16 GDT)
tell me about it