cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Bimschas <bimsc...@itm.uni-luebeck.de>
Subject Re: DOSGi and JSON responses
Date Fri, 05 Feb 2010 09:44:20 GMT
Hi Sergey,

today I read your mails again with a fresh mind, trying to make it work ;-) First, regarding
the mail below, I saw that according to [1] the property "org.apache.cxf.rs.provider" is of
Boolean type while you suggest to use it as a list of classnames. If I use it as a list of
classnames whatsoever I get a java.lang.ClassNotFoundException: org.apache.cxf.jaxrs.provider.JSONProvider,
the same for org.apache.cxf.rs.JAXBElementProvider. The same happens when I try to instantiate
JSONProvider and register it as a service with the OSGI service registry via a DS Component
with the following XML:

<scr:component enabled="true" immediate="true" name="VzServiceRestJSONProviderComponent"
               xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
    <implementation class="org.apache.cxf.jaxrs.provider.JSONProvider"/>
    <property name="service.pid" value="VzServiceRestJSONProvider"/>
    <service servicefactory="false">
        <provide interface="javax.ws.rs.ext.MessageBodyReader"/>
        <provide interface="javax.ws.rs.ext.MessageBodyWriter"/>
    </service>
</scr:component>

These are the bundles I installed (Pax Runner start script):

#!/bin/bash
pax-runner-1.4.0/bin/pax-run.sh\
 --bootDelegation=sun.*,com.sun.*,javax.xml.bind,javax.xml.bind.*\
 mvn:org.osgi/org.osgi.core/4.2.0@1@nostart\
 mvn:org.osgi/org.osgi.compendium/4.2.0@1@nostart\
 mvn:org.ops4j.pax.logging/pax-logging-api@2@nostart\
 mvn:org.apache.cxf.dosgi/cxf-dosgi-ri-singlebundle-distribution/1.1@2\
 mvn:org.apache.felix/org.apache.felix.scr/1.0.8@2\
 mvn:org.codehaus.jettison/jettison/1.2@2\
 ... (some more bundles of my app)

Inspecting the cxf-dosgi-ri-singlebundle-distribution bundle and browsing the jar I can see
that the class is included and the package is exported, therefore I can't explain to myself
why this doesn't work :-(

Do you have any clue why the Providers can't be found?

Regards,
Daniel

[1] http://cxf.apache.org/distributed-osgi-reference.html#DistributedOSGiReference-ServiceProviderpropertiesForConfiguringRESTfulJAXRSbasedendpointsandconsumers

Am 27.01.2010 um 10:47 schrieb Sergey Beryozkin:

> Hi Daniel
> 
> Please see "Registering custom JAXRS providers" in [1].
> There's a couple of options. One is to to use an "org.apache.cxf.rs.provider" property
which accepts a list of class names, so you can list the provider you need, ex, "org.apache.cxf.jaxrs.provider.JSONProvider",
etc. The other option is to register an instance of say JSONProvider as an OSGI service, this
option is the only way at the moment to have a provider instance configured with some custom
properties...
> 
> To simplify things a bit, I'll probably need to intoduce "json", "atom", "xbeans", etc
for org.apache.cxf.rs.databinding so that users can avoid having to specify classnames like
"org.apache.cxf.jaxrs.provider.JSONProvider" directly...For more advanced cases we will need
to recognize providers configured in Spring (as an alternative to registering them as OSGI
services)...
> 
> cheers, Sergey
> 
> 
> 
> [1] http://cxf.apache.org/distributed-osgi-reference.html#DistributedOSGiReference-ServiceProviderpropertiesForConfiguringRESTfulJAXRSbasedendpointsandconsumers
> 
> ----- Original Message ----- From: "Daniel Bimschas" <bimschas@itm.uni-luebeck.de>
> To: <users@cxf.apache.org>
> Sent: Tuesday, January 26, 2010 9:59 PM
> Subject: DOSGi and JSON responses
> 
> 
> Hi List!
> 
> I've now successfully developed a project that additionally exposes its interfaces over
the DOSGi based JAX-RS implementation as RESTful service. Therefore I've used the JAXB-Binding
which worked fine. However, I couldn't find any information about how to get the JSON responses
working (they are always empty, i.e. 0 bytes of payload). Can somebody help me here and point
me to the right documentation?
> 
> Kind regards,
> Daniel= 

-- 
M.Sc. Daniel Bimschas
Institute of Telematics, University of Lübeck
http://www.itm.uni-luebeck.de/users/bimschas
Ratzeburger Allee 160, 23538 Lübeck, Germany
Phone: +49 451 500 5389


Mime
View raw message