从java和jersey 2开始时出错

时间:2017-07-23 23:06:51

标签: java rest jersey jersey-2.0 jersey-client

我正在尝试使用Maven创建一个使用Jersey的Rest应用程序,但我总是遇到相同的错误。

我在Jersey网站上下载了默认zip并在项目中设置了我的jar,但每次启动应用程序时都会返回以下错误:

jul 22, 2017 5:34:37 PM org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet [Service] in web application [/com.radarveicular.service] threw load() exception
java.lang.ClassNotFoundException: org.glassfish.jersey.internal.spi.AutoDiscoverable
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1271)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.glassfish.jersey.internal.util.ReflectionHelper$7.run(ReflectionHelper.java:403)
    at org.glassfish.jersey.internal.util.ReflectionHelper$7.run(ReflectionHelper.java:398)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.glassfish.jersey.internal.ServiceFinder$AbstractLazyIterator.hasNext(ServiceFinder.java:577)
    at org.glassfish.jersey.internal.ServiceFinder.toClassArray(ServiceFinder.java:418)
    at org.glassfish.jersey.internal.ServiceFinderBinder.configure(ServiceFinderBinder.java:90)
    at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:187)
    at org.glassfish.hk2.utilities.binding.AbstractBinder.install(AbstractBinder.java:362)
    at org.glassfish.jersey.server.ServerBinder.configure(ServerBinder.java:94)
    at org.glassfish.hk2.utilities.binding.AbstractBinder.bind(AbstractBinder.java:187)
    at org.glassfish.jersey.internal.inject.Injections.bind(Injections.java:157)
    at org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:147)
    at org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:330)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
    at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

0 个答案:

没有答案