Announcement Announcement Module
Collapse
No announcement yet.
Hessian FileNotFoundException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hessian FileNotFoundException

    Hi,

    I followed the example given on the documentation page here:
    http://static.springframework.org/sp.../remoting.html in an attempt to create a Hessian service. I then exported it as a WAR using Eclipse and deployed to Tomcat.

    Unfortunately, I have not been able to get it to work correctly. When I attempt to connect with a client program I get the following exception message:

    Code:
    Exception in thread "main" org.springframework.remoting.RemoteAccessException: Cannot access Hessian
     remote service at [http://localhost:8080/remoting/MyService]; nested exception is com.caucho.hessia
    n.client.HessianRuntimeException: java.io.FileNotFoundException: http://localhost:8080/remoting/MySe
    rvice
    Caused by: com.caucho.hessian.client.HessianRuntimeException: java.io.FileNotFoundException: http://
    localhost:8080/remoting/MyService
    	at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java)
    	at $Proxy0.storeTree(Unknown Source)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.jav
    a:164)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.
    java:166)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy1.storeTree(Unknown Source)
    	at hessiantest.client.Client.performAction(Client.java:18)
    	at hessiantest.client.Client.performAction(Client.java:1)
    	at speedtest.Tester.run(Tester.java:37)
    	at speedtest.tt.TesterTester.test(TesterTester.java:28)
    	at hessiantest.TestTheTester.main(TestTheTester.java:11)
    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" 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">
    	<display-name>remoting</display-name>
    	<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>
    remoting-servlet.xml (servlet spring config)

    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"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    	<bean id="myService" class="hessian.service.MyServiceImpl">
    	</bean>
    
    	<bean name="/remoting/MyService"
    		class="org.springframework.remoting.caucho.HessianServiceExporter" lazy-init="false">
    		<property name="service" ref="myService" />
    		<property name="serviceInterface" value="hessiantest.MyService" />
    	</bean>
    </beans>
    client.xml (client program spring config)

    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"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    	<bean id="client" class="hessiantest.client.Client">
    		<property name="myService" ref="myService" />
    	</bean>
    
    	<bean id="myService"
    		class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
    		<property name="serviceUrl"
    			value="http://localhost:8080/remoting/MyService" />
    		<property name="serviceInterface" value="hessiantest.MyService" />
    	</bean>
    </beans>
    I am unable to determine what I am doing wrong.

    Thank you for your consideration.

  • #2
    in remoting-servlet.xml, change the bean name to "/MyService" and see if that works. You are specifying the webapp name in the url mapping, which is incorrect.

    Comment


    • #3
      I changed
      Code:
      <bean name="/remoting/MyService"
      to
      Code:
      <bean name="/MyService"
      but unfortunately the exception occurred again.

      Comment


      • #4
        What is the context root of your application? On tomcat, this will be the name of your war, and you can see it in the manager at

        http://localhost:8080

        I am guessing that you are missing an app name on the client's service URL; something like:

        http://localhost:8080/myApp/remoting/MyService

        Comment


        • #5
          I use remoting.war, so my context root is "remoting" (the only purpose of the application is to provide the service).

          So it should be http://localhost:8080/remoting/MyService

          Comment


          • #6
            since you used remoting.war, tomcat will create an app root at /remoting. Your use of the spring dispatcher servlet recognizes /remoting/* requests on your application, which means in your case, anything hitting http://localhost:8080/remoting/remoting/*. Your correct client URL will then be http://localhost:8080/remoting/remoting/MyService. You can make this a little nicer by either using the ROOT.war to put your app at the tomcat root '/' or changing your servlet-mapping to something like *.spring or *.service, then you could have http://localhost:8080/remoting/MyService.service.

            Comment


            • #7
              That was it. Thanks for your help!

              Comment

              Working...
              X