Trouble with Jersey MIME Type "text/xml;charset=UTF-8 was not found"

10,136

Solution 1

I've asked the same question on the jersey mailing (http://java.net/projects/jersey/lists) list and recieved a working answer, which leaves me answering my on question here. But I have to admit that I dont completely understand the solution and reason for the problem. So please fell free to leave some comments or a new answer.

The problem seems to be, that the assembly plugin is not correctly merging some META-INF files. As I undertand there needs to be a renaming of descriptions or so!?

Instead of using the assembly plugin for maven use the shade plugin!

Read the problem and solution here: http://jersey.576304.n2.nabble.com/issue-with-POST-when-packaging-into-jar-td5460103.html

And see the shade plugin for maven here: http://maven.apache.org/plugins/maven-shade-plugin/

Solution 2

Somehow the JAXB provider was not found. Probably some classpath problem: in Netbeans the class was added to the classpath, while in maven it wasn't.

I suggest you compare the actual classpathes. In Maven you can see the actual classpath by running mvn dependency:build-classpath. Not sure how to do it in Netbeans.

Share:
10,136
jonbros
Author by

jonbros

Updated on June 04, 2022

Comments

  • jonbros
    jonbros almost 2 years

    Why do I get the following Exception when running the program within a jar bundle, but not getting this Exception when executing it within netbeans?

    com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class javax.xml.bind.JAXBElement, and Java type javax.xml.bind.JAXBElement, and MIME media type text/xml;charset=UTF-8 was not found

    I am building my program with maven and the assembly plugin.

    mvn assembly:assembly

    What does netbeans do different when I am running "Run File"?

  • jonbros
    jonbros about 13 years
    Thank you, that is good to know. I have recieved a reply on the jersey mailing list, but dont completly understand it. Feel free to comment.