2013-07-22 255 views
1

我正在使用Jetty並在構建服務器上獲取以下問題(我沒有在我的開發計算機上獲取它)。無法發送消息:SocketTimeoutException:NotAuthorizedException

2013-07-22 14:19:20,647972350: WARN : org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://rs.rtiservice.esi.v21.xxxx.com/}RTIServiceRSI has thrown exception, unwinding now 
org.apache.cxf.interceptor.Fault: Could not send Message. 
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) 
<SNIP> 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://localhost:25000/esi-rtiservice/ESI/RTIService/rs-rtiservice/addLineItem/: Read timed out 
<SNIP> 
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) 
    ... 104 more 
Caused by: java.net.SocketTimeoutException: Read timed out 
    at java.net.SocketInputStream.socketRead0(Native Method) 
<SNIP> 
    at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1308) 
    ... 107 more 
2013-07-22 14:19:20,654681221: ERROR : [qtp23135205-124] com.xxx.v21.mpos.MPOSEndPoint: System error 
javax.ws.rs.NotAuthorizedException 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
<SNIP> 
    at java.lang.Thread.run(Thread.java:662) 
2013-07-22 14:19:20,656234277: WARN : org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://mpos.v21.xxx.com/}MPOSEndPoint has thrown exception, unwinding now 
java.lang.IllegalStateException: WRITER 
    at org.eclipse.jetty.server.Response.getOutputStream(Response.java:673) 
<SNIP> 
    at java.lang.Thread.run(Thread.java:662) 
2013-07-22 14:19:20,658931461: WARN : [qtp23135205-124] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://mpos.v21.xxx.com/}MPOSEndPoint has thrown exception, unwinding now 
java.lang.IllegalStateException: WRITER 
    at org.eclipse.jetty.server.Response.getOutputStream(Response.java:673) 
    at org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractHTTPDestination.java:564) 

現在我可以看到有些人說我需要在我的連接上設置ReceiveTimeout1 這些人似乎沒有像我這樣的NotAuthorizedException

所有我看到的例子是這樣的:

<http-conf:destination 
    name="{http://apache.org/hello_world_soap_http}SoapPort.http-destination"> 
    <http-conf:server ReceiveTimeout="30000" 
         HonorKeepAlive="true" /> 
    </http-conf:destination> 

相反,我這樣定義我的:

<jaxrs:client id="itemService" address="http://${itemservice.address}/esi-itemservice/ESI/ItemService" serviceClass="com.xxx.v21.esi.itemservice.rs.ItemServiceRSI" inheritHeaders="true"> 
     <jaxrs:headers> 
      <entry key="Accept" value="application/xml" /> 
     </jaxrs:headers> 
     <jaxrs:providers> 
      <ref bean="jaxbextprovider" /> 
     </jaxrs:providers> 
    </jaxrs:client> 

誰能告訴我如何設置我的連接上的ReceiveTimeout - 或者給我別的東西繼續下去?

+0

web服務被固定。你需要憑證。 – willome

+0

NotAuthorizedException是先前超時的*結果*。這是他超時你必須在這裏解決,而不是結果。 – EJP

回答

-1

我還沒有找到原因,但我所採取的工作是在集成測試中從Jetty切換到開始使用Cargo下載Tomcat,安裝工件/戰爭並運行測試。

貨物需要5秒鐘的測試,碼頭需要5分鐘!所以他們現在都跑,跑了2分鐘,差不多一個小時!

總之,看看貨物(cargo.codehaus.org)

 <plugin> 
     <groupId>org.codehaus.cargo</groupId> 
     <artifactId>cargo-maven2-plugin</artifactId> 
     <version>1.4.5</version> 
     <configuration> 
      <container> 
      <containerId>tomcat7x</containerId> 
      <zipUrlInstaller> 
       <url>ftp://x.x.x.x/install_pack/Tomcat7/tomcat7.zip</url> 
       <downloadDir>${project.build.directory}/cargo/downloads</downloadDir> 
      </zipUrlInstaller> 
      <output>${project.build.directory}/cargo/container.log</output> 
      <append>false</append> 
      <log>${project.build.directory}/cargo/cargo.log</log> 
      <timeout>240000</timeout> 
      <systemProperties> 
       <logLevel>INFO</logLevel> 
       <itemservice.address>localhost:9080</itemservice.address> 
       <deviceservice.address>localhost:9080</deviceservice.address> 
       <userservice.address>localhost:9080</userservice.address> 
       <rtiservice.address>localhost:9080</rtiservice.address> 
       <corporateservice.address>localhost:9080</corporateservice.address> 
      </systemProperties> 
      </container> 
      <configuration> 
      <properties> 
       <cargo.servlet.port>9080</cargo.servlet.port> 
       <cargo.tomcat.ajp.port>9085</cargo.tomcat.ajp.port> 
       <cargo.jvmargs>-XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</cargo.jvmargs> 
       <cargo.logging>high</cargo.logging> 
      </properties> 
      </configuration> 
      <deployables> 
      <deployable> 
       <groupId>com.test</groupId> 
       <artifactId>test-war</artifactId> 
       <type>war</type> 
      </deployable> 
      </deployables> 
     </configuration> 
     <executions> 
      <execution> 
      <id>start-server</id> 
      <phase>pre-integration-test</phase> 
      <goals> 
       <goal>start</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>stop-server</id> 
      <phase>post-integration-test</phase> 
      <goals> 
       <goal>stop</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
+0

很難看出這是如何提供實際有用的答案的。 – EJP

+0

由於沒有人提出過這個問題的答案,所以我認爲放下我所做的工作是件好事。 Incase別人有同樣的問題。 –