Hi
I think this is a bug in the AbstractJAXRSFactoryBean, but I'd need to
> confirm
> with Sergey. At line 141, I see:
>
> if (transportId == null) {
> transportId = "http://schemas.xmlsoap.org/wsdl/soap/http";
> }
>
> which cannot be right. That should likely be the http transportId of:
> http://cxf.apache.org/transports/http
>
> Certainly shouldn't be the soap one.
>
>
I'll fix it - I guess it's a copy & paste code that has stayed there for too
long...
> You can likely work around it by calling setTransportID on the factory with
> that id.
>
> THAT said, you ARE missing the cxf-rt-transports-http-jetty.jar that would
> be
> required for a standalone server to run.
>
> Yes, this dependency will fix it, and the above branch won't be reached
because the Jetty transport provides a destination factory for the http
transport URI...
I'll remove that soap URI anyway as it is confusing....
thanks, Sergey
> Dan
>
>
>
> >
> > 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.Jsr250
> > >
> BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org
> > >
> .apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configu
> > >
> rer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport
> > >
> .DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManag
> > >
> er,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.
> > >
> apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLife
> > >
> CycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoi
> > >
> nt.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,
> > >
> org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoi
> > >
> nt.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apac
> > >
> he.cxf.catalog.OASISCatalogManager,org.apache.cxf.service.factory.Factory
> > > BeanListenerManage
> > >
> r,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf
> > >
> .binding.xml.XMLBindingFactory,org.apache.cxf.transport.http.policy.HTTPC
> > >
> lientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAsse
> > >
> rtionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorPr
> > > ovider,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
>
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
> Talend - http://www.talend.com
>
--
Sergey Beryozkin
Application Integration Division of Talend <http://www.talend.com>
http://sberyozkin.blogspot.com