Hi, As I mentioned, you can't simply wrap spec jar like jaxb-api, as SPI mechanism doesn't work in OSGi container. So the spec jar need have OSGiLocator stuff, so that it can load jaxb-impl bundles from OSGi container, servicemix already provide such spec jars with OSGiLocator, so you better use spec jar from servicemix.
Moreover, you also need fine-tune the system bundle export package, some package like javax.xml.bind*, javax.xml.soap, javax.xml.ws* shouldn't exported by system bundle. I'd say adjust a plain OSGi container to support CXF need more effort, but Servicemix/CXF already do it for you. Please try with Servicemix/CXF if you can, then you will find it's very easy to support CXF. Freeman ------------- Freeman Fang FuseSource Email:[email protected] Web: fusesource.com Twitter: freemanfang Blog: http://freemanfang.blogspot.com http://blog.sina.com.cn/u/1473905042 weibo: http://weibo.com/u/1473905042 On 2012-8-15, at 下午9:25, Ivan wrote: > I use Equonix as the OSGi container, and now I have installed all the > required bundles, and all of them are resovled and started correctly. Guess > that this issue is not related to the actual container is used. even turn > to Karaf (a high level infrasture on the native OSGi runtime), the issue > may still occur, as CXF jaxb databinding bundle will be wired to 2.2 JAXB > API bundle. > > Could you show me some light for the CCE in JAXBDataBinding ? Could CXF > work with other JAXB implemenation ? Thanks. > > > 2012/8/15 Freeman Fang <[email protected]> > >> Hi, >> >> Which OSGi container you are using? >> >> To use CXF in OSGi container, a lot of effort need be done, jaxb-api and >> jaxb-impl bundle is one of them, but not all. Servicemix wrap lots of >> bundles(spec bundle like jaxb-api need use OSGiLocator stuff) and karaf >> provide a provisioning mechanism(feature) to is convenient to install CXF, >> so I suggest you use Apache Servicemix or Karaf as the OSGi container, >> which support CXF better. >> >> Actually Servicemix support CXF OOTB now, and Karaf 2.2.x also support to >> install CXF feature easily, you just need replace the jre.properties with >> jre.properties.cxf, both in $KARAF_HOME/etc folder. >> >> For Karaf 2.3.x and 3.x(which could be released soon), as it endorse new >> spec api jar from Servicemix, so both can support CXF OOTB. >> >> Freeman >> >> ------------- >> Freeman Fang >> >> FuseSource >> Email:[email protected] >> Web: fusesource.com >> Twitter: freemanfang >> Blog: http://freemanfang.blogspot.com >> http://blog.sina.com.cn/u/1473905042 >> weibo: http://weibo.com/u/1473905042 >> >> On 2012-8-15, at 下午4:57, Ivan wrote: >> >>> I am trying to use CXF 2.6.1 in OSGi environment, as jdk 6 does not ship >>> the latest JAXB API and implementation, so deployed a JAXB 2.2 API and a >>> repackaged RI JAXB impl as bundles. While running my application, it >> shows >>> ClassCastException one line 392 of JAXBDataBinding. Think the problem is >>> that, the CXF bundle is wired to the 2.2 API and the codes load the >>> hardcode RI JAXB classes (which should be from JDK). >>> >>> From the code logic, seems that it is used for schema things, so does it >>> mean that CXF always need the RI JAXB impl ? If does, it it possible to >>> have a way to configure a RI class name, as I repackaged the RI jaxb impl >>> for some other reasons. >>> Thanks. >>> -- >>> Ivan >> >> > > > -- > Ivan
