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.