title: jersey server missing dependencies
body: <p>I'm using this code:</p>
  
  <pre><code>import java.io.File;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  import javax.ws.rs.Consumes;
  import javax.ws.rs.POST;
  import javax.ws.rs.Path;
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.core.Response;
  import com.sun.jersey.core.header.FormDataContentDisposition;
  import com.sun.jersey.multipart.FormDataParam;
  
  @Path("/files")
  public class JerseyFileUpload {
  
      private static final String SERVER_UPLOAD_LOCATION_FOLDER = "C://Users/nikos/Desktop/Upload_Files/";
  
      /**
       * Upload a File
       */
  
      @POST
      @Path("/upload")
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public Response uploadFile(
              @FormDataParam("file") InputStream fileInputStream,
              @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) {
  
          String filePath = SERVER_UPLOAD_LOCATION_FOLDER
                  + contentDispositionHeader.getFileName();
  
          // save the file to the server
          saveFile(fileInputStream, filePath);
  
          String output = "File saved to server location : " + filePath;
  
          return Response.status(200).entity(output).build();
  
      }
  
      // save uploaded file to a defined location on the server
      private void saveFile(InputStream uploadedInputStream, String serverLocation) {
  
          try {
              OutputStream outpuStream = new FileOutputStream(new File(
                      serverLocation));
              int read = 0;
              byte[] bytes = new byte[1024];
  
              outpuStream = new FileOutputStream(new File(serverLocation));
              while ((read = uploadedInputStream.read(bytes)) != -1) {
                  outpuStream.write(bytes, 0, read);
              }
              outpuStream.flush();
              outpuStream.close();
          } catch (IOException e) {
  
              e.printStackTrace();
          }
  
      }
  
  }
  </code></pre>
  
  <p>When I try to run it on Apache Tomcat I get these error messages:</p>
  
  <pre><code>SEVERE: 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 com.javacodegeeks.enterprise.rest.jersey.JerseyFileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 0
    SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.javacodegeeks.enterprise.rest.jersey.JerseyFileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 1
    SEVERE: Method, public javax.ws.rs.core.Response com.javacodegeeks.enterprise.rest.jersey.JerseyFileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition), annotated with POST of resource, class com.javacodegeeks.enterprise.rest.jersey.JerseyFileUpload, is not recognized as valid resource method.
  Nov 19, 2014 11:44:41 AM org.apache.catalina.core.ApplicationContext log
  SEVERE: StandardWrapper.Throwable
  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.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
      at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491)
      at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321)
      at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
      at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
      at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376)
      at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4932)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5218)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:745)
  
  Nov 19, 2014 11:44:41 AM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet /asdf threw load() exception
  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.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
      at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491)
      at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321)
      at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
      at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
      at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376)
      at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1241)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4932)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5218)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:74
  </code></pre>
  
  <p>What does this mean? How can I fix these dependencies?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>UPD 0</strong>
  Dependencies:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.javacodegeeks.enterprise.rest.jersey&lt;/groupId&gt;
      &lt;artifactId&gt;JAXRS-HelloWorld&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;maven2-repository.java.net&lt;/id&gt;
              &lt;name&gt;Java.net Repository for Maven&lt;/name&gt;
              &lt;url&gt;http://download.java.net/maven/2/&lt;/url&gt;
              &lt;layout&gt;default&lt;/layout&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
              &lt;version&gt;1.9&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey.contribs&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-multipart&lt;/artifactId&gt;
              &lt;version&gt;1.9&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>