4

わかりました、これはまったくわかりません!

Spring 3.1.1 と Hessian 4.0.7 を使用して Tomcat 6.0.29 にデプロイしています

簡単な Hessian リモート インターフェイスを作成しましたが、テストが失敗し続けます。

Exception in thread "main" com.caucho.hessian.client.HessianConnectionException: 500: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/client/remote/RemoteService
    at com.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:142)
    at com.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:283)
    at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:170)
    at $Proxy0.testConnection(Unknown Source)
    at com.qualificationcheck.testserver.TestServer.main(TestServer.java:15)
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/client/remote/remoteservice
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:122)
    ... 4 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/client/remote/RemoteService
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at com.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:109)
    ... 4 more

私のインターフェースは;

public interface QCClientRemoteService {
    public String testConnection(String param);
}

私の実装は;

public class QCClientRemoteServiceImpl implements QCClientRemoteService {
    public String testConnection(String param) {
        return "Recieved param of >" + param + "< successfully.";
    }
}

web.xml には次が含まれます。

<servlet>
    <servlet-name>remoting</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/config/web-app-config.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>remoting</servlet-name>
    <url-pattern>/remote/*</url-pattern>
</servlet-mapping>

そこに表示される web-app-config.xml には、(別の xml からのインポートによる); が含まれています。

<bean id="remoteService" class="com.example.QCClientRemoteServiceImpl">
    <!-- any additional properties, maybe a DAO? -->
</bean>

<bean name="/RemoteService" class="org.springframework.remoting.caucho.HessianServiceExporter">
    <property name="service" ref="remoteService"/>
    <property name="serviceInterface" value="com.example.QCClientRemoteService"/>
</bean>

最後に、それが tomcat にデプロイされると (エラーや警告なしで開始されます)、別のテスト アプリのメイン メソッドからすべてを呼び出しています。

String url = "http://localhost:8080/client/remote/RemoteService";

HessianProxyFactory factory = new HessianProxyFactory();
QCClientRemoteService basic = (QCClientRemoteService) factory.create(QCClientRemoteService.class, url);

System.out.println(basic.testConnection("Input 123"));

これがうまくいかない理由はありますか?非常にイライラします!次の男は同じ問題を抱えているようですが、Caucho からの回答はありません。 http://forum.caucho.com/showthread.php?t=14906

testapp は間違いなく webapp サーバーに到達しており、まるで URL を変更したかのように、testapp が悪い URL を訴えます。ただし、ログや警告はなく、サーバーからログに記録されたデバッグもまったくありません。500 は、実際の Impl の前にどこかに投げ出されます!?

すべてのキッカーは、Spring 2.0.5 で実行している古いサーバーに統合された上記の同じコードが、Burlap 2.1.12 で問題なく動作することです。

4

2 に答える 2

4

問題は、Spring-Remoting 2.0.8 lib が含まれていて、これがどこかで (静かに) 競合していたことです。これを削除すると、すぐに問題が解決しました。

明確にするために、上記の構成とテストコードは、次のライブラリがある場合に完全に機能します (これらのすべてが Hessian/Spring ソリューションに必要であるとは限らないことに注意してください。それらは他の用途のためにプロジェクトに含まれていますが、完全を期すためにここにリストしました);

spring-core-3.1.1.RELEASE
spring-asm-3.1.1.RELEASE
spring-web-3.1.1.RELEASE
spring-beans-3.1.1.RELEASE
spring-context-3.1.1.RELEASE
spring-aop-3.1.1.RELEASE
spring-webmvc-3.1.1.RELEASE
spring-context-support-3.1.1.RELEASE
spring-expression-3.1.1.RELEASE
hessian-4.0.7
于 2012-05-15T07:46:08.040 に答える
2

私の解決策(さまざまなバージョンの Hessian を試した後)は、次を使用することでした。

org.springframework spring-remoting 2.0.8
org.springframework spring-webmvc/orm/(whatever) 3.1.1.RELEASE
com.caucho hessian 3.0.8

これらをMavenプロジェクトで使用しているため、これらは私が使用している正確なバージョンであり、問​​題は解消されました。それは間違いなくSpring 3.1.1のバージョンのようです。

価値のあるものとして、私はこれを Eclipse RCP アプリケーションで使用しており、Eclipse RCP Hessian バンドルで動作します。

于 2012-05-14T17:53:40.150 に答える