0

I want to upload a file to a server from an html client.


Exception:
Caused by: java.lang.ClassNotFoundException:
org.glassfish.jersey.process.internal.RequestExecutorFactory


pom.xml:
<dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-core</artifactId>
        <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
        <groupId>io.dropwizard</groupId>
        <artifactId>dropwizard-forms</artifactId>
        <version>${dropwizard.version}</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20160212</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-multipart</artifactId>
        <version>2.21</version>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-multipart</artifactId>
        <version>1.18.3</version>
    </dependency>

and this is run in the app class:

    env.jersey().register(MultiPartFeature.class);
    env.jersey().register(MultiPartConfigProvider.class);
    Execute execute=new Execute();
    env.jersey().register(execute);

I think the problem is by pom.xmlbut after a lot of change in pom don't get any result before
this exception I have another exception that MultipartConfig class not exist so I register MultipartFeature.class and multipartConfigProvider.class but get this exception.
In the last exception (MultipartConfig) program exit after exception but in this exception
program not exit.
project repository on github

mrme
  • 29
  • 1
  • 9
  • Possible duplicate of [org.glassfish.jersey.servlet.ServletContainer ClassNotFoundException](http://stackoverflow.com/questions/22022114/org-glassfish-jersey-servlet-servletcontainer-classnotfoundexception) – Vikrant Kashyap Jun 27 '16 at 05:29
  • Do you have the jersey-common jar in your dependency, if not please add it. For maven dependency refer https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-common/2.9 – Clement Amarnath Jun 27 '16 at 05:38
  • not effective :( .same exception @ClementAmarnath – mrme Jun 27 '16 at 05:41
  • is it correct to use `jersey version` 2.21 with `dropwizard` version 0.8.0?? @ClementAmarnath – mrme Jun 27 '16 at 05:43
  • How can it be duplicate? @VikrantKashyap – mrme Jun 27 '16 at 05:44
  • may you view my code on github? @ClementAmarnath – mrme Jun 27 '16 at 05:52
  • @mme - dropwizard 0.8.0(https://www.versioneye.com/java/io.dropwizard:dropwizard-jersey/0.8.0) recommendation for jersey is jersey 2.16, but as you are using 2.2.1 it should be fine. – Clement Amarnath Jun 27 '16 at 06:26

1 Answers1

1

problem was solved by change to dropwizard version to 0.9.1
and add this dependency:

<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3</version>
</dependency>

instead of :

   <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-multipart</artifactId>
        <version>2.21</version>
    </dependency>

    <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-multipart</artifactId>
        <version>1.18.3</version>
    </dependency>
mrme
  • 29
  • 1
  • 9