cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Manually creating a JAX-RS endpoint in OSGI
Date Thu, 08 Apr 2010 17:14:01 GMT
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 <jholtzman@berkeley.edu>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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message