You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Robert Parker <ro...@yahoo.com> on 2011/05/27 19:33:40 UTC

jaxrs namespace and associated hander

I am using maven to set up a simple REST webservice and deploying it to tomcat.  Unfortunately I am not well versed in spring (enough to be dangerous), and I can not get a NamespaceHandler for the jaxrs namespace.  Unfortunately there is no mention of the jaxrs namespace on this page http://cxf.apache.org/docs/schemas-and-namespaces.html.  I suspect my spring.handlers is incorrected based on this error:

ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myRestService]- Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxrs]

Any guidance with respect to locating the correct NamespaceHandler or modification to the beans.xml is greatly appreciated.

Thanks,

Rob


pom.xml :

  <dependency>

  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-rt-frontend-jaxrs</artifactId>
  <version>2.4.0</version>
  <type>pom</type>
  </dependency>



The beans.xml I have copied from http://cxf.apache.org/docs/jaxrs-services-configuration.html:

<?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">

  <!-- do not use import statements if CXFServlet init parameters link to this beans.xml --> 

  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <!--import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /  COMMENTED OUT because it does not exist-->
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

  <jaxrs:server id="myRestService" address="/">
    <jaxrs:serviceBeans>
      <ref bean="RestResource" />
    </jaxrs:serviceBeans>
  </jaxrs:server>

  <bean id="RestResource" class="org.rob.RestResource" />
</beans>

spring.handlers content:

http\://cxf.apache.org/jaxrs=org.apache.cxf.jaxrs.spring.NamespaceHandler


spring.schemas content:


http\://cxf.apache.org/schemas/jaxrs.xsd=schemas/jaxrs.xsd 

Re: jaxrs namespace and associated hander

Posted by Robert Parker <ro...@yahoo.com>.
Thanks Sergey, that was it.

rob



________________________________
From: Sergey Beryozkin <sb...@gmail.com>
To: users@cxf.apache.org; Robert Parker <ro...@yahoo.com>
Sent: Friday, May 27, 2011 3:40 PM
Subject: Re: jaxrs namespace and associated hander

HI

I'm wondering, is it to do with the fact you specify a
<type>pom</type> in the dependency declaration ?
Can you try without it please

thanks, Sergey

On Fri, May 27, 2011 at 6:33 PM, Robert Parker <ro...@yahoo.com> wrote:
> I am using maven to set up a simple REST webservice and deploying it to tomcat.  Unfortunately I am not well versed in spring (enough to be dangerous), and I can not get a NamespaceHandler for the jaxrs namespace.  Unfortunately there is no mention of the jaxrs namespace on this page http://cxf.apache.org/docs/schemas-and-namespaces.html.  I suspect my spring.handlers is incorrected based on this error:
>
> ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myRestService]- Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxrs]
>
> Any guidance with respect to locating the correct NamespaceHandler or modification to the beans.xml is greatly appreciated.
>
> Thanks,
>
> Rob
>
>
> pom.xml :
>
>   <dependency>
>
>   <groupId>org.apache.cxf</groupId>
>   <artifactId>cxf-rt-frontend-jaxrs</artifactId>
>   <version>2.4.0</version>
>   <type>pom</type>
>   </dependency>
>
>
>
> The beans.xml I have copied from http://cxf.apache.org/docs/jaxrs-services-configuration.html:
>
> <?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">
>
>   <!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->
>
>   <import resource="classpath:META-INF/cxf/cxf.xml" />
>   <!--import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /  COMMENTED OUT because it does not exist-->
>   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>   <jaxrs:server id="myRestService" address="/">
>     <jaxrs:serviceBeans>
>       <ref bean="RestResource" />
>     </jaxrs:serviceBeans>
>   </jaxrs:server>
>
>   <bean id="RestResource" class="org.rob.RestResource" />
> </beans>
>
> spring.handlers content:
>
> http\://cxf.apache.org/jaxrs=org.apache.cxf.jaxrs.spring.NamespaceHandler
>
>
> spring.schemas content:
>
>
> http\://cxf.apache.org/schemas/jaxrs.xsd=schemas/jaxrs.xsd
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com

Re: jaxrs namespace and associated hander

Posted by Sergey Beryozkin <sb...@gmail.com>.
HI

I'm wondering, is it to do with the fact you specify a
<type>pom</type> in the dependency declaration ?
Can you try without it please

thanks, Sergey

On Fri, May 27, 2011 at 6:33 PM, Robert Parker <ro...@yahoo.com> wrote:
> I am using maven to set up a simple REST webservice and deploying it to tomcat.  Unfortunately I am not well versed in spring (enough to be dangerous), and I can not get a NamespaceHandler for the jaxrs namespace.  Unfortunately there is no mention of the jaxrs namespace on this page http://cxf.apache.org/docs/schemas-and-namespaces.html.  I suspect my spring.handlers is incorrected based on this error:
>
> ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myRestService]- Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxrs]
>
> Any guidance with respect to locating the correct NamespaceHandler or modification to the beans.xml is greatly appreciated.
>
> Thanks,
>
> Rob
>
>
> pom.xml :
>
>   <dependency>
>
>   <groupId>org.apache.cxf</groupId>
>   <artifactId>cxf-rt-frontend-jaxrs</artifactId>
>   <version>2.4.0</version>
>   <type>pom</type>
>   </dependency>
>
>
>
> The beans.xml I have copied from http://cxf.apache.org/docs/jaxrs-services-configuration.html:
>
> <?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">
>
>   <!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->
>
>   <import resource="classpath:META-INF/cxf/cxf.xml" />
>   <!--import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /  COMMENTED OUT because it does not exist-->
>   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>   <jaxrs:server id="myRestService" address="/">
>     <jaxrs:serviceBeans>
>       <ref bean="RestResource" />
>     </jaxrs:serviceBeans>
>   </jaxrs:server>
>
>   <bean id="RestResource" class="org.rob.RestResource" />
> </beans>
>
> spring.handlers content:
>
> http\://cxf.apache.org/jaxrs=org.apache.cxf.jaxrs.spring.NamespaceHandler
>
>
> spring.schemas content:
>
>
> http\://cxf.apache.org/schemas/jaxrs.xsd=schemas/jaxrs.xsd
>



-- 
Sergey Beryozkin

Application Integration Division of Talend
http://sberyozkin.blogspot.com