尝试请求RESTful URI时,Jetty日志返回“服务器发送HTTP状态代码503:服务不可用”

时间:2013-04-24 17:36:34

标签: rest jetty jax-rs

嘿伙计们我正在尝试创建一个RESTful Web服务,它将通过SOAP从SAP应用程序中获取一些数据,然后将这些数据传输到JSON,然后可以通过REST调用访问它们。

我正在使用Jetty作为我的应用程序服务器,当我尝试访问此URL时,我在我正在运行Jetty的终端中得到了这个: http://localhost:9090/cxf/json/appName/filteredList/someVar=test?nocache=y 我的浏览器只显示“{”MyData“:[]}”

ERROR - SapSoapHelper - Loading wsdl from: file:/Users/me/workspace/projects/myProjects/target/classes/wsdl/myWSDL.wsdl ERROR - SapSoapHelper - There was a problem calling the web service com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 503: Service Unavailable at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:196) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:168) at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83) at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428) at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211) at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98) at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107) at com.sun.proxy.$Proxy49.runQueryAsAService(Unknown Source) at com.cirrus.web.sbus.sapbi.DynOpenOpps.filteredList(DynOpenOpps.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:166) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:93) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:126) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:575) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1365) at com.cirrus.web.sbus.sapbi.filter.CacheFilter.doFilter(CacheFilter.java:175) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1061) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:995) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:351) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:451) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:916) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:647) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:233) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:75) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:615) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) at java.lang.Thread.run(Thread.java:680)

我很确定我的注释是正确的,我想知道这可能是Jetty的一个问题。有什么建议吗?

这是我的web.xml文件的片段,我是REST网络服务的新手,因此我不确定其他哪些信息可以帮助我们找出正在发生的事情。

<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/cxf/*</url-pattern>
</servlet-mapping>

非常感谢任何帮助,谢谢。

FIX:我终于弄明白了为什么会这样。我在公司防火墙后面工作,并在〜/ .bash_profile中编辑我的$ http_proxy以适应这个。我必须从〜/ .bash_profile中删除我的$ http_proxy设置才能使其正常工作。

1 个答案:

答案 0 :(得分:0)

可能是下列情况之一。

  1. 您的网络应用中的某些内容正在引发基于javax.servlet.UnavailableException的异常。 Jetty的内部Servlet实现将捕获它并响应503(服务不可用)。

  2. 您的网络应用程序正在尝试与另一台投掷503的服务器进行通信,并且此错误正在转发回您的客户端(此错误基于您的com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe行的存在堆栈跟踪)