Have a look at this email please:
http://cxf.547215.n5.nabble.com/Problem-with-JAXBContext-which-is-not-populated-with-MySecondClass-for-MyClass-lt-MySecondClass-gt-tt5574932.html#a5582743
I think that if you import CXF JSONProvider or Jackson and register an
instance, either as Object or (inside) Array then it should work,
ClassUtils.loadProviderClasses in
http://svn.apache.org/repos/asf/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/ClassUtils.java
deals with loading the custom providers
HTH, Sergey
On 15/05/12 22:33, Anthony Bargnesi wrote:
It is DOSGI version 1.3.1. I tried all jettison versions back to 1.1 and
received the same error.
I also tried including Jackson in the felix container using the following
dependencies:
- jackson-core-lgpl-1.9.7.jar
- jackson-jaxrs-1.9.7.jar
- jackson-mapper-lgpl-1.9.7.jar
- jackson-mrbean-1.9.7.jar
- jackson-smile-1.9.7.jar
- jackson-xc-1.9.7.jar
Then I updated my service Activator with the following:
settings.put("org.apache.cxf.rs.provider",
"org.codehaus.jackson.jaxrs.JacksonJsonProvider");
When I launched the felix container the Jackson bundles loaded but CXF
through the error:
java.lang.ClassNotFoundException:
org.codehaus.jackson.jaxrs.JacksonJsonProvider not found by
service.dashboard [12]
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1723)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:926)
at org.apache.cxf.dosgi.dsw.ClassUtils.loadProviders(ClassUtils.java:124)
at
org.apache.cxf.dosgi.dsw.ClassUtils.loadProviderClasses(ClassUtils.java:108)
at
org.apache.cxf.dosgi.dsw.handlers.JaxRSUtils.getProviders(JaxRSUtils.java:67)
at
org.apache.cxf.dosgi.dsw.handlers.JaxRSPojoConfigurationTypeHandler.createServer(JaxRSPojoConfigurationTypeHandler.java:119)
at
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:247)
at
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:72)
at
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:66)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:66)
at
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:38)
at
org.apache.cxf.dosgi.topologymanager.TopologyManager$2.run(TopologyManager.java:267)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Even though the "JAX-RS provider for JSON content type, using Jackson data
binding (1.9.7)" is an active module
CXF cannot seem to find it. Do I need to specify this package as an import
to my service bundle?
Thanks!
Tony
On Tue, May 15, 2012 at 4:48 PM, Sergey Beryozkin<[email protected]>wrote:
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<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
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com