Hello I'm trying to access a REST service configured using Spring configuration file. When I access the URL - http://localhost:8080/cxftest/myService/customer/1, it fails with following error.
WARNING: No root resource matching request path /myService/customer/1 has been found. Dec 23, 2011 9:46:35 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse WARNING: WebApplicationException has been caught : no cause is available Also when I tried to acces the home page within Spring Tool Suite (STS), it gives me following error: WARNING: No root resource matching request path / has been found. Dec 23, 2011 9:55:05 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse WARNING: WebApplicationException has been caught : no cause is available My Spring application_context.xml ======================= <?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:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd" default-lazy-init="false"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <jaxrs:server id="myService" address="/"> <jaxrs:serviceBeans> <ref bean="serviceImpl" /> </jaxrs:serviceBeans> <jaxrs:extensionMappings> <entry key="xml" value="application/xml" /> </jaxrs:extensionMappings> </jaxrs:server> <bean id="serviceImpl" class="services.ServiceImpl" /> </beans> Web.xml ============================================== <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>cxftest</display-name> <description>CXF REST Example</description> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>webAppRootKey</param-name> <param-value>cxf.rest.example.root</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/application-context.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>CXFServlet</servlet-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>/*</url-pattern> </servlet-mapping> </web-app> ServiceImpl.java ===================================== package services; import java.io.IOException; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import model.Customer; import org.codehaus.jackson.map.ObjectMapper; @Path("/customer/{id}") @Produces("application/json") public class ServiceImpl { @GET public String getCustomer( @PathParam("id") final String customerId) throws IOException { Customer customer = new Customer(); customer.setName("customer1"); return javaToJSON(customer); } private String javaToJSON(final Object object) throws IOException { ObjectMapper mapper = null; mapper = new ObjectMapper(); return mapper.writeValueAsString(object); } } Thanks for the help Prakash -- View this message in context: http://cxf.547215.n5.nabble.com/Newbie-Question-WARNING-No-root-resource-matching-request-path-has-been-found-tp5098573p5098573.html Sent from the cxf-user mailing list archive at Nabble.com.
