cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Mihalick" <jas...@hotmail.com>
Subject Re: Trouble with creating RESTful Service deployed to Jetty - need help!
Date Thu, 12 Jul 2007 17:14:27 GMT
Thanks for the quick response.  HEre is the stack trace.  I don't see a 
"Mapping method" statement.

[INFO] Started Jetty Server
Jul 12, 2007 12:33:32 PM org.apache.cxf.interceptor.AttachmentInInterceptor 
handleMessage
INFO: AttachmentInInterceptor skipped in HTTP GET method
Jul 12, 2007 12:33:32 PM 
org.apache.cxf.binding.http.interceptor.DispatchInterceptor handleMessage
INFO: Invoking GET on /10
Jul 12, 2007 12:33:32 PM org.apache.cxf.phase.PhaseInterceptorChain 
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Invalid URL/Verb combination. Verb: GET 
Path: /10
        at 
org.apache.cxf.binding.http.interceptor.DispatchInterceptor.handleMessage(DispatchInterceptor.java:76)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206)
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:67)
        at 
org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:100)
        at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:224)
        at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:103)
        at 
org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261)
        at 
org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:243)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
        at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
        at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:406)
        at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
        at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
        at org.mortbay.jetty.Server.handle(Server.java:295)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
        at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:361)
        at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)


>From: "Dan Diephouse" <dan@envoisolutions.com>
>Reply-To: cxf-user@incubator.apache.org
>To: cxf-user@incubator.apache.org
>Subject: Re: Trouble with creating RESTful Service deployed to Jetty - need 
>help!
>Date: Thu, 12 Jul 2007 10:56:08 -0600
>
>Hi Jason,
>
>Everything looks roughly correct. Can you paste the log output? You should
>some output from this line of code:
>
>LOG.info("Mapping method " + name + " to resource " + resource + " and verb
>" + verb);
>
>Which should help clarify whats going on...
>
>- Dan
>
>On 7/12/07, Jason Mihalick <jasbo1@hotmail.com> wrote:
>>
>>Hello,
>>
>>For the life of me I can't seem to get a simple RESTful webservice to work
>>when I deploy it to Jetty (I haven't tried any other containers).  I
>>assume
>>that I am correct in using the CFXServlet to handle requests and route
>>them
>>to the service implementation?  iat-services is the name of my webapp
>>context.
>>
>>When I try to do a GET on this URL (just using a web browser):
>>http://localhost:8080/iat-services/ws/
>>
>>I get this output: {http://services.iat.jcol.com/}ClientServiceImplPort
>>
>>That looks fine, I think.
>>
>>Now, when I try to invoke my "client" service, with this url:
>>http://localhost:8080/iat-services/ws/client/10
>>
>>I get this output: Invalid URL/Verb combination. Verb: GET Path: /10
>>
>>If I try: http://localhost:8080/iat-services/ws/client/client/10
>>
>>I get this output: Invalid URL/Verb combination. Verb: GET Path:
>>/client/10
>>
>>What am I doing wrong here?  My classes and config are below.  I can post
>>a
>>stack trace if you think it will help.
>>
>>==================
>>Service interface:
>>==================
>>package com.jcol.iat.services;
>>
>>import java.util.Collection;
>>
>>import javax.jws.WebService;
>>
>>import org.codehaus.jra.Delete;
>>import org.codehaus.jra.Get;
>>import org.codehaus.jra.HttpResource;
>>import org.codehaus.jra.Post;
>>import org.codehaus.jra.Put;
>>
>>
>>@WebService
>>public interface ClientService {
>>
>>   public Collection<Client> getClients();
>>
>>   public Client getClient( long id );
>>   public void addClient( Client client );
>>
>>   public void updateClient( long id, Client client);
>>
>>   public void deleteClient( long id );
>>
>>}
>>
>>
>>=============
>>Service Impl:
>>=============
>>package com.jcol.iat.services;
>>
>>import java.util.ArrayList;
>>import java.util.Collection;
>>
>>import javax.jws.WebService;
>>
>>@WebService(endpointInterface = "com.jcol.iat.services.ClientService")
>>public class ClientServiceImpl implements ClientService {
>>
>>   public ClientServiceImpl() {
>>
>>   }
>>
>>   public Collection<Client> getClients() {
>>     System.out.println( "getClients invoked" );
>>     return new ArrayList<Client>();
>>     // FIXME
>>   }
>>
>>   public Client getClient( long id ) {
>>     System.out.println( "getClient invoked" );
>>     // FIXME
>>     return new Client();
>>   }
>>
>>   public void addClient( Client client ) {
>>     System.out.println( "addClient invoked" );
>>     //FIXME
>>   }
>>
>>   public void updateClient( long id, Client client) {
>>     System.out.println( "updateClient invoked" );
>>     //FIXME
>>   }
>>
>>   public void deleteClient( long id ) {
>>     System.out.println( "deleteClient invoked" );
>>     //FIXME
>>   }
>>
>>}
>>
>>=========
>>beans.xml
>>=========
>><beans xmlns="http://www.springframework.org/schema/beans"
>>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>              xmlns:jaxws="http://cxf.apache.org/jaxws"
>>        xsi:schemaLocation="http://www.springframework.org/schema/beans
>>http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>                            http://cxf.apache.org/jaxws
>>file:///Applications/Java/toolkits/apache-cxf/apache-cxf-2.0-incubator-src
>>/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd"
>> >
>><!-- Fix the jaxws schemaLocation above -->
>>
>><!--
>>
>>              xsi:schemaLocation="
>>http://www.springframework.org/schema/beans
>>http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>                                  http://cxf.apache.org/jaxws
>>http://cxf.apache.org/schemas/jaxws.xsd"
>>
>>     -->
>>         <import resource="classpath:META-INF/cxf/cxf.xml" />
>>         <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>>/>
>>         <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>>         <import resource="classpath:META-INF/cxf/cxf-
>>extension-http-binding.xml" />
>>
>>   <bean id="JaxWsServiceFactoryBean"
>>class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>>     <property name="wrapped" value="false"/>
>>   </bean>
>>
>>   <jaxws:endpoint id="restfulServer"
>>               implementor="com.jcol.iat.services.ClientServiceImpl"
>>               address="/client"
>>               bindingUri="http://apache.org/cxf/binding/http">
>>      <jaxws:serviceFactory>
>>          <ref bean="JaxWsServiceFactoryBean"/>
>>      </jaxws:serviceFactory>
>>   </jaxws:endpoint>
>></beans>
>>
>>=======
>>web.xml
>>=======
>><!DOCTYPE web-app PUBLIC
>>"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>"http://java.sun.com/dtd/web-app_2_3.dtd" >
>>
>><web-app>
>>         <context-param>
>>                 <param-name>contextConfigLocation</param-name>
>>                 <param-value>WEB-INF/beans.xml</param-value>
>>         </context-param>
>>
>>         <listener>
>>                 <listener-class>
>>
>>org.springframework.web.context.ContextLoaderListener
>>                 </listener-class>
>>         </listener>
>>
>>         <servlet>
>>                 <servlet-name>CXFServlet</servlet-name>
>>                 <display-name>CXF Servlet</display-name>
>>                 <servlet-class>
>>                         org.apache.cxf.transport.servlet.CXFServlet
>>                 </servlet-class>
>>                 <load-on-startup>1</load-on-startup>
>>         </servlet>
>>
>>         <servlet-mapping>
>>                 <servlet-name>CXFServlet</servlet-name>
>>                 <url-pattern>/ws/*</url-pattern>
>>         </servlet-mapping>
>></web-app>
>>
>>Thanks,
>>Jason
>>
>>
>>
>
>
>--
>Dan Diephouse
>Envoi Solutions
>http://envoisolutions.com | http://netzooid.com/blog



Mime
View raw message