使用Hessian 4.0.7和Spring 3.1.1时出现HessianConnectionException:(HTTP)500错误

好吧,根本无法想象这一个!

我正在使用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包含;

  remoting org.springframework.web.servlet.DispatcherServlet  contextConfigLocation /WEB-INF/config/web-app-config.xml  2   remoting /remote/*  

你在那里看到的web-app-config.xml包含(通过从另一个xml导入的方式);

        

最后,一旦将它部署到tomcat(没有错误或警告开始),我将从另一个测试应用程序中的main方法调用所有这些;

 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。 但是,根本没有从服务器记录的日志或警告甚至调试。 在实际的Impl之前,500被扔到了某个地方!?

这一切的关键是,上面相同的代码,集成到我们在Spring 2.0.5上运行的旧服务器上,与Burlap 2.1.12一起工作正常

问题是我有一个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 

我的解决方案(在尝试各种版本的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软件包一起使用。