为什么我得到javax.ws.rs.WebApplicationException

时间:2013-12-11 18:05:16

标签: eclipse web-services tomee

我正在尝试编写一个简单的项目。我正在使用tomee。 Tomee工作正常,但我无法达到我的项目。当我尝试从浏览器中运行我的项目时,eclipse控制台会给我以下错误。

INFO: Server startup in 1661 ms
Dec 11, 2013 7:59:15 PM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor processRequest
WARNING: No root resource matching request path  has been found, Relative Path: /. Please enable FINE/TRACE log level for more details.
Dec 11, 2013 7:59:15 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: javax.ws.rs.WebApplicationException
    at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:162)
    at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:91)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:237)
    at org.apache.openejb.server.cxf.rs.CxfRsHttpListener.onMessage(CxfRsHttpListener.java:170)
    at org.apache.openejb.server.rest.RsServlet.service(RsServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    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:744)

1 个答案:

答案 0 :(得分:1)

如果你没有指定一个应用程序,似乎休息服务会接管你的完整上下文,所以将下面的类添加到你的上下文中它应该有用(它适用于我)。

@ApplicationPath("/rest") 
public class ApplicationConfig extends Application { 
} 

http://openejb.979440.n4.nabble.com/No-root-resource-matching-request-path-td4666495.html

<强>更新

或者为了不在您的其他网址中放置丑陋的/rest部分:您可以缩小范围,而不是为主要网络应用程序指定urlPatterns={"/*"}(与默认的其他应用程序冲突)例如对于vaadin来说,到目前为止,这是有效的:

@WebServlet(urlPatterns = {"", "/VAADIN/*", "/UIDL/*", "/HEARTBEAT/*"}

因此,您没有为主应用程序更精确地指定的所有内容都将转到其他应用程序。