0

I just tried to use the jersey-server api in a java application. It's a maven project and I already added the mysql-connector api which works fine. When the application which is compressed into a jar (Intellij-Artifacts) runs, it throws the exception:

Exception in thread "main" java.lang.NoClassDefFoundError: 
com/sun/jersey/api/container/httpserver/HttpServerFactory
at de.myleak.server.Server.init(Server.java:19)
at de.myleak.core.Core.init(Core.java:87)
at de.myleak.core.Core.<init>(Core.java:51)
at de.myleak.core.Core.main(Core.java:40)
Caused by: java.lang.ClassNotFoundException: 
com.sun.jersey.api.container.httpserver.HttpServerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more

I added the dependency to the pom.xml

    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.19.4</version>
    </dependency>

I also added the maven dependency in the project structure screenshot

Screenshot

aduguid
  • 3,099
  • 6
  • 18
  • 37
str4in
  • 1
  • 3

0 Answers0