2013-11-24 59 views
2

我試圖在我的web應用程序中實現REST服務。由於我將應用程序部署到JBoss 7.1服務器,我想使用應包含的RESTeasy框架。在JBoss 7.1上實現RESTeasy服務的問題

我跟隨official JBOSS tutorial。不過,即使我嘗試在應用程序中將RESTeasy作爲顯式依賴項,我總是會收到ClassNotFoundException

Allocate exception for servlet javax.ws.rs.core.Application: java.lang.ClassNotFoundException: org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher from [Module "deployment.app-1.0.2-SNAPSHOT.war:main" from Service Module Loader] 
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) 
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) 
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) 
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) 
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) 
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1156) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:] 
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:] 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:] 
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45] 

回答

0

我解決了這個由與類中添加一個library

RestEasy的-JAXRS»3.1.0.CR3

與Maven我說:

<!-- https://mvnrepository.com/artifact/org.jboss.resteasy/resteasy-jaxrs --> 
<dependency> 
    <groupId>org.jboss.resteasy</groupId> 
    <artifactId>resteasy-jaxrs</artifactId> 
    <version>3.1.0.CR3</version> 
</dependency>