Results 1 to 4 of 4

Thread: Problems getting HttpInvoker to work

  1. #1
    Join Date
    Sep 2004
    Posts
    2

    Default Problems getting HttpInvoker to work

    I've been reading about the new HttpInvoker and thought I'd give it a try. I ran the example in jpetstore and decided to implement my own. To demonstrate the concept to others I've pared things down to the absolute minimum and I just cannot get it to work.

    Tomcat shows the request coming in but the client reports :-

    Exception in thread "main" org.springframework.remoting.RemoteAccessException : Cannot access HTTP invoker remote service at [http://192.168.254.205:8080/camserv/request]; nested exception is java.io.FileNotFoundException: http://192.168.254.205:8080/camserv/request
    My application is very simple :-

    Code:
    package webservice;
    public interface IRequestServer {
    	public String ping( );
    }
    
    package webservice;
    public class RequestServer implements IRequestServer {
    	public String ping( ) {
    		return "pong";
    	}
    }
    
    public class PingClient {
    	public static void main( String[] args ) throws	Exception {
    		ApplicationContext ctx = new FileSystemXmlApplicationContext( 
    								"RequestClient.xml" );
    		IRequestServer req = (IRequestServer) ctx.getBean( "ping" );
    		System.out.println( "Ping: " + req.ping( ) );
    	}
    }
    
    <web-app>
    	<servlet>
    		<servlet-name>camserv</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>camserv</servlet-name>
    		<url-pattern>/camserv/*</url-pattern>
    	</servlet-mapping>
    </web-app>
    
    <beans>
    	<bean id="requestService" class="webservice.RequestServer"/>
    	<bean
    		name="/request"
    		class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"
    	>
    		<property name="service"><ref bean="requestService"/></property>
    		<property name="serviceInterface">
    			<value>webservice.IRequestServer</value>
    		</property>
    	</bean>
    </beans>
    
    <beans>
    	<bean
    		id="ping"
    		class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"
    	>
    		<property name="serviceUrl">
    			<value>http&#58;//192.168.254.205&#58;8080/camserv/request</value>
    		</property>
    		<property name="serviceInterface">
    			<value>webservice.IRequestServer</value>
    		</property>
    	</bean>
    </beans>
    I'm sure it's something simple but I can't for the life of me spot what it is. Any ideas?

  2. #2

    Default

    It looks pretty good from what you've posted. I would make sure that your config file is being read into the camserv servlet dispatcher. I couldn't tell from looking at your posting.

    I think it needs to be in a file called camserv-config.xml, since you don't explicitly load the context.

    Regards
    Steve

  3. #3
    Join Date
    Sep 2004
    Posts
    2

    Default Problem sorted

    I confused myself. In the sample application the application is rooted at jpetstore, the servlet at remoting and the service at something else. By calling my application the same name as the servlet I forgot to add the extra component in the pathname. When I did this it worked!

  4. #4
    Join Date
    Nov 2004
    Posts
    16

    Default

    yes,need add

    Code:
    	<servlet>
    		<servlet-name>remoting</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>4</load-on-startup>
    	</servlet>
    and

    Code:
    	<servlet-mapping>
    		<servlet-name>remoting</servlet-name>
    		<url-pattern>/remoting/*</url-pattern>
    	</servlet-mapping>
    in web.xml,i was confused by this wholely night.

Similar Threads

  1. HttpInvoker and streaming
    By adepue in forum Remoting
    Replies: 7
    Last Post: Jun 7th, 2010, 10:39 PM
  2. Replies: 7
    Last Post: Jun 1st, 2006, 12:27 PM
  3. Replies: 1
    Last Post: May 15th, 2005, 12:51 AM
  4. Replies: 1
    Last Post: Nov 29th, 2004, 09:58 AM
  5. Spring can't work on Eclipse
    By ryanhowai in forum Architecture
    Replies: 1
    Last Post: Nov 9th, 2004, 06:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •