Hi > > selector = GrizzlyServerFactory.create(BASE_URI, adapter);
I may need to try to deploy CXF JAX-RS endpoints on Grizzly, I think I've seen this error before, INFO: Setting the server's publish address to be / > *WARNING: Can't find the request for http://localhost:9998/themes's > Observer > * The request is not even reaching the JAX-RS runtime for some reasons. > http://localhost:9998/(BASE_URI.getPath())/themes As Dan suggested this can be the reason but I'm not sure either, it might be that for some reasons base uri is somehow 'lost', possibly because some sort of info which is typically available on sat Tomcat is not there at Grizzly - I reckon I've seen it before, but I'll try it some tome next week once I get back from a break Cheers, Sergey -----Original Message----- From: Daniel Kulp [mailto:[email protected]] Sent: 04 June 2009 16:09 To: [email protected] Cc: Neale Upstone Subject: Re: Strugging getting JAX-RS annotations working with CXF In the second case, you would need to add the cxf-rt-transport-http-jetty jar to the classpath. If you aren't using a servlet, you need some sort of http server which the jetty implementation provides. In the first case, I think the URL is probably wrong, but not really sure. What is the BASE_URI.getPath()? I think it would be: http://localhost:9998/(BASE_URI.getPath())/themes Dan On Wed June 3 2009 6:21:16 pm Neale Upstone wrote: > Hi, > > Progress sounds really great on the blog, but I'm struggling with > getting the basics up and running with CXF 2.2.2. > > I have a service which happily runs with Jersey, but I'm struggling with > getting it up and running under CXF. > > I'm baffled as to what I'm doing wrong... > > > > The service starts as follows: > > @Path("/themes") > public class Service { > ... > > > and I've tried two CXF approaches to publishing it: > > 1) > > final ServletAdapter adapter = new ServletAdapter(); > adapter.addInitParameter( "config-location", "cxf-beans.xml" ); > > adapter.setServletInstance( new CXFServlet() ); > adapter.setContextPath( BASE_URI.getPath() ); > selector = GrizzlyServerFactory.create(BASE_URI, adapter); > > > Result shows that my config is being read: > > INFO: Pre-instantiating singletons in > org.springframework.beans.factory.support.defaultlistablebeanfact...@e06 940 >: defining beans > [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus .sp >ring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250 BeanP >ostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.ap ache. >cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,or g.apa >che.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.Destinat ionFa >ctoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apach e.cxf >.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.work queue >.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.a pache >.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleMan ager, >org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transport s.htt >p.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry ,org. >apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogMan ager, >org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf. jaxrs >.JAXRSBindingFactory,org.apache.cxf.binding.xml.XMLBindingFactory,org.a pache >.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.tr anspo >rt.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http .poli >cy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOn lyHTT >PTransportFactory]; root of factory hierarchy > INFO: Replaced the http destination factory with servlet transport factory > INFO: Build endpoints from config-location: cxf-beans.xml > > where cxf-beans.xml is as per the example: > > <beans ...> > <import resource="classpath:META-INF/cxf/cxf.xml" /> > <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" > /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> > > <jaxrs:server id="server" address="/"> <!-- also tried /themes --> > <jaxrs:serviceBeans> > <ref bean="service" /> > </jaxrs:serviceBeans> > </jaxrs:server> > > <bean id="service" class="x.x.Service" /> > </beans> > > But attempts to read give the following log: > > INFO: Setting the server's publish address to be / > *WARNING: Can't find the request for http://localhost:9998/themes's > Observer > * > > > 2) I also tried the simpler: > > Service service = new Service(); > > JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); > sf.setServiceBeans(service); // also tried: > sf.setResourceClasses(Service.class); > sf.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID); > sf.setAddress(sf.setAddress("http://localhost:9998/"); > sf.create(); > > > The result here is that sf.create() fails with the following exception: > > org.apache.cxf.service.factory.ServiceConstructionException > at > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBea n.j >ava:108) at ucles.themes.rest.Server.startCXF(Server.java:86) > at ucles.themes.rest.Server.<init>(Server.java:29) > at ucles.themes.rest.ThemeTest.setUpServer(ThemeTest.java:52) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:3 >9) at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Imp >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585) > ... > Caused by: org.apache.cxf.BusException: No DestinationFactory was found > for the namespace http://schemas.xmlsoap.org/wsdl/soap/http. > at > org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFac tor >y(DestinationFactoryManagerImpl.java:115) at > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:85) > at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69) > at > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBea n.j >ava:84) ... 19 more -- Daniel Kulp [email protected] http://www.dankulp.com/blog
