Interesting timing on this thread. We've been trying for the past few weeks and came so close but abandoned the idea. We ended at the point where we had all of the bundles resolved but were getting an unresolved resolved trying to access a /schemas/wsrm..xsd.
We're actually using crx but the first approach that we got working was to bootstrap the cxf jars + spring jars in e lib/container and it worked but we were not happy with the subsequent class loading issues when needing to load our own jars/bundles and there dependencies. The option we went with was to generate webapps with the client cxf code and deploy those in the servlet container. The data is now returned to the day/sling client via json or xml. Hope that helps, Sent from my iPad On Dec 8, 2010, at 2:37 AM, Felix Meschberger <[email protected]> wrote: Hi, Well, using CXF is not for the faint-of-heart ;-) Having said this, you should be extremely cautious at what to actually include with the CXF bundle. For example: commons-logging, slf4j, and all jetty libraries must not be included because either the functionality is already provided by other bundles in Sling (commons logging, slf4j) or is part of the Sling offering (the jetty bundles). Apart from that you might want to make sure to properly set the Thread context class loader to the correct bundle class loader (propably your client bundle) before calling into CXF. ... And don't forget to reset the Thread context class loader after the call ! The reason is that CXF seems to do class loading stuff, which is not really properly abstracted to run in an OSGi framework. Alternatively: have you looked at the dOSGi project inside CXF ? This project comes with properly bundled CXF (again, take extrem care to not package bundles and libraries already present in Sling). Regards Felix Am Mittwoch, den 08.12.2010, 12:44 +0530 schrieb Unmesh Joshi: Hi, My OSGI bundle used on sling app is using CXF client to make web service calls. I have included all the CXF and dependent jars in the bundle. But I am getting following exception when I run the app. This works fine as standalone app. I suspect that this is some classloading issue. Anyone has seen this kind issue before? java.lang.NullPointerException at org.apache.cxf.jaxb.JAXBDataBinding.createContext(JAXBDataBinding.java:566) at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:504) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:324) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:442) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:645) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:505) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:184) Here is bundle imports and classpath Bundle-Classpath: .,antlr-2.7.7.jar,aopalliance-1.0.jar,asm-3.3.jar,bc prov-jdk15-1.43.jar,commons-collections-3.2.1.jar,commons-lang-2.5.ja r,commons-logging-1.1.1.jar,commons-pool-1.5.2.jar,cxf-2.3.0.jar,cxf- manifest.jar,cxf-xjc-boolean-2.3.0.jar,cxf-xjc-bug671-2.3.0.jar,cxf-x jc-dv-2.3.0.jar,cxf-xjc-ts-2.3.0.jar,FastInfoset-1.2.8.jar,geronimo-a ctivation_1.1_spec-1.1.jar,geronimo-annotation_1.0_spec-1.1.1.jar,ger onimo-javamail_1.4_spec-1.7.1.jar,geronimo-jaxws_2.2_spec-1.0.jar,ger onimo-jms_1.1_spec-1.1.1.jar,geronimo-servlet_3.0_spec-1.0.jar,geroni mo-stax-api_1.0_spec-1.0.1.jar,geronimo-ws-metadata_2.0_spec-1.1.3.ja r,jaxb-api-2.2.1.jar,jaxb-impl-2.2.1.1.jar,jaxb-xjc-2.2.1.1.jar,jetti son-1.2.jar,jetty-continuation-7.1.6.v20100715.jar,jetty-http-7.1.6.v 20100715.jar,jetty-io-7.1.6.v20100715.jar,jetty-server-7.1.6.v2010071 5.jar,jetty-util-7.1.6.v20100715.jar,jra-1.0-alpha-4.jar,js-1.7R1.jar ,jsr311-api-1.1.1.jar,neethi-2.0.4.jar,oro-2.0.8.jar,saaj-api-1.3.jar ,saaj-impl-1.3.2.jar,serializer-2.7.1.jar,slf4j-api-1.6.1.jar,slf4j-j dk14-1.6.1.jar,spring-aop-3.0.4.RELEASE.jar,spring-asm-3.0.4.RELEASE. jar,spring-beans-3.0.4.RELEASE.jar,spring-context-3.0.4.RELEASE.jar,s pring-core-3.0.4.RELEASE.jar,spring-expression-3.0.4.RELEASE.jar,spri ng-jms-3.0.4.RELEASE.jar,spring-tx-3.0.4.RELEASE.jar,spring-web-3.0.4 .RELEASE.jar,stax2-api-3.0.2.jar,velocity-1.6.4.jar,webservices.jar,w oodstox-core-asl-4.0.8.jar,wsdl4j-1.6.2.jar,wss4j-1.5.9.jar,xalan-2.7 .1.jar,xmlbeans-2.4.0.jar,xml-resolver-1.2.jar,XmlSchema-1.4.7.jar,xm lsec-1.4.3.jar Import-Package: org.osgi.framework, javax.servlet, org.apache.sling.a pi.resource, org.apache.sling.api, javax.servlet.http, org.apache.sli ng.api.servlets, org.w3c.dom, javax.xml.namespace, javax.xml.transfor m, org.xml.sax, javax.xml.parsers, javax.xml.transform.sax,javax.xml. transform.dom,javax.management, javax.management.modelmbean, javax.xm l.datatype, javax.xml.bind.annotation Build-Jdk: 1.5.0_16 Thanks, Unmesh
