q1345111 2014-09-23 07:13
浏览 2272

hessian的RemoteConnectFailureException

server端的web.xml

<servlet>
    <servlet-name>remote</servlet-name>
    <!-- 使用Spring的代理Servlet -->
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:spring-context.xml,
            classpath:spring-hibernate.xml,
            classpath:remote-servlet.xml
        </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>remote</servlet-name>
    <url-pattern>/remote/*</url-pattern>
</servlet-mapping>

remote-servlet.xml

<bean name="/curd" class="org.springframework.remoting.caucho.HessianServiceExporter">
    <!-- service引用具体的实现-->
    <property name="service" ref="dbLogicImpl" />
    <property name="serviceInterface" value="com.csair.prcmapp.interfaces.DbLogic" />
</bean>

remote-client.xml

<bean id="dbLogic" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
    <!-- 请求代理Servlet路径 -->
    <property name="serviceUrl">
        <value>${remote.hessian.url}/curd</value>
    </property>
    <!-- 接口定义 -->
    <property name="serviceInterface">
        <value>com.csair.prcmapp.interfaces.DbLogic</value>
    </property>
    <property name="proxyFactory" ref="hessianProxyFactory" />
</bean>

在使用hessian中遇到初次启动服务端和客户端的时候连接交互没有问题,服务器半小时左右不动不访问之后,再进行访问的时候首次连接时间很长,设置超时之后就报Caused by: org.springframework.remoting.RemoteConnectFailureException: Cannot connect to Hessian remote service at [http://127.0.0.1:8080/remote/curd]; nested exception is com.caucho.hessian.client.HessianConnectionException: 500: java.net.SocketTimeoutException: Read timed out.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 把Excel导入MATLAB显示错误怎么解决?
    • ¥15 Java中消息和缓存如何使用
    • ¥50 易语言把MYSQL数据库中的数据添加至组合框
    • ¥20 求数据集和代码#有偿答复
    • ¥15 关于下拉菜单选项关联的问题
    • ¥20 java-OJ-健康体检
    • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
    • ¥15 使用phpstudy在云服务器上搭建个人网站
    • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
    • ¥15 vue3+express部署到nginx