Hi Sergey, Thanks for the link I tried to implement but still produces the same error.
java -cp target/sample-service-1.0-jar-with-dependencies.jar com.crush.tests.service.Test Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:205) at com.crush.tests.service.Test.<init>(Test.java:27) at com.crush.tests.service.Test.main(Test.java:32) Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://cxf.apache.org/transports/http. at org.apache.cxf.bus.managers.DestinationFactoryManagerImpl.getDestinationFactory(DestinationFactoryManagerImpl.java:130) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:78) at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:62) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:159) ... 2 more My Test source public class Test { protected Test() throws Exception { JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setResourceClasses(SampleServiceImpl.class); sf.setResourceProvider(SampleServiceImpl.class, new SingletonResourceProvider(new SampleServiceImpl())); sf.setAddress("http://localhost:9000/"); BindingFactoryManager manager = sf.getBus().getExtension(BindingFactoryManager.class); JAXRSBindingFactory factory = new JAXRSBindingFactory(); factory.setBus(sf.getBus()); manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, factory); sf.create(); } public static void main(String[] args) throws Exception { new Test(); System.out.println("Server ready..."); Thread.sleep(5 * 6000 * 1000); System.out.println("Server exiting"); System.exit(0); } } Any other thoughts? On Fri, Jun 27, 2014 at 5:07 PM, Sergey Beryozkin <[email protected]> wrote: > Hi > > On 27/06/14 17:51, Chris Bud wrote: > >> Hi All, >> >> I'm trying to build a basic jax-rs example using version 2.7.11. Using >> the >> server and service code from the example code >> <http://svn.apache.org/viewvc/cxf/trunk/distribution/src/ >> main/release/samples/jax_rs/basic/>, >> >> I can build and run it just like the readme instructions say (mvn >> -Pserver) >> but if I produce a jar bundled with the dependencies and run from the >> command line I cannot get the server to start. I get the following >> exception >> >> test-service/target$ java -cp test-service-1.0-jar-with-dependencies.jar >> com.test.Server >> Exception in thread "main" >> org.apache.cxf.service.factory.ServiceConstructionException >> at >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create( >> JAXRSServerFactoryBean.java:190) >> at com.test.Server.<init>(Server.java:24) >> at com.test.Server.main(Server.java:29) >> Caused by: org.apache.cxf.BusException: No DestinationFactory was found >> for >> the namespace http://cxf.apache.org/transports/http. >> at >> org.apache.cxf.bus.managers.DestinationFactoryManagerImpl. >> getDestinationFactory(DestinationFactoryManagerImpl.java:130) >> at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:78) >> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:62) >> at >> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create( >> JAXRSServerFactoryBean.java:151) >> ... 2 more >> >> Can anyone point me in the right direction? >> >> It appears that when running a packaged Jetty based demo the following > has to be done: > > http://cxf.apache.org/docs/jaxrs-services-configuration.html# > JAXRSServicesConfiguration-ConfiguringJAX-RSendpointsprogrammaticallywit > houtSpring > > Please see the lines related to registering binding id/factory > > Can you please update Server accordingly, recompile and retry ? > > Cheers, Sergey > > Thanks, >> Chris >> >> > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > Blog: http://sberyozkin.blogspot.com >
