1

我正在使用 Jetty 并在我的构建服务器上遇到以下问题(我没有在我的开发机器上得到它)。

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)

现在我可以看到有些人说我需要设置ReceiveTimeout我的连接。1 这些人似乎没有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我的连接 - 或者请给我其他的东西吗?

4

1 回答 1

-1

我还没有找到原因,但我采取的解决方法是在我的集成测试中从 Jetty 切换并开始使用 Cargo 下载 Tomcat,安装工件/战争并运行测试。

Cargo 需要 5 秒测试,Jetty 需要 5 分钟!所以他们现在都跑了,跑起来只需要 2 分钟,而不是将近一个小时!

简而言之,看看 Cargo (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>
于 2013-11-09T08:42:36.500 回答