Thanks David, that's exactly what I'm trying to do. Frustrated with trying to assemble my own CXF OSGi jar(s), ...
Then I used cxf-bundle with Felix... however it requires a lot of dependencies.. especially external dependencies (I take from SpringSource) because a lot of dependencies of cxf-bundle are not OSGi bundles but simple Java jars. Even with all dependencies satisfied, I still get: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory that until now I cannot resolve. Note that the jaxb JARs from CXF (jaxb-api, jaxb-impl, jaxb-xjc) are not OSGi bundles, therefore I use the ones from SpringSource. Frustrated with com.sun.xml.bind.v2 problem, I tried ServiceMix 4, this time I use the FUSE version because of a broken link in Apache ServiceMix 4 web site* (my bad, actually) My app uses JAX-RS and this doesn't just work in ServiceMix 4 so I had to download jsr311-api-0.8 OSGified from Roberto Rojas' http://rjrojas.blogspot.com/2008/09/restful-web-services-using-iona-fuse.html This time, I got a "better" error, which is ClassNotFoundException on jaxa.ws.rs.Path. It turns out I have to do a "osgi refresh" on the cxf-bundle JAR everytime making a change on my manifest or deploying a new library. (why is this? Shouldn't FileMonitor do this for me?) The current state, is I'm getting two different errors, depending on which bundle I try to refresh. If I refresh cxf-bundle (#91 on my list), I get: servicemix osgi> refresh 91 servicemix osgi> Nov 30, 2008 1:40:46 PM org.apache.cxf.endpoint.ServerImpl initDestination INFO: Setting the server's publish address to be /Test Exception in thread "SpringOsgiExtenderThread-88" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restServer': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.ws.rs.core.MediaType at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1278) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145) at java.lang.Thread.run(Thread.java:619) Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.ws.rs.core.MediaType at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1275) ... 15 more However if I refresh my own bundle (#34), I get: servicemix osgi> refresh 34 servicemix osgi> Nov 30, 2008 1:41:34 PM org.apache.cxf.endpoint.ServerImpl initDestination INFO: Setting the server's publish address to be /Test Exception in thread "SpringOsgiExtenderThread-90" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restServer': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.jaxrs.utils.JAXRSUtils at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1278) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276) at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145) at java.lang.Thread.run(Thread.java:619) Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.jaxrs.utils.JAXRSUtils at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1275) ... 15 more Same error, different offending class, one is from package org.apache.cxf.jaxrs.utils and one is from package javax.ws.rs.core, both packages are Import-Package-ed from in app's manifest. What a chronology... I hope you're willing to help me debug this problem. Thank you. * http://servicemix.apache.org/SMX4/runtime.html contains broken link "You can grab a download of the minimum ServiceMix 4 Runtime here<http://people.apache.org/repo/m2-snapshot-repository/org/apache/servicemix/runtime/org.apache.servicemix.runtime.minimum/4.0-SNAPSHOT/org.apache.servicemix.runtime.minimum-4.0-SNAPSHOT.tar.gz>." It probably should just point to http://servicemix.apache.org/SMX4/download.html or SMX4KNL (?) On Sun, Nov 30, 2008 at 3:23 AM, David Bosschaert < [EMAIL PROTECTED]> wrote: > Hi Hendy, > > Not sure what you're exactly trying to do but just to let you know > that CXF is already available as an OSGi bundle. E.g. you may want to > take a look at cxf-minimal: > http://svn.apache.org/repos/asf/cxf/trunk/distribution/bundle/minimal/ > > If you want to get an easy dsitribution of CXF running inside an OSGi > container, have a look at ServiceMix 4 > (http://servicemix.apache.org/SMX4/download.html). When you start SMX4 > it will actually launch Felix and run all the functionality in that as > OSGi bundles. This includes CXF. > > Cheers, > > David > > 2008/11/28 Hendy Irawan <[EMAIL PROTECTED]>: > > Hi Stuart, > > > > I'm having errors exporting META-INF.cxf from a bundle that embeds/wraps > > cxf. > > > > The sample project is here (be patient about the download, hehehe :-) > > > > https://scm.ops4j.org/repos/ops4j/laboratory/users/ceefour/cxf-embed/ > > > > Alin advises me to use _failok = true and it does work, but perhaps you > can > > suggest a stable solution. > > > > Thank you. > > > > -- > > Best regards, > > Hendy Irawan > > http://hendyirawan.com/ > > > -- Best regards, Hendy Irawan http://hendyirawan.com/
