cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ZenEighth <zeneig...@gmail.com>
Subject Re: POST request : List<Object> input through JSON not being recognized
Date Tue, 13 Sep 2011 03:32:22 GMT
Thank you Sergey for your reply...apologies for the delay on my part..and for
this lengthy post :)

1)
Using CXF 2.4.2, with JAX-RS of the same version, 2.4.2 (please see my
second point related to this below), I am getting an exception that suggests
'List is not recognized/supported'. My apologies as I lost the exact
exception, and I since moved my code to wrap the List<> inside another
class. This seems to work, although I would love to go back to using List<>
directly, if possible. (I can get the exception for you, if you would like
me to though.)

Its the JSON input that causes this issue, XML input seems to work fine. 

2)  However, I noticed something that I can't explain. If I set both
Apache-CXF and JAX-RS (cxf-rt-frontend-jaxrs) the same 2.4.2 version in my
projects' pom file, I *cannot* get JSON data/response back, ever(XML is
fine). Even on a simple GET, it always throws this exception shown
below(Jettison version that Maven pulls-in is, Jettison-1.3.jar) :

java.lang.NoSuchMethodError:
org.codehaus.jettison.mapped.Configuration.setSupressAtAttributes(Z)V
 at
org.apache.cxf.jaxrs.provider.JSONUtils.createConfiguration(JSONUtils.java:110)
 at
org.apache.cxf.jaxrs.provider.JSONProvider.createWriter(JSONProvider.java:420)
 at
org.apache.cxf.jaxrs.provider.JSONProvider.marshal(JSONProvider.java:405)
 at
org.apache.cxf.jaxrs.provider.JSONProvider.marshal(JSONProvider.java:443)
 at
org.apache.cxf.jaxrs.provider.JSONProvider.writeTo(JSONProvider.java:319)
 at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:257)
 at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:144)
 at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:83)
 at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
 at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77)
 at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
 at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
 at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206)
 at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:218)
 at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:161)
 at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
 at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
 at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) 


BUT, if I change my project pom file to push-down the version on
JAX-RS(cxf-rt-frontend-jaxrs) *alone* to 2.4.0, and keep the rest of CXF
libraries @ 2.4.2, I get beautiful JSON responses for the same GET's and
POST's etc. This is totally repeatable by me on my end. And the weird thing
is Jettison library is still Jettison-1.3.jar. Thought this might interest
you. 

Summary:
So, to recap, my LIST<> input error happens with either versions of
JAX-RS(2.4.2 and 2.4.0), and this is with JSON input only (XML and SOAP are
fine). And secondly, if I use JAX-RS 2.4.2 and CXF 2.4.2, I *cannot* get
back JSON responses for a simple GET either. However, if I bump-down JAX-RS
to 2.4.0, and keep the rest of CXF libraries at 2.4.2, I get JSON output
from the same code (no changes are needed), and this is repeatable.

BTW, I have this deployed on an ancient version of JBoss, jBoss 4.2.3GA, and
I can't upgrade that :)

Here are the cxf related info from my pom file:
        <properties>
             <cxf.version>2.4.2</cxf.version>
        </properties>
          .................
          ................
<dependencies>
       <dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-frontend-jaxws</artifactId>
		<version>${cxf.version}</version>
	</dependency>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-transports-http</artifactId>
		<version>${cxf.version}</version>
	</dependency>
	<dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
      <version>2.4.0</version>
   </dependency>
          .................
          ................
</dependencies>

Thank you once again Sergey..!



--
View this message in context: http://cxf.547215.n5.nabble.com/POST-request-List-Object-input-through-JSON-not-being-recognized-tp4786966p4796953.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Mime
View raw message