java – NetConnection.Call.Failed偶尔在Flex3 / Tomcat / BlazeDS / Spring中发生
作者:互联网
我有一个非常大的问题.我使用Flex3 / Tomcat / BlazeDS / Spring编写了一个大型应用程序,在本地开发时运行良好,当我部署到公共开发环境时很好,但是当部署到我们的测试环境时经常失败.
当远程处理请求花费大量时间(超过20秒)时,故障似乎最常发生.在我的开发服务器上,错误发生,但仅在请求需要很长时间(超过45秒)时才会发生.但是,错误也会偶尔发生(发送请求并立即失败).大多数错误也有HTTP状态:502(坏网关),但有些只是说HTTP失败.
除了将war文件放在webapps目录中之外,我没有对BlazeDS做过任何特别的事情.通过https访问该应用程序.远程呼叫仅通过“目的地”引用服务器.我们的DEV和TEST实例上的tomcat服务器具有相同的java参数(相同的Xms和Xmx等).以下是我的相关文件:
services-config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<default-channels>
<channel ref="my-secure-amf"/>
</default-channels>
</services>
<channels>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
</channels>
<services-config>
web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
...
<servlet>
<servlet-name>spring-flex</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/flexContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-flex</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
</web-app>
flexContext.xml
<!--
I have component-scan tags here to scan my class files. The Controller I'm using for flex has an annotation on it to define it as a remote destination. Here it is:
@Controller
@RemotingDestination(value = "dest", channels="my-secure-amf")
public class FlexController {
-->
<bean id="flexExceptionTranslator" class="edu.liberty.zconduct.web.FlexExceptionTranslator" />
<flex:message-broker>
<flex:exception-translator ref="flexExceptionTranslator"/>
<!-- <flex:secured /> Had this previously, but it wasn't working then, either -->
</flex:message-broker>
我快要接近绳子了.错误是app-breaker.如果可以,请帮助我.
编辑
我切换到http仍然得到错误. Tomcat现在说:
WARNING: Error sending end packet
java.net.SocketException: Broken pipe
我在我的apache日志中查找jk_mod并查看一些看起来像我发送的请求的调试信息,然后是以下内容:
[debug]
ajp_send_request::jk_ajp_common.c
(1592): Resent the request body (432)[debug]
jk_shutdown_socket::jk_connect.c
(681): About to shutdown socket 68[debug]
jk_shutdown_socket::jk_connect.c
(732): Shutdown socket 68 and read 0
lingering bytes[info]
ajp_connection_tcp_get_message::jk_ajp_common.c
(1150): (myTestServer) can’t receive
the response header message from
tomcat, network problems or tomcat
(xx.xx.xx.xx:xxxx) is down (errno=11)[error] ajp_get_reply::jk_ajp_common.c
(1962): (myTestServer) Tomcat is down
or refused connection. No response has
been sent to the client (yet)[info] ajp_service::jk_ajp_common.c
(2447): (myTestServer) sending request
to tomcat failed (recoverable),
(attempt=2)[error] ajp_service::jk_ajp_common.c
(2466): (myTestServer) connecting to
tomcat failed.[debug]
ajp_reset_endpoint::jk_ajp_common.c
(743): (myTestServer) resetting
endpoint with sd = 4294967295 (socket
shutdown)[debug] ajp_done::jk_ajp_common.c
(2905): recycling connection pool
slot=0 for worker myTestServer[info] jk_handler::mod_jk.c (2615):
Service error=0 for
worker=myTestServer
解决方法:
Cornel Creanga帮我解决了这个问题.我将我的应用程序切换为http并开始在catalina.out文件中接收消息.我不知道为什么会影响它,但确实如此.消息都说套接字中有一根管子坏了.进一步调查显示jk_mod参与其中.
通过大量搜索,我发现我们的SysAdmins已经在我们的TEST服务器上将服务器上的套接字超时设置为10秒,但在我们的DEV服务器上设置为5分钟,因此进行的大量搜索导致它在达到TEST后超时.
SysAdmins在TEST上调整了配置,以便另一个工作程序(超时5分钟)处理此上下文路径的调用.
标签:java,flex,spring,tomcat,blazeds 来源: https://codeday.me/bug/20190705/1384228.html