Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7981883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:30:36+00:00 2026-06-04T10:30:36+00:00

I am using Maven, Jersey and Jetty server to build a web service interface.

  • 0

I am using Maven, Jersey and Jetty server to build a web service interface.

When I developed and tested the software on Eclipse, everything work fine. However, when I am trying to deploy the project, and make request to the interface, the server reported that “MIME media type application/xml was not found”.

I tried a few days to figure the problem and found that the ServiceFinder (provided by Jersey), can find all MessageBodyWriter on Eclipse, but not in command line. I also checked that all jersery libs are already in place, and defined inside the META-INF.

Any help is highly appreciated! Thanks!

JDK: 1.6.0_30
Eclipse: Indigo SR2
Jersey: 1.12
Jetty: 6.1.25

ServiceFinder Code:

ServiceFinder.find(javax.ws.rs.ext.MessageBodyWriter.class, true).toClassArray();

=============== META-INF
Created-By: Apache Maven
Built-By:
Build-Jdk: 1.6.0_30
Class-Path: jersey-servlet-1.12.jar jersey-server-1.12.jar asm-3.1.jar
jersey-core-1.12.jar

============= In command line (Only ViewableMessageBodyWriter is available)

GN MBR:class com.sun.jersey.server.impl.template.ViewableMessageBodyWriter CP:co
m.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@28946
139 C:com.sun.jersey.server.impl.template.ViewableMessageBodyWriter@6a7d46b8

============= In eclipse (All jersey provider are avaialbe)

GN MBR:class com.sun.jersey.server.impl.template.ViewableMessageBodyWriter CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@2fba32e3 C:com.sun.jersey.server.impl.template.ViewableMessageBodyWriter@60039882
GN MBR:class com.sun.jersey.core.impl.provider.entity.StringProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@6962ed8f C:com.sun.jersey.core.impl.provider.entity.StringProvider@31cc3e7c
GN MBR:class com.sun.jersey.core.impl.provider.entity.ByteArrayProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@5dda7d56 C:com.sun.jersey.core.impl.provider.entity.ByteArrayProvider@1af30c34
GN MBR:class com.sun.jersey.core.impl.provider.entity.FileProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@335ac93d C:com.sun.jersey.core.impl.provider.entity.FileProvider@6695c13b
GN MBR:class com.sun.jersey.core.impl.provider.entity.InputStreamProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@d51de22 C:com.sun.jersey.core.impl.provider.entity.InputStreamProvider@4592b04e
GN MBR:class com.sun.jersey.core.impl.provider.entity.DataSourceProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@79ce9102 C:com.sun.jersey.core.impl.provider.entity.DataSourceProvider@41fb404
GN MBR:class com.sun.jersey.core.impl.provider.entity.RenderedImageProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@689258c7 C:com.sun.jersey.core.impl.provider.entity.RenderedImageProvider@4c843d2b
GN MBR:class com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@6002a673 C:com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider@20f1fbb4
GN MBR:class com.sun.jersey.core.impl.provider.entity.FormProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@4dfdf943 C:com.sun.jersey.core.impl.provider.entity.FormProvider@44d0d6fd
GN MBR:class com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@5cf7c5b5 C:com.sun.jersey.core.impl.provider.entity.FormMultivaluedMapProvider@29dafde4
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@ed51dc2 C:com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App@8c5697a
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@4994b329 C:com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text@48e14b1f
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@417e6e7c C:com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General@6c9ce1cb
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@5387b07b C:com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App@2acb4dcf
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@71538614 C:com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$Text@59b02f33
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@2287c52c C:com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General@9fc1ec5
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@7fa1dd69 C:com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App@7a95626d
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Text CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@5bcf59f5 C:com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$Text@1e69555f
GN MBR:class com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@a1b12ea C:com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General@4feaf536
GN MBR:class com.sun.jersey.core.impl.provider.entity.ReaderProvider CP:com.sun.jersey.core.spi.component.ProviderFactory$SingletonComponentProvider@7776c5d4 C:com.sun.jersey.core.impl.provider.entity.ReaderProvider@5d66341b

…

============= Full Error Stack ==================

23-May-2012 12:05:54 com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type
are:
*/* ->
  com.sun.jersey.server.impl.template.ViewableMessageBodyWriter

23-May-2012 12:05:54 com.sun.jersey.spi.container.ContainerResponse logException

SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class com.test.TestRest, and Java type class com.test.TestRest, and MIME media type application/xml was not found
        at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1451)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class com.test.TestRest, and Java type class com.test.TestRest, and MIME media type application
/xml was not found
        ... 21 more

============= Start Jetty Server ====
I am using Jetty Web Server, and started the server like this:

Context root = new Context(server, "/", Context.SESSIONS); 
// Add REST handlers and Singleton providers 
ResourceConfig rc = new PackagesResourceConfig("handlerpkg"); 

// Add the Jersey root servlet holder to the root context 
root.addServlet(new ServletHolder(new ServletContainer(rc)), "/*");

server.start();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:30:38+00:00Added an answer on June 4, 2026 at 10:30 am

    The problem is solved by adding jersey-core-1.12.jar explicitly in class path as part of the VM argument.

    I was having only one library in -cp, which points to the other libraries using Class-Paths field in MANIFEST.MF file. Interestingly, using this method, the MessageBodyReaders can be found by the ServiceFinder, but not the MessageBodyWriter.

    Now I have two libraries in -cp, which is the jersey-core-1.12.jar and the lib contains the Main class.

    Thank you for all your great helps. stackoverflow is an amazing developer site.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop a basic Restful service using Jersey Maven and Eclipse
I am using to use jersey-server 1.12 with jetty-maven-plugin 8.1.2.v20120308. If I am using
I've just started using maven for trying to build a multi module project. Everything
I have created a web application using Jersey and Dynamic Web Project of Eclipse.
We are using Maven to compile our project on a build server. We update
I am using Maven with Eclipse (using M2E) to build a project that relies
I am using Maven 3 for build Dashboard project After building my web application
I have a Maven 2 RESTful application using Jersey/JAXB. I generate the JAXB beans
Im using maven to build a multi module project. But some projects are in
I am using Maven as the build file , this is my below settings

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.