Announcement Announcement Module
Collapse
No announcement yet.
A (not) working Hessian example Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • A (not) working Hessian example

    Hi
    I use hessian 3.2.0 with spring 2.5.6
    I have followed the example given in http://static.springframework.org/sp.../remoting.html

    Also I have looked at a similar post that did not help me at:
    http://forum.springsource.org/showth...foundexception

    but got an exception:
    Code:
    Caused by: com.caucho.hessian.client.HessianRuntimeException: java.io.FileNotFoundException: http://localhost:8080/remoting/myBean
    	at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java)
    	at $Proxy0.doSomething(Unknown Source)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:219)
    I use jetty (but the same happens on tomcat). I run jetty using the maven plugin and it is configured with contextPath="/". (You may see this in the attached project in pom.xml)

    My server side applicationContext.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schem...ontext-2.5.xsd
    	"
    	default-autowire="no">
    
    	<bean id="myBean" class="pg.MyBeanImpl"/>
    
    </beans>
    remoting-servlet.xml:
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context" 
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    	"
    	>
    
    	<!-- Hessian is a slim binary HTTP remoting protocol -->
    	<bean name="/myBean" class="org.springframework.remoting.caucho.HessianServiceExporter"> 
    		<property name="service" ref="myBean" />
    		<property name="serviceInterface" value="pg.MyBean" />
    	</bean>
    
    </beans>
    web.xml:
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    
    	<display-name>Valire</display-name>
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			classpath:applicationContext.xml
    		</param-value>
    	</context-param>
    
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<servlet>
    		<servlet-name>remoting</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>remoting</servlet-name>
    		<url-pattern>/remoting/*</url-pattern>
    	</servlet-mapping>
    
    </web-app>

    Client context:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
    		http://www.springframework.org/schema/tx
        	http://www.springframework.org/schema/tx/spring-tx.xsd
    	"
    	default-autowire="no">
    
    	<bean id="myBean" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
    		<property name="serviceUrl" value="http://localhost:8080/remoting/myBean" />
    		<property name="serviceInterface" value="pg.MyBean" />
    	</bean>
    
    </beans>
    I attach the entire maven proj.
    if you load the proj and want to repeat what I have seen - run mvn jetty:run
    and then run RemoteClient.java from your favorite IDE.

    Thanks a bunch for any help.
Working...
X