好吧,根本無法解決這個問題!HessianConnectionException:使用Hessian 4.0.7和Spring時出現(HTTP)500錯誤3.1.1
我使用Spring 3.1.1和4.0.7的Hessian部署到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);
}
我的impl是;
public class QCClientRemoteServiceImpl implements QCClientRemoteService {
public String testConnection(String param) {
return "Recieved param of >" + param + "< successfully.";
}
}
web.xml contains;
<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服務器,就好像我闖入了網址,然後testapp抱怨了一個不好的網址。但是,根本沒有日誌或警告,甚至沒有從服務器記錄調試。在實際的Impl之前,500被拋出某個地方!?
這一切的起腳是相同的代碼上面,集成到一個較舊的服務器,我們在春天2.0.5作品只是罰款麻布2.1.12
具有相同的問題,hibernate3.0.8/tomcat6.0.32,但彈簧3.1.1。在Web瀏覽器中訪問端點會給出相應的響應,「HessianServiceExporter只支持POST請求」,但黑客客戶端會給出500錯誤。 – theZenPebble