Thanks for the quick reply Sergey.  Yes, the endpoints are properly
published, so the stack trace doesn't appear to affect the application's
functionality.  I tried removing the Require-Bundle header and adding:

"Import-Package: META-INF.cxf, META-INF.cxf.osgi, *"

I've even confirmed that these packages are being provided to my bundle by
cxf in the felix web console:

Symbolic Name
  sample-rest
Start Level
  5
...
Imported Packages
  META-INF.cxf,version=0.0.0 from org.apache.cxf.bundle-minimal
(29)<http://localhost:8080/system/console/bundles/29>
  META-INF.cxf.osgi,version=0.0.0 from org.apache.cxf.bundle-minimal
(29)<http://localhost:8080/system/console/bundles/29>

Josh

On Thu, Apr 8, 2010 at 10:14 AM, Sergey Beryozkin <[email protected]>wrote:

> Hi Josh
>
> I think I might've seen this error before. May be David B or Dan may recall
> something. It is probably something to do with the missing imports given
> that DOSGI does not show these warnings..., though DOSGI DSW has a
> DynamicImports=* too...
> When you say it functions, do you mean that this WARN message is not
> preventing the endpoints from being properly published ?
>
> By the way, cxf minimal exports :
>
> '=META-INF.cxf',
> '=META-INF.cxf.osgi'
>
> please check if importing META-INF.cxf.osgi helps
>
> thanks, Sergey
>
> On Thu, Apr 8, 2010 at 5:51 PM, Josh Holtzman <[email protected]
> >wrote:
>
> > I'm trying to allow for manual creation of JAX-RS endpoints in OSGI
> without
> > the DOSGI jars.  I've added a "Require-Bundle:
> > org.apache.cxf.bundle-minimal" header to my bundle, and I create the
> > endpoint like this:
> >
> >    CXFNonSpringServlet cxf = new CXFNonSpringServlet();
> >    httpService.registerServlet(alias, cxf, new Hashtable<String,
> String>(),
> > httpContext);
> >    Bus bus = cxf.getBus();
> >    JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
> >    factory.setBus(bus);
> >    factory.setServiceClass(service.getClass());
> >    factory.setResourceProvider(service.getClass(), new
> > SingletonResourceProvider(service));
> >    factory.setAddress("/");
> >    ClassLoader bundleClassLoader =
> > Thread.currentThread().getContextClassLoader();
> >    ClassLoader delegateClassLoader =
> > JAXRSServerFactoryBean.class.getClassLoader();
> >    try {
> >      Thread.currentThread().setContextClassLoader(delegateClassLoader);
> >      factory.create();
> >    } finally {
> >      Thread.currentThread().setContextClassLoader(bundleClassLoader);
> >    }
> >
> > This seems to function, but I get the following stack trace when I
> register
> > the servlet:
> >
> > 09:36:28  WARN (CXFNonSpringServlet:45) - Initial attempt to crate
> > application context was unsuccessful.
> > org.springframework.beans.factory.BeanDefinitionStoreException:
> IOException
> > parsing XML document from class path resource [META-INF/cxf/cxf.xml];
> > nested
> > exception is java.io.FileNotFoundException: class path resource
> > [META-INF/cxf/cxf.xml] cannot be opened because it does not exist
> >    at
> >
> >
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
> >    at
> >
> >
> org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:131)
> >    at
> >
> >
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> >    at
> >
> >
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> >    at
> >
> >
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:109)
> >    at
> >
> >
> org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusApplicationContext.java:262)
> >    at
> >
> >
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
> >    at
> >
> >
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
> >    at
> >
> >
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
> >    at
> >
> >
> org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:91)
> >    at
> >
> >
> org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:102)
> >    at
> >
> >
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:93)
> >    at
> >
> >
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:86)
> >    at
> >
> >
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:64)
> >    at
> >
> >
> org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:53)
> >    at
> >
> >
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.loadBusNoConfig(CXFNonSpringServlet.java:45)
> >    at
> >
> >
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.loadBus(CXFNonSpringServlet.java:38)
> >    at
> >
> >
> org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:78)
> >    at
> >
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:431)
> >
> >
> > I'm using cxf-bundle-minimal 2.2.7.  Importing the META-INF.cxf package
> > don't seem to help.  Any ideas?
> >
> > Thanks,
> > Josh
> >
>

Reply via email to