odyssey045
2011-06-09 17:24:46 UTC
Hi,
I saw many users complain about a similar error with WSDL based CXF apps but
none for REST based apps and hence this question..
I am trying to get started with a simple REST based CXF and spring app. I
followed a demo and created a simple service called "categoryService" which
lists some categories and books in each category.
My beans.xml looks something like this:'
<?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"
xmlns:cxf="http://cxf.apache.org/core"
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
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="categoryService" address="/">
<jaxrs:features>
<cxf:logging/>
</jaxrs:features>
<jaxrs:serviceBeans>
<ref bean="categoryServiceBean" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="categoryServiceBean"
class="com.demo.cxf.server.CategoryService"/>
</beans>
And my jaxrs.xml used by spring looks something like tis:
<?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="categoryService" class="com.demo.cxf.server.CategoryService">
<property name="categoryDAO">
<ref bean="categoryDAO"/>
</property>
</bean>
<bean id="categoryDAO" class="com.demo.cxf.dao.CategoryDao"></bean>
</beans>
Finally my web.xml looks something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!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
WEB-INF/jaxrs.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>/*</url-pattern>
</servlet-mapping>
</web-app>
Is there something that i am missing over here besides the configuration
files?? When i deploy my war into tomcat 7, i get the following message:
eBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'categoryService': replacing
[Generic
bean: class
[org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$
SpringJAXRSServerFactoryBean]; scope=; abstract=false; lazyInit=false;
autowireM
ode=0; dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName
=null; factoryMethodName=null; initMethodName=create;
destroyMethodName=null] wi
th [Generic bean: class [com.demo.cxf.server.CategoryService]; scope=;
abstract
=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
autowireCandidate=tru
e; primary=false; factoryBeanName=null; factoryMethodName=null;
initMethodName=n
ull; destroyMethodName=null; defined in ServletContext resource
[/WEB-INF/jaxrs.
xml]]
But when i try to access, something like
http://localhost:8080/jaxws/categoryservice/category/001
Tomcat just says back to me
WARNING: Can't find the the request for
http://localhost:8080/jaxws/categoryserv
ice/category/001's Observer
--
View this message in context: http://cxf.547215.n5.nabble.com/REST-app-with-CXF-2-4-gives-Can-t-find-request-for-observer-error-tp4473536p4473536.html
Sent from the cxf-user mailing list archive at Nabble.com.
I saw many users complain about a similar error with WSDL based CXF apps but
none for REST based apps and hence this question..
I am trying to get started with a simple REST based CXF and spring app. I
followed a demo and created a simple service called "categoryService" which
lists some categories and books in each category.
My beans.xml looks something like this:'
<?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"
xmlns:cxf="http://cxf.apache.org/core"
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
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="categoryService" address="/">
<jaxrs:features>
<cxf:logging/>
</jaxrs:features>
<jaxrs:serviceBeans>
<ref bean="categoryServiceBean" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="categoryServiceBean"
class="com.demo.cxf.server.CategoryService"/>
</beans>
And my jaxrs.xml used by spring looks something like tis:
<?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="categoryService" class="com.demo.cxf.server.CategoryService">
<property name="categoryDAO">
<ref bean="categoryDAO"/>
</property>
</bean>
<bean id="categoryDAO" class="com.demo.cxf.dao.CategoryDao"></bean>
</beans>
Finally my web.xml looks something like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!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
WEB-INF/jaxrs.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>/*</url-pattern>
</servlet-mapping>
</web-app>
Is there something that i am missing over here besides the configuration
files?? When i deploy my war into tomcat 7, i get the following message:
eBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'categoryService': replacing
[Generic
bean: class
[org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser$
SpringJAXRSServerFactoryBean]; scope=; abstract=false; lazyInit=false;
autowireM
ode=0; dependencyCheck=0; autowireCandidate=true; primary=false;
factoryBeanName
=null; factoryMethodName=null; initMethodName=create;
destroyMethodName=null] wi
th [Generic bean: class [com.demo.cxf.server.CategoryService]; scope=;
abstract
=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
autowireCandidate=tru
e; primary=false; factoryBeanName=null; factoryMethodName=null;
initMethodName=n
ull; destroyMethodName=null; defined in ServletContext resource
[/WEB-INF/jaxrs.
xml]]
But when i try to access, something like
http://localhost:8080/jaxws/categoryservice/category/001
Tomcat just says back to me
WARNING: Can't find the the request for
http://localhost:8080/jaxws/categoryserv
ice/category/001's Observer
--
View this message in context: http://cxf.547215.n5.nabble.com/REST-app-with-CXF-2-4-gives-Can-t-find-request-for-observer-error-tp4473536p4473536.html
Sent from the cxf-user mailing list archive at Nabble.com.