I tried...
----------

I'm trying to develop my first Java application based on REST services using Jersey.

Everything worked fine when I was launching the app from IntelliJ IDEA (13.1.3), so I tried to bundle everything as a jar file with maven-assembly-plugin.

But when I launch the jar, the server isn't able to start.

```
$ java -jar target/receiver-0.1.0-SNAPSHOT-jar-with-dependencies.jar
Jul 09, 2014 7:32:27 PM com.sun.jersey.api.core.ClasspathResourceConfig init
INFORMATION: Scanning for root resource and provider classes in the paths:
  target/receiver-0.1.0-SNAPSHOT-jar-with-dependencies.jar
Jul 09, 2014 7:32:27 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFORMATION: Root resource classes found:
  class org.outofrange.receiver.FileRestService
Jul 09, 2014 7:32:27 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFORMATION: No provider classes found.
Jul 09, 2014 7:32:27 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFORMATION: Initiating Jersey application, version 'Jersey: 1.18.1 02/19/2014 03:28 AM'
Jul 09, 2014 7:32:27 PM com.sun.jersey.spi.inject.Errors processErrorMessages
SCHWERWIEGEND: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for method public javax.ws.rs.core.Response org.outofrange.receiver.FileRestService.postFile(java.lang.String,java.io.InputStream) at parameter at index 1
  SEVERE: Method, public javax.ws.rs.core.Response org.outofrange.receiver.FileRestService.postFile(java.lang.String,java.io.InputStream), annotated with PUT of resource, class org.outofrange.receiver.FileRestService, is not recognized as valid resource method.
Exception in thread "main" com.sun.jersey.spi.inject.Errors$ErrorMessagesException
    at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
    at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
    at com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:172)
    at com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:264)
    at com.sun.jersey.api.container.ContainerFactory.createContainer(ContainerFactory.java:246)
    at com.sun.jersey.api.container.httpserver.HttpServerFactory.create(HttpServerFactory.java:117)
    at com.sun.jersey.api.container.httpserver.HttpServerFactory.create(HttpServerFactory.java:92)
    at org.outofrange.receiver.ReceiverServer.<init>(ReceiverServer.java:14)
    at org.outofrange.receiver.ReceiverServer.main(ReceiverServer.java:27)

```

Basically, my `main` just starts a server with `HttpServerFactory.create("address")`, and my REST-class looks like the following:

```
package org.outofrange.receiver;

import com.sun.jersey.multipart.FormDataParam;

import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.*;

@Path("/file")
public class FileRestService {
    @PUT
    @Path("/{fileName}")
    @Produces(MediaType.TEXT_PLAIN)
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response postFile(@PathParam("fileName") String fileId, @FormDataParam("file") InputStream fileInputStream) {
        return Response.ok("File successfully saved (more or less)").build();
    }
}

```

I made a [small example](https://github.com/outofrange/Receiver/tree/receiver-sscce "SSCCE @ github") which should demonstrate this behaviour.

And I tried...
--------------

If I remove the multipart/FormDataparam annotations from my rest services, the problem still occurs.
Only if I remove the dependency to jersey-multipart, I'm able to launch the packaged jar - so there has to be a problem with it.

I found many solutions to other's problems about using the same version of jersey and jersey-multipart - but according to my pom.xml (and to `mvn dependency:tree`) I'm using 1.18.1 with both of them.

Beside of that, I just found workarounds, which would be my plan B.

If I'm using jersey 1.3, I'm able to start the server from the packaged jar - the problematic versions are jersey [1.4 - 1.18.1]

* Why can I start the server with IntelliJ?
* Why can't I do it after packaging/assembling?
* How can I fix it / what am I doing wrong?