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

  • Home
  • SEARCH
  • 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 9152519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:04:09+00:00 2026-06-17T12:04:09+00:00

I had a method: @POST @Consumes(multipart/form-data) @Produces( {text/xml}) public Response processForm( @FormDataParam(myparam) InputStream is,

  • 0

I had a method:

@POST
@Consumes("multipart/form-data")
@Produces( {"text/xml"})
public Response processForm(
    @FormDataParam("myparam") InputStream is,
    @FormDataParam("myparam") FormDataContentDisposition detail)

which worked fine with Jersey 1.x.

I’m upgrading to 2.0 m11.

Now I get the following error:

12/01/2013 11:15:04 AM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.0-m11 2012-12-21 12:34:15...
12/01/2013 11:15:04 AM org.glassfish.jersey.internal.Errors processErrors
SEVERE: The following errors and warnings have been detected:
WARNING: No injection source found for a parameter of type public javax.ws.rs.core.Response com.plutext.FileUpload.processForm(java.io.InputStream,org.glassfish
.jersey.media.multipart.FormDataContentDisposition) at index 0.

I found http://java.net/jira/browse/JERSEY-1413 and commit http://java.net/projects/jersey/lists/commits/archive/2012-09/message/126 which seems relevant, but its not obvious to me what to do to fix the problem.

UPDATED

I made a servlet, which runs in Tomcat before org.glassfish.jersey.server.ApplicationHandler initialize:

public class Jersey2Init extends HttpServlet {

    private static final Logger jul = Logger.getLogger(Jersey2Init.class
        .getName());

    static {    
        System.out.println("\n\nrunning Jersey2Init\n\n");

        final ResourceConfig resourceConfig1 = new ResourceConfig(XFormService.class);
        resourceConfig1.registerInstances(new LoggingFilter(jul, true));
        resourceConfig1.register(MultiPartFeature.class);       

        final ResourceConfig resourceConfig2 = new ResourceConfig(AssembleService.class);
        resourceConfig2.registerInstances(new LoggingFilter(jul, true));
        resourceConfig2.register(MultiPartFeature.class);       
    }
}

It is definitely running first:

INFO: Deploying web application archive C:\Java\apache-tomcat-7.0.29\webapps\Foo-Services.war


running Jersey2Init


18/01/2013 9:09:51 PM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.0-m11 2012-12-21 12:34:15...
18/01/2013 9:09:52 PM org.glassfish.jersey.internal.Errors processErrors
SEVERE: The following errors and warnings have been detected:

But I still get the same error.

  • 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-17T12:04:10+00:00Added an answer on June 17, 2026 at 12:04 pm

    You need to enable MultiPart feature on your application. Enabling this feature injects necessary message body readers, writers to your Jersey 2 application. Here is how you register them:

    On the server-side (http-server):

    final ResourceConfig resourceConfig = new ResourceConfig(MultiPartResource.class);
    resourceConfig.register(MultiPartFeature.class);
    

    On the server-side (servlet deployment):

    import org.glassfish.jersey.filter.LoggingFilter;
    import org.glassfish.jersey.media.multipart.MultiPartFeature;
    
    import javax.ws.rs.core.Application;
    import java.util.HashSet;
    import java.util.Set;
    
    public class MyApplication extends Application {
        @Override
        public Set<Class<?>> getClasses() {
            final Set<Class<?>> classes = new HashSet<Class<?>>();
            // register resources and features
            classes.add(MultiPartFeature.class);
            classes.add(MultiPartResource.class);
            classes.add(LoggingFilter.class);
            return classes;
        }
    }
    

    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
        <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <servlet>
            <servlet-name>Jersey Servlet</servlet-name>
            <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
            <init-param>
                <param-name>javax.ws.rs.Application</param-name>
                <param-value>com.aruld.jersey.multipart.MyApplication</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>Jersey Servlet</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
    </web-app>
    

    On the client-side:

    final ClientConfig clientConfig = new ClientConfig();
    clientConfig.register(MultiPartFeature.class);
    Client client = ClientFactory.newClient(clientConfig);
    

    I put together an end-to-end Jersey 2 MultiPart sample in Github here.

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

Sidebar

Related Questions

I had to do something like this: def createpost(request): if request.method == 'POST': form
I am using this code if form.is_valid(): form.save() if request.POST.get('ajax') == 'true': return HttpResponse('Data
I am sending data to a PHP backend file via AJAX method POST. The
I had a script working using Ajax (POST method) via plain Javascript. Now I'm
For our webservice, I wrote some logic to prevent multipart/form-data POSTs larger than, say,
Before adding any parameters I had this POST method hitting my serverside code whenever
I had a method with the following line @noticias = Noticia.where(:tags.all => array).paginate(:page =>
Initially I had a method in our DL that would take in the object
I got a problem today. It had a method and I need to find
I saw a Java example that had a main method labeled as synchronized, calling

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.