Skip to main content

"SEVERE: caught throwable java.lang.LinkageError: loader constraint violation" when using Metro Maven plugin. Please help me.

2 replies [Last post]
aaaa0441
Offline
Joined: 2006-07-07
Points: 0

I have been trying out the https://svn.java.net/svn/jax-ws-commons~svn/trunk/jaxws-maven-plugin/src/it/wsgen and https://svn.java.net/svn/jax-ws-commons~svn/trunk/jaxws-maven-plugin/src/it/wsimport/url sample projects, but to no complete success. The wsgen project can be successfully compiled and "mvn jetty:run". I could even access the http://localhost:9090/helloworld?wsdl page correctly and use the wsimport project to generate client stub code. However, when I tried to test with a really simple web service call, the server side returned HTTP 500 error and threw the following exception.
Jan 11, 2012 11:55:57 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
java.lang.LinkageError: loader constraint violation: when resolving overridden method "com.sun.xml.ws.message.AttachmentUnmarshallerImpl.getAttachmentAsDataHandler(Ljava/lang/String;)Ljavax/activation/DataHandler;" the class loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader) of the current class, com/sun/xml/ws/message/AttachmentUnmarshallerImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type javax/activation/DataHandler used in the signature
......
The following is the method of the simple web service call that I coded.
public class TestClientStub {
public static void main(String[] args) {
HelloWorldService service = new HelloWorldService();
String result = service.getHelloWorldPort().helloWorld("Yeah!");
System.out.println(result);
}
}
wsgen and wsimport-url are the two Maven projects I checked out from javanet. I only made minor modifications to them, i.e. changing "jaxws.plugin.version" setting in the pom file from 2.2 to 2.2-SNAPSHOT because I could not find 2.2 and only found 2.2-SNAPSHOT from the java.net-Public repository (at https://maven.java.net/content/groups/public/) and changing the <wsdlUrl> parameter for the wsimport maven plugin.
And FYI, the IDE I use is IntelliJ. But even when I just use command line to run the jetty goals, the same error still happen.
I tried to google a solution and found out this post archive, http://www.java.net/node/676606?force=685. However, the suggested solutions do not help.
Could any guru give me some guidance on this issue? Is there anything I did wrong that's causing it?
Thanks a lot!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jungicz
Offline
Joined: 2004-08-17
Points: 0

Hi, can you try to update jetty plugin version from 6.0.1 to 6.1.26 as I did here: http://java.net/projects/jax-ws-commons/sources/svn/revision/959 and let me know if it helps, please?

Thanks!

aaaa0441
Offline
Joined: 2006-07-07
Points: 0

Wow! jungicz, you are awesome! Now it simply works! =P

Thanks a lot!