You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2009/10/03 19:41:23 UTC
[jira] Resolved: (CXF-954) Null pointer exception when prefixed XML
sent to RESTful SERVCIE
[ https://issues.apache.org/jira/browse/CXF-954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved CXF-954.
-----------------------------
Resolution: Duplicate
Fix Version/s: 2.2.2
This is the same issue as CXF-952 in that if it's fully qualified (your second example), it worked and if not qualfied, it didn't.
In either case, JAX-RS is the answer now.
> Null pointer exception when prefixed XML sent to RESTful SERVCIE
> ----------------------------------------------------------------
>
> Key: CXF-954
> URL: https://issues.apache.org/jira/browse/CXF-954
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.1
> Reporter: Adrian Trenaman
> Fix For: 2.2.2
>
>
> I originally sent the following in email to cxf-dev:
> ---
> Hi all,
>
> I've been playing with the RESTful service support and I've come across some issues that really slowed me down :( I'm describing them here (and their workarounds) in case any users find it useful. I'm also wondering if some of these might be classified as bugs - please advise!
>
> Here's what happened: based on the docu in the CXF wiki User Guide [1], I developed a RESTful service: everything was going fine until I implemented a PUT method for an update.
>
> --- in play/Contacts.java ---
> @Put
> @HttpResource(location="/people/{id}")
> void updatePerson(Person person);
> ---
> : : :
> Second problem: for some reason CXF insists that the payload document's root element is not prefixed with an XML namespace prefix. For example; the following valid XML results in a server-side NullPointerException.
>
> <ns2:Person xmlns:ns2="http://play/">
> <age>34</age>
> <email>sdfdfdf</email>
> <firstName>Adrian</firstName>
> <id>42</id>
> <lastName>Trenaman</lastName>
> </ns2:Person>
>
> To get it to work, I had to re-jig the XML so that Person is not prefixed (see below). I have a feeling that this problem is related to how we inject the id parameter into the Person XML, perhaps using an unqualified X-Path like "Person/id", but am not 100% sure.
>
> <Person xmlns="http://play/">
> <age>34</age>
> <email>sdfdfdf</email>
> <firstName>Adrian</firstName>
> <id>42</id>
> <lastName>Trenaman</lastName>
> </Person>
> ---
> The exception stack trace is:
> 29-Aug-2007 09:52:51 org.apache.cxf.binding.http.interceptor.DispatchInterceptor handleMessage
> INFO: Invoking PUT on /people/123
> 29-Aug-2007 09:52:51 org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage
> INFO: URIParameterInterceptor handle message on path [/people/123] with content-type [null]
> 29-Aug-2007 09:52:52 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.NullPointerException
> at org.apache.cxf.binding.http.IriDecoderHelper.getElement(IriDecoderHelper.java:345)
> at org.apache.cxf.binding.http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:295)
> at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java:124)
> at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage(URIParameterInInterceptor.java:105)
> at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
> at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
> at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:256)
> at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:212)
> at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:54)
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
> at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> at org.mortbay.jetty.Server.handle(Server.java:313)
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
> at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
> at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
> at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.