You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Julio Arias <ju...@rbxglobal.com> on 2008/02/07 23:08:18 UTC

Rest service necessary modules?

Hi - 

I'm having trouble initializing a server for a test, I think I'm missing some dep in my project I'm using the following: 

If I change all of that for the cxf-bundle artifact it works but it adds a lot of jars that I don't think I need, which are the minimum artifacts that I need. 

<!-- CXF --> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-core</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-frontend-jaxws</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-transports-http</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-bindings-http</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-bindings-soap</artifactId> 
<version>${cxf.version}</version> 
</dependency> 

@Before 
public void setup() { 
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); 
sf.setServiceClass(SessionService.class); 
sf.getServiceFactory().setWrapped(true); 
sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID); 
sf.setAddress("http://localhost:9001/"); 
RestSessionService restSessionService = new RestSessionService(); 
sf.getServiceFactory().setInvoker(new BeanInvoker(restSessionService)); 
svr = sf.create(); 
} 

I got the following exception: 

org.apache.cxf.service.factory.ServiceConstructionException 
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:128) 
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147) 
at kaplan.scorelms.rte.ws.SessionServiceTest.setup(SessionServiceTest.java:33) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122) 
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86) 
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) 
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) 
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) 
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) 
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) 
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) 
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) 
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) 
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) 
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) 
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) 
at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334) 
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980) 
Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://schemas.xmlsoap.org/wsdl/http/. 
at org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactory(DestinationFactoryManagerImpl.java:106) 
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:199) 
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:97) 
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108) 
... 26 more 


-- 
Julio Arias 
Java Developer 
Roundbox Global : enterprise : technology : genius 
------------------------------------------------------------------------- 
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica 
tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981 
email: julio.arias@rbxglobal.com | www.rbxglobal.com 
------------------------------------------------------------------------- 

Re: Rest service necessary modules?

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

I'm not sure how many modules a CXF-specific HTTP_BINDING requires, but it would be interesting to get a picture on how many modules a CXF JAX-RS frontend needs.
The following dependencies are likely be needed only :

cxf-rt-core
cxf-api,
cxf-common-utilities
cxf-rt-transports-http
cxf-rt-transports-http-jetty

and possibly cxf-rt-databinding-jaxb

Cheers, Sergey


----- Original Message ----- 
From: "Julio Arias" <ju...@rbxglobal.com>
To: <cx...@incubator.apache.org>
Sent: Thursday, February 07, 2008 10:08 PM
Subject: Rest service necessary modules?


Hi - 

I'm having trouble initializing a server for a test, I think I'm missing some dep in my project I'm using the following: 

If I change all of that for the cxf-bundle artifact it works but it adds a lot of jars that I don't think I need, which are the minimum artifacts that I need. 

<!-- CXF --> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-core</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-frontend-jaxws</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-transports-http</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-bindings-http</artifactId> 
<version>${cxf.version}</version> 
</dependency> 
<dependency> 
<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-bindings-soap</artifactId> 
<version>${cxf.version}</version> 
</dependency> 

@Before 
public void setup() { 
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(); 
sf.setServiceClass(SessionService.class); 
sf.getServiceFactory().setWrapped(true); 
sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID); 
sf.setAddress("http://localhost:9001/"); 
RestSessionService restSessionService = new RestSessionService(); 
sf.getServiceFactory().setInvoker(new BeanInvoker(restSessionService)); 
svr = sf.create(); 
} 

I got the following exception: 

org.apache.cxf.service.factory.ServiceConstructionException 
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:128) 
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147) 
at kaplan.scorelms.rte.ws.SessionServiceTest.setup(SessionServiceTest.java:33) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122) 
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86) 
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77) 
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42) 
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88) 
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51) 
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44) 
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27) 
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37) 
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42) 
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) 
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) 
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) 
at org.apache.maven.surefire.Surefire.run(Surefire.java:177) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334) 
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980) 
Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://schemas.xmlsoap.org/wsdl/http/. 
at org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactory(DestinationFactoryManagerImpl.java:106) 
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:199) 
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:97) 
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108) 
... 26 more 


-- 
Julio Arias 
Java Developer 
Roundbox Global : enterprise : technology : genius 
------------------------------------------------------------------------- 
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica 
tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981 
email: julio.arias@rbxglobal.com | www.rbxglobal.com 
------------------------------------------------------------------------- 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland