cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <>
Subject Re: CXF, osgi and tomcat problem
Date Tue, 19 Jan 2010 14:30:24 GMT

> Hello,
> I am newbie for CXF. I am using CXF, osgi (equinox), tomcat configuration
> for testing. My motto to expose restful web services with tomcat in osgi
> enviroment.
> I succeeded in exposing CXF in tomcat without OSGI. For this I forwarded all
> the request to CXFServlet with some of spring configuration.

> Now I try to use tomcat and osgi environement. I am using servletbrigge.jar
> for tomcat configuration.
> My understanding is... request should come to websevice should first
> redirect to servlet bridge. From here it should go to CXFServlet.
> Now I should expose any endpoint, This endpoint will be called by CXFServlet
> without jetty and with tomcat.
> Now my problem is: I read the CXF document and how to publish endpoint. for
> this I am using code snippet:
> JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
> sf.setResourceClasses(CustomerService.class);
> sf.setResourceProvider(CustomerService.class, new
> SingletonResourceProvider(new CustomerService()));
> sf.setAddress("http://localhost:9000/");
> sf.create();
> When I give the address "http://localhost:9000", it is invoking jetty. how
> to avoid jetty invocation and use tomcat configuration?
> Is it possible to solve this by any configuration, please advice me or any
> code snippet will help me a lot.

Have a look please here :

check createServer(...), you probably will need to do something similar, in the simplest case

CXFNonSpringServlet cxf = new CXFNonSpringServlet();
HttpService httpService = getHttpService();
httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(), null);
Bus bus = cxf.getBus();

JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
factory.setResourceProvider(iClass, new SingletonResourceProvider(serviceBean));
// get custom providers (if any) and register them
// factory.setProviders(providers);
> Another problem: I also tried it with DOSGI. The problem with DOSGI is, I
> can't get Grammer tag and not able to generate stubs. If any body can
> suggest me how to overcome both the problem for DOSGI, I can take this
> solution and start working on this.

Can you explain a bit more ? Which stubs ?

cheers, Sergey

> -- 
> View this message in context:
> Sent from the cxf-user mailing list archive at

View raw message