Ok, can't figure this one out at all!
I'm using Spring 3.1.1 and Hessian 4.0.7 deploying into Tomcat 6.0.29
I've created a simple Hessian remote interface but my test keeps failing with;
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
My interface is;
public interface QCClientRemoteService {
public String testConnection(String param);
}
My impl is;
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>
And the web-app-config.xml you see there contains (by way of an import from another 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>
And finally, once thats deployed into tomcat (starts with no errors or warnings) I'm calling all that from a main method in another test app with;
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"));
Any ideas why this won't work? Very frustrating! The following guy seems to have had the same issue but no answer from Caucho; http://forum.caucho.com/showthread.php?t=14906
The testapp is definitely reaching the webapp server as if I munge the url then the testapp complains of a bad url. However there are no logs or warnings or even debugs logged from the server at all. The 500 gets thrown out somewhere before the actual Impl!?
The kicker of it all is that the same code above, integrated into an older server we have running on Spring 2.0.5 works just fine with Burlap 2.1.12
The issue was that I had a spring-remoting 2.0.8 lib included and this was conflicting (silently) somewhere. Removing this immediately resolved the issue for me.
Just to be explicit the above config and test code works perfectly when I have the following libs (note I assume not all of them are required for Hessian/Spring solution, they are in my project for other uses but I've listed here for completeness);