You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cmoulliard <cm...@gmail.com> on 2009/12/22 14:42:29 UTC
JAXRSOutInterceptor - 346 - No message body writer has been found
for response class Incidents.
Hi,
I have designed a project running on Apache Felix Karaf 1.2.0 and using the
following components :
- Apache CXF : 2.2.5
- Camel-cxf : 2.2.0-SNAPSHOT
This project consists in 4 different bundles :
- REST service
- Model
- DAO
- Route
All the required packages are imported/exported accordingly.
Surprisingly, when I try to do a GET, I receive the following warning
without any error in the log except that the response send to the browser is
"No message body reader has been found for request class ReportIncident":
14:30:38,271 | WARN | 74@qtp-8345336-0 | JAXRSUtils |
pache.cxf.jaxrs.utils.JAXRSUtils 973 | No message body reader has been
found for request class ReportIncident, ContentType :
application/xml;charset=UTF-8.
In debug mode, I have see that the instance MessageBodyReader is null at the
line 950 of the code
@SuppressWarnings("unchecked")
private static <T> Object readFromMessageBody(Class<T> targetTypeClass,
Type parameterType,
Annotation[]
parameterAnnotations,
InputStream is,
MediaType contentType,
List<MediaType>
consumeTypes,
Message m) {
List<MediaType> types = JAXRSUtils.intersectMimeTypes(consumeTypes,
contentType);
MessageBodyReader provider = null;
for (MediaType type : types) {
provider = ProviderFactory.getInstance(m)
.createMessageBodyReader(targetTypeClass,
parameterType,
parameterAnnotations,
type,
m);
Where is the issue ?
Regards,
-----
Charles Moulliard
SOA Architect
My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
--
View this message in context: http://old.nabble.com/JAXRSOutInterceptor---346---No-message-body-writer-has-been-found-for-response-class-Incidents.-tp26888538p26888538.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: JAXRSOutInterceptor - 346 - No message body writer has been
found for response class Incidents.
Posted by cmoulliard <cm...@gmail.com>.
Many thanks,
I have verified the first solution proposed and everything works fine after
adding in the MANIFEST file of the bundle containing the JAXB annoted
classed these imports :
javax.xml.bind;version=2.1.0;resolution:=optional,
javax.xml.bind.annotation;version=2.1.0;resolution:=optional,
com.sun.xml.bind.v2.runtime.reflect;version=0.0.0;resolution:=optional
Thanks for the quick answer ;-)
Regards,
Charles
Sergey Beryozkin-2 wrote:
>
> Hi
>
> We have talked with Charles on Gmail and identified that the issue was to
> do with the CXF JAXB provider not seeing JAXB annotations,
> due to the fact the JAXB-annotated classes have been moved to another OSGI
> bundle.
> Two possible solutions :
> - update the bundle containing the JAXRS service class to import a
> javax.xml.bind.annotation package
> - configure CXF JAXBElementProvider to marshall away without
> @XMLRootElement being available, as described here
> http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-HandlingJAXBbeanswithoutXmlRootElementannotations
>
> Charles suggested to update JAXBElementProvider so that it logs/reprots
> why a given element is seen as not readable/writable,
> something I will do shortly...
>
> thanks, Sergey
>
>
>>
>> Hi,
>>
>> I have designed a project running on Apache Felix Karaf 1.2.0 and using
>> the
>> following components :
>> - Apache CXF : 2.2.5
>> - Camel-cxf : 2.2.0-SNAPSHOT
>>
>> This project consists in 4 different bundles :
>> - REST service
>> - Model
>> - DAO
>> - Route
>>
>> All the required packages are imported/exported accordingly.
>>
>> Surprisingly, when I try to do a GET, I receive the following warning
>> without any error in the log except that the response send to the browser
>> is
>> "No message body reader has been found for request class ReportIncident":
>>
>> 14:30:38,271 | WARN | 74@qtp-8345336-0 | JAXRSUtils
>> |
>> pache.cxf.jaxrs.utils.JAXRSUtils 973 | No message body reader has been
>> found for request class ReportIncident, ContentType :
>> application/xml;charset=UTF-8.
>>
>> In debug mode, I have see that the instance MessageBodyReader is null at
>> the
>> line 950 of the code
>>
>> @SuppressWarnings("unchecked")
>> private static <T> Object readFromMessageBody(Class<T>
>> targetTypeClass,
>> Type parameterType,
>> Annotation[]
>> parameterAnnotations,
>> InputStream is,
>> MediaType contentType,
>> List<MediaType>
>> consumeTypes,
>> Message m) {
>>
>> List<MediaType> types =
>> JAXRSUtils.intersectMimeTypes(consumeTypes,
>> contentType);
>>
>> MessageBodyReader provider = null;
>> for (MediaType type : types) {
>> provider = ProviderFactory.getInstance(m)
>> .createMessageBodyReader(targetTypeClass,
>> parameterType,
>> parameterAnnotations,
>> type,
>> m);
>>
>>
>>
>> Where is the issue ?
>>
>> Regards,
>>
>>
>>
>> -----
>> Charles Moulliard
>> SOA Architect
>>
>> My Blog : http://cmoulliard.blogspot.com/
>> http://cmoulliard.blogspot.com/
>> --
>> View this message in context:
>> http://old.nabble.com/JAXRSOutInterceptor---346---No-message-body-writer-has-been-found-for-response-class-Incidents.-tp26888538p26888538.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
>
>
-----
Charles Moulliard
SOA Architect
My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
--
View this message in context: http://old.nabble.com/JAXRSOutInterceptor---346---No-message-body-writer-has-been-found-for-response-class-Incidents.-tp26888538p26890044.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: JAXRSOutInterceptor - 346 - No message body writer has been found for response class Incidents.
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi
We have talked with Charles on Gmail and identified that the issue was to do with the CXF JAXB provider not seeing JAXB annotations,
due to the fact the JAXB-annotated classes have been moved to another OSGI bundle.
Two possible solutions :
- update the bundle containing the JAXRS service class to import a javax.xml.bind.annotation package
- configure CXF JAXBElementProvider to marshall away without @XMLRootElement being available, as described here
http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-HandlingJAXBbeanswithoutXmlRootElementannotations
Charles suggested to update JAXBElementProvider so that it logs/reprots why a given element is seen as not readable/writable,
something I will do shortly...
thanks, Sergey
>
> Hi,
>
> I have designed a project running on Apache Felix Karaf 1.2.0 and using the
> following components :
> - Apache CXF : 2.2.5
> - Camel-cxf : 2.2.0-SNAPSHOT
>
> This project consists in 4 different bundles :
> - REST service
> - Model
> - DAO
> - Route
>
> All the required packages are imported/exported accordingly.
>
> Surprisingly, when I try to do a GET, I receive the following warning
> without any error in the log except that the response send to the browser is
> "No message body reader has been found for request class ReportIncident":
>
> 14:30:38,271 | WARN | 74@qtp-8345336-0 | JAXRSUtils |
> pache.cxf.jaxrs.utils.JAXRSUtils 973 | No message body reader has been
> found for request class ReportIncident, ContentType :
> application/xml;charset=UTF-8.
>
> In debug mode, I have see that the instance MessageBodyReader is null at the
> line 950 of the code
>
> @SuppressWarnings("unchecked")
> private static <T> Object readFromMessageBody(Class<T> targetTypeClass,
> Type parameterType,
> Annotation[]
> parameterAnnotations,
> InputStream is,
> MediaType contentType,
> List<MediaType>
> consumeTypes,
> Message m) {
>
> List<MediaType> types = JAXRSUtils.intersectMimeTypes(consumeTypes,
> contentType);
>
> MessageBodyReader provider = null;
> for (MediaType type : types) {
> provider = ProviderFactory.getInstance(m)
> .createMessageBodyReader(targetTypeClass,
> parameterType,
> parameterAnnotations,
> type,
> m);
>
>
>
> Where is the issue ?
>
> Regards,
>
>
>
> -----
> Charles Moulliard
> SOA Architect
>
> My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
> --
> View this message in context:
> http://old.nabble.com/JAXRSOutInterceptor---346---No-message-body-writer-has-been-found-for-response-class-Incidents.-tp26888538p26888538.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>