Hi,

How do you deploy your endpoint?
Seems you miss cxf-rt-transports-http.jar in your classpath.

Freeman
On 2011-3-1, at 上午9:22, Nishant Ranjan wrote:

Hi,

I am trying to start a RESTful service using following:

// I call start() from main
private static void start(){
        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
        sf.setResourceClasses(AuthService.class);
        sf.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID);
        sf.setAddress("http://localhost:9080/";);
        sf.create();
   }

This is the AuthService class
===========================

@Path("/auth/")
@Produces("application/json")
public class AuthService {

   @GET
   @Path("/{app}")
   public String getAuthToken(@PathParam("app") String application,
                               @QueryParam("") AuthBean bean)
   {
       String token = null;
       xxxxx
       xxxxxxxx
       return token;
   }
}

class AuthBean{
   String facebookToken;
   public void setCode(String code){
       facebookToken=code;
   }
   public String getCode() {
       return facebookToken;
   }



When I do that, I am getting this error.

Mar 1, 2011 12:45:47 AM
org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.apache.cxf.bus.spring.BusApplicationContext@982589: startup
date [Tue Mar 01 00:45:47 GMT 2011]; root of context hierarchy
Mar 1, 2011 12:45:47 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource
[META-INF/cxf/cxf.xml]
Mar 1, 2011 12:45:47 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource
[META-INF/cxf/cxf-extension-xml.xml]
Mar 1, 2011 12:45:48 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource
[META-INF/cxf/cxf-extension-jaxrs-binding.xml]
Mar 1, 2011 12:45:48 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource
[META-INF/cxf/cxf-extension-http.xml]
Mar 1, 2011 12:45:48 AM
org.springframework.beans.factory.support.DefaultListableBeanFactory
preInstantiateSingletons
INFO: Pre-instantiating singletons in
org .springframework .beans.factory.support.DefaultListableBeanFactory@1242b11:
defining beans
[cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.service.factory.FactoryBeanListenerManage
r,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory];
root of factory hierarchy
Exception in thread "main"
org.apache.cxf.service.factory.ServiceConstructionException
   at
org .apache .cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java: 128)

   at com.happenings.ws.Server.start(Server.java:32)
   at com.happenings.ws.Server.main(Server.java:40)
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 .getDestinationFactory(DestinationFactoryManagerImpl.java:127)

at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:87)
   at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:71)
   at
org .apache .cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java: 95)

   ... 2 more

I am clueless. Please help.

Regards,
Nishant Ranjan




--
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org

Reply via email to