Hi,
On 15/05/12 21:39, Anthony Bargnesi wrote:
Sergey,

Thanks for the quick reply.  I thought that was the issue from another
post<http://cxf.547215.n5.nabble.com/DOSGi-and-JSON-responses-td547432.html>
.

I added jettison 1.3.1 into the felix osgi container and received a
different error.  This one
seems to be around writing JSON for my REST service:

java.lang.VerifyError: (class: org/apache/cxf/jaxrs/provider/JSONUtils,
method: createBadgerFishWriter signature:
(Ljava/io/OutputStream;)Ljavax/xml/stream/XMLStreamWriter;) Incompatible
object argument for function call
at
org.apache.cxf.jaxrs.provider.JSONProvider.createWriter(JSONProvider.java:477)
at org.apache.cxf.jaxrs.provider.JSONProvider.marshal(JSONProvider.java:453)
at org.apache.cxf.jaxrs.provider.JSONProvider.marshal(JSONProvider.java:500)
at org.apache.cxf.jaxrs.provider.JSONProvider.writeTo(JSONProvider.java:348)
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:123)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:323)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:289)
at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:939)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:342)
at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
at
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1048)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:601)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Thread.java:662)

Have you seen this?

I did awhile back but I thought it somehow 'self-resolved' as other users reported they set up the default JSON provider, I hope I did actually saw the confirmations but not 100% sure.

I'm not how to resolve it, do you us DOSGI 1.3.1 ? Prehaps you can experiment with importing Jackson into the custom bundle and registering it from the Activator

Let me know how it goes please
Cheers, Sergey


Thanks!
Tony

On Tue, May 15, 2012 at 4:35 PM, Sergey Beryozkin<[email protected]>wrote:

Hi,

DOSGI does not ship a jettison library by default, so it needs to be
installed and the DSW refreshed and it should solve the issue.
Jackson or other providers can be registered if needed

Cheers, Sergey

On 15/05/12 21:17, Anthony Bargnesi wrote:

Hello,

I am not sure how to configure a JSONProvider in CXF DOSGI.

I have a single OSGI bundle that declares a REST interface and
implementation.

The REST interface is defined as:

@Path("dashboard")
public interface DashboardRS {

     @GET
     @Path("get")
     @Produces(MediaType.**APPLICATION_JSON)
     Dashboards getDashboards();

     @GET
     @Path("get/{name}")
     @Produces(MediaType.**APPLICATION_JSON)
     Dashboard getDashboard(@PathParam("name"**) final String name);
}

It is configured in its Activator as:

Dictionary<String, String>   settings = new Hashtable<String, String>();
settings.put("service.**exported.interfaces", "*");
settings.put("service.**exported.configs, "org.apache.cxf.rs");
settings.put("service.**exported.intents", "HTTP");
settings.put("org.apache.cxf.**rs.address", "http://localhost:9000/";);

Activator.context.**registerService(DashboardRS.**class.getName(),
     new DashboardRSImpl(), settings);

The bundle manifest is created as:

Manifest-Version: 1.0
Bnd-LastModified: 1337112570807
Build-Jdk: 1.6.0_26
Built-By: tony
Bundle-Activator: dashboard.Activator
Bundle-ManifestVersion: 2
Bundle-Name: Dashboard REST Service
Bundle-SymbolicName: service.dashboard
Bundle-Version: 0.0.1.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: service.dashboard;uses:="org.**osgi.frame
  work,javax.xml.bind.**annotation,javax.ws.rs";**version="0.0.1.SNAPSHOT"
Import-Package: javax.ws.rs;version="[1.0,2)",**
javax.xml.bind.annotation;
  version="[2.1,3)",org.osgi.**framework;version="[1.5,2)"
Tool: Bnd-1.50.0

Do I have to configure a JSON provider?  If so how is that done in DOSGI?

Thanks for the help!
Tony



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to