You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Brad <cf...@javawork.co.uk> on 2008/04/21 17:02:50 UTC

Problem when trying to test JAX-RS service

Hi,

I'm trying to test out the JAX-RS support in cxf-2.0.5 by adapting the
Spring based example at
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html.

My beans.xml file is shown here:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  		xmlns:xsd="http://www.w3.org/2001/XMLSchema"
		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-2.0.xsd
http://cxf.apache.org/jaxrs
C:\workspace\eclipse33\cxf_REST_Web\WebContent\WEB-INF\schema\jaxrs.xsd">
	
	<import resource="cxf.xml" />
  	<import resource="cxf-extension-jaxrs-binding.xml" />
	<import resource="cxf-servlet.xml" />
	
  	<jaxrs:server id="audit" address="/audit">
    	<jaxrs:serviceBeans>
      		<bean class="test.rest.TestImpl"/>
    	</jaxrs:serviceBeans>
  	</jaxrs:server>

</beans>

This gives me the following error:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://cxf.apache.org/jaxrs]

I tried googling this and got one result for something similar which
seemed to be suggesting that I'm missing a JAR file (possibly
comtaining a missing handler class for the given namespace?) Am I on
the right track there?

All help gratefully received.

Thanks,
Brad.

Re: Fwd: Problem when trying to test JAX-RS service

Posted by Daniel Kulp <dk...@apache.org>.
You should probably grab the latest 2.1-SNAPSHOT (note: non-incubator) 
from:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.1-SNAPSHOT/
Note that there are "src" packages in there as well that would directly 
match up the stack traces with their binary packages.

That said, my biggest "question mark" is the line:

org.apache.cxf.transport.ChainInitiationObserver.setExchangeProperties
(ChainInitiationObserver.java:100)

The 2.1 codebase doesn't have any code on line 100.   That kind of 
worries me.


Dan



On Tuesday 22 April 2008, Brad wrote:
> Thanks Sergey, that fixed that problem. Eclipse doesn't like those
>  schema locations but its fine at runtime.
>
>  I'm now getting a NullPointerException when I hit my test service.
> I'm guessing I've misconfigured somewhere?
>
>  By the way, I tried looking into the NPE myself but with my limited
>  experience of this project the only 2.1 code I could find was at
> 
> https://svn.apache.org/repos/asf/incubator/cxf/tags/cxf-2.1-incubator-
>beta-1/. IS that the right place to be looking?
>
>  INFO: Server startup in 2763 ms
>  22-Apr-2008 09:28:16 org.apache.catalina.core.StandardWrapperValve
> invoke SEVERE: Servlet.service() for servlet CXFServlet threw
> exception java.lang.NullPointerException
>         at
> org.apache.cxf.transport.ChainInitiationObserver.setExchangeProperties
>(ChainInitiationObserver.java:100) at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitia
>tionObserver.java:63) at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletD
>estination.java:79) at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(S
>ervletController.java:264) at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletContr
>oller.java:123) at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXF
>Servlet.java:170) at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFS
>ervlet.java:152) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
>cationFilterChain.java:290) at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
>lterChain.java:206) at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
>lve.java:233) at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
>lve.java:175) at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
>va:128) at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
>va:102) at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
>e.java:109) at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
>:286) at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
>844) at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proces
>s(Http11Protocol.java:583) at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447
>) at java.lang.Thread.run(Thread.java:595)
>
>
>
>  On Mon, Apr 21, 2008 at 5:43 PM, Sergey Beryozkin
>
>  <se...@iona.com> wrote:
>  > This entry might be a problem :
>  > > > > http://cxf.apache.org/jaxrs
>  >
>  > C:\workspace\eclipse33\cxf_REST_Web\WebContent\WEB-INF\schema\jaxrs
>  >.xsd">
>  >
>  >
>  >
>  >  There's a spring.schemas file wich matches the
>  > http://cxf.apache.org/schemas/jaxrs.xsd location to the local class
>  > resource schemas/jaxrs.xsd, so please try
>  >
>  >  " http://cxf.apache.org/jaxrs
>  >   http://cxf.apache.org/schemas/jaxrs.xsd">
>  >
>  >  Cheers, Sergey
>  >
>  >  ----------------------------
>  >  IONA Technologies PLC (registered in Ireland)
>  >  Registered Number: 171387
>  >  Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
>  > Ireland



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Fwd: Problem when trying to test JAX-RS service

Posted by Brad <br...@javawork.co.uk>.
Thanks Sergey, that fixed that problem. Eclipse doesn't like those
 schema locations but its fine at runtime.

 I'm now getting a NullPointerException when I hit my test service. I'm
 guessing I've misconfigured somewhere?

 By the way, I tried looking into the NPE myself but with my limited
 experience of this project the only 2.1 code I could find was at
 https://svn.apache.org/repos/asf/incubator/cxf/tags/cxf-2.1-incubator-beta-1/.
 IS that the right place to be looking?

 INFO: Server startup in 2763 ms
 22-Apr-2008 09:28:16 org.apache.catalina.core.StandardWrapperValve invoke
 SEVERE: Servlet.service() for servlet CXFServlet threw exception
 java.lang.NullPointerException
        at org.apache.cxf.transport.ChainInitiationObserver.setExchangeProperties(ChainInitiationObserver.java:100)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:63)
        at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:264)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:123)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:152)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)



 On Mon, Apr 21, 2008 at 5:43 PM, Sergey Beryozkin
 <se...@iona.com> wrote:
 > This entry might be a problem :
 >
 >
 >
 > >
 > > > > http://cxf.apache.org/jaxrs
 > > > >
 > C:\workspace\eclipse33\cxf_REST_Web\WebContent\WEB-INF\schema\jaxrs.xsd">
 > > >
 > >
 >
 >  There's a spring.schemas file wich matches the
 > http://cxf.apache.org/schemas/jaxrs.xsd location to the local class resource
 > schemas/jaxrs.xsd, so please try
 >
 >  " http://cxf.apache.org/jaxrs
 >   http://cxf.apache.org/schemas/jaxrs.xsd">
 >
 >  Cheers, Sergey
 >
 >  ----------------------------
 >  IONA Technologies PLC (registered in Ireland)
 >  Registered Number: 171387
 >  Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
 >

Re: Problem when trying to test JAX-RS service

Posted by Sergey Beryozkin <se...@iona.com>.
This entry might be a problem :

>> > http://cxf.apache.org/jaxrs
>> > C:\workspace\eclipse33\cxf_REST_Web\WebContent\WEB-INF\schema\jaxrs.xsd">

There's a spring.schemas file wich matches the http://cxf.apache.org/schemas/jaxrs.xsd location to the local class resource 
schemas/jaxrs.xsd, so please try
" http://cxf.apache.org/jaxrs
  http://cxf.apache.org/schemas/jaxrs.xsd">

Cheers, Sergey

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Re: Problem when trying to test JAX-RS service

Posted by Brad <br...@javawork.co.uk>.
Arul,

thanks for the pointer.

I have upgraded to the latest snapshot of 2.1 but still get the same issue.

Brad.

On Mon, Apr 21, 2008 at 4:12 PM, Arul Dhesiaseelan <ar...@fluxcorp.com> wrote:
> I think JAX-RS (JSR 311) support is available only in 2.1.
>
>  Brad wrote:
>
> >
> >
> >
> > Hi,
> >
> > I'm trying to test out the JAX-RS support in cxf-2.0.5 by adapting the
> > Spring based example at
> > http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html.
> >
> > My beans.xml file is shown here:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >                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-2.0.xsd
> > http://cxf.apache.org/jaxrs
> > C:\workspace\eclipse33\cxf_REST_Web\WebContent\WEB-INF\schema\jaxrs.xsd">
> >
> >        <import resource="cxf.xml" />
> >        <import resource="cxf-extension-jaxrs-binding.xml" />
> >        <import resource="cxf-servlet.xml" />
> >
> >        <jaxrs:server id="audit" address="/audit">
> >        <jaxrs:serviceBeans>
> >                <bean class="test.rest.TestImpl"/>
> >        </jaxrs:serviceBeans>
> >        </jaxrs:server>
> >
> > </beans>
> >
> > This gives me the following error:
> >
> > org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> > Configuration problem: Unable to locate Spring NamespaceHandler for
> > XML schema namespace [http://cxf.apache.org/jaxrs]
> >
> > I tried googling this and got one result for something similar which
> > seemed to be suggesting that I'm missing a JAR file (possibly
> > comtaining a missing handler class for the given namespace?) Am I on
> > the right track there?
> >
> > All help gratefully received.
> >
> > Thanks,
> > Brad.
> >
> > _________________________________________________
> > Scanned by MessageLabs for the Super Flux Friends
> > _________________________________________________
> >
> >
>
>
>

Re: Problem when trying to test JAX-RS service

Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
I think JAX-RS (JSR 311) support is available only in 2.1.

Brad wrote:
> Hi,
>
> I'm trying to test out the JAX-RS support in cxf-2.0.5 by adapting the
> Spring based example at
> http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html.
>
> My beans.xml file is shown here:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>   		xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> 		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-2.0.xsd
> http://cxf.apache.org/jaxrs
> C:\workspace\eclipse33\cxf_REST_Web\WebContent\WEB-INF\schema\jaxrs.xsd">
> 	
> 	<import resource="cxf.xml" />
>   	<import resource="cxf-extension-jaxrs-binding.xml" />
> 	<import resource="cxf-servlet.xml" />
> 	
>   	<jaxrs:server id="audit" address="/audit">
>     	<jaxrs:serviceBeans>
>       		<bean class="test.rest.TestImpl"/>
>     	</jaxrs:serviceBeans>
>   	</jaxrs:server>
>
> </beans>
>
> This gives me the following error:
>
> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
> Configuration problem: Unable to locate Spring NamespaceHandler for
> XML schema namespace [http://cxf.apache.org/jaxrs]
>
> I tried googling this and got one result for something similar which
> seemed to be suggesting that I'm missing a JAR file (possibly
> comtaining a missing handler class for the given namespace?) Am I on
> the right track there?
>
> All help gratefully received.
>
> Thanks,
> Brad.
>
> _________________________________________________
> Scanned by MessageLabs for the Super Flux Friends
> _________________________________________________
>