You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexey Zavizionov <al...@gmail.com> on 2008/10/01 17:55:49 UTC

Re: Starting up service within listener: Could not find destination factory for transport.

Hello list,

Is there a CXF API methods to hold on deploy service from listener before
MyCxfNonSpringServlet servlet is started.
Will it work with register service to the servlet context outside servlet
code?

Thanks and regards,
Alexey.

On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
alexey.zavizionov@gmail.com> wrote:

> Thanks for reply,
>
> NOTE: I have a listener which starts before MyCxfNonSpringServlet is
> deployed.
>    All code for registering endpoint I moved to the listener.
>
> How can I register the servlets transport factory with the bus?
>
> Regards,
> Alexey.
>
>
>
> On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp <dk...@apache.org> wrote:
>
>>
>> It looks like the servlets transport factory is not registered with the
>> bus.
>> Are you subclassing our CXFNonSpringServlet or similar to make sure the
>> appropriate transport is setup to handle that namespace?
>>
>> Dan
>>
>> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov wrote:
>> > Hello list,
>> >
>> > I published services within test unit and in a servlet (nonspring)
>> > successfully with command "Endpoint.publish(address, object);".
>> >
>> > But, the same thing has failed within listener (in the Tomcat ).
>> >
>> > Does somebody have publish your service within listener?
>> >
>> > INFO: Creating Service
>> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>class
>> > org.exoplatform.services.ws.soap.jsr181.TicketOrderService
>> > org.picocontainer.PicoIntrospectionException: Failed when calling start
>> on
>> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7bc899
>> >         at
>> >
>> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
>> >81) at
>> >
>> org.picocontainer.defaults.LifecycleVisitor.start(LifecycleVisitor.java:113
>> >) at
>> >
>> org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPicoContainer.
>> >java:369) at
>> >
>> org.exoplatform.container.StandaloneContainer.getInstance(StandaloneContain
>> >er.java:124) at
>> >
>> org.exoplatform.container.StandaloneContainer.getInstance(StandaloneContain
>> >er.java:91) at
>> >
>> org.exoplatform.ws.frameworks.servlet.StandaloneContainerInitializedListene
>> >r.contextInitialized(StandaloneContainerInitializedListener.java:71) at
>> >
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java
>> >:3827) at
>> >
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
>> >         at
>> >
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
>> >761) at
>> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
>> >         at
>> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
>> >         at
>> >
>> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626
>> >) at
>> >
>> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:55
>> >3) at
>> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
>> >         at
>> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
>> >         at
>> >
>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
>> >         at
>> >
>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppo
>> >rt.java:120) at
>> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
>> >         at
>> > org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
>> >         at
>> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
>> >         at
>> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>> >         at
>> > org.apache.catalina.core.StandardService.start(StandardService.java:448)
>> >         at
>> > org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>> >         at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>> >9) at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
>> >         at
>> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>> >         at
>> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>> >
>> > Caused by: java.lang.RuntimeException: Could not find destination
>> factory
>> > for transport http://schemas.xmlsoap.org/soap/http
>> >         at
>> >
>> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTranspo
>> >rtFactory.java:76) at
>> > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>> >         at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>> >         at
>> >
>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:117
>> >) at
>> >
>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.j
>> >ava:168) at
>> >
>> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeployService(CXFUtils
>> >.java:83) at
>> >
>> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.start(WebServiceLoade
>> >r.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>> >9) at
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
>> >         at
>> >
>> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
>> >75) ... 29 more
>> >
>> > Regards,
>> > Alexey.
>>
>>
>>
>> --
>> Daniel Kulp
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>
>

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Alexey Zavizionov <al...@gmail.com>.
Thanks for the reply.

I povided to you main parts of codes three mails before.
I have a picocontainer where I save bus instance.

The Tomcat AS bundled with the ws-sample application has a large list of
dependencies jar files.

Thanks and regards,
Alexey.

On Fri, Oct 3, 2008 at 5:15 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> Is there anyway you could package up a simple example project with your
> listener and servlet (and a simple hello world service type thing) and
> send it along to me?   I can then step through parts of it in the
> debugger to see what is going on.    If the Bus is the same, it really
> looks like it should have worked.  :-(
>
> Thanks!
> Dan
>
>
> On Friday 03 October 2008, Alexey Zavizionov wrote:
> > Ok, I have the same objects of Bus in both classes listener and
> > servlet. In a browser the same message "No service was found.".
> >
> > Iit doesn't work. Why?
> >
> > On Fri, Oct 3, 2008 at 10:26 AM, Alexey Zavizionov <
> >
> > alexey.zavizionov@gmail.com> wrote:
> > > There are different buses.
> > >
> > > Listener:
> > > >>> EXOMAN MyListener.start() 2 = 2
> > > >>> EXOMAN MyListener.start() bus =
> > >
> > > org.apache.cxf.bus.extension.ExtensionManagerBus@162ba99
> > >
> > > >>> EXOMAN MyListener.start() System.identityHashCode(bus) =
> > > >>> 23247513
> > >
> > > Servlet:
> > > [INFO] MyCxfNonSpringServlet - loadBus method entering
> > >
> > > >>> EXOMAN MyCxfNonSpringServlet.loadBus() bus =
> > >
> > > org.apache.cxf.bus.extension.ExtensionManagerBus@1e9f5cc
> > >
> > > >>> EXOMAN MyCxfNonSpringServlet.loadBus()
> > > >>> System.identityHashCode(bus) =
> > >
> > > 32110028
> > >
> > > Thanks and regards,
> > > Alexey
> > >
> > > On Thu, Oct 2, 2008 at 10:15 PM, Daniel Kulp <dk...@apache.org>
> wrote:
> > >> That all looks correct.    The only thing I can think of is if a
> > >> different Bus is getting used in the servlet.   Can you do
> > >> something like:
> > >> System.out.println(System.identityHashCode(bus));
> > >> in your listener and in your servlet to see if they are the same.
> > >> If not, that's definitely the issue.
> > >>
> > >> You MAY need to stick the Bus into a static variable or something
> > >> to make sure the correct Bus is used.
> > >>
> > >> Dan
> > >>
> > >> On Thursday 02 October 2008, Alexey Zavizionov wrote:
> > >> > Hello Dan,
> > >> >
> > >> > I tried different ways to do it but I did not get successful
> > >> > result. What did I do wrong?
> > >> >
> > >> > In the listener code:
> > >> > -----------------------------------------------------------------
> > >> >----- ---------------------- ...
> > >> >       Bus bus = BusFactory.newInstance().createBus();
> > >> >       BusFactory.setDefaultBus(bus);
> > >> >
> > >> >       // snap of code from
> > >> > AbstractCXFServlet.replaceDestinationFactory()
> > >> >
> > >> >       DestinationFactoryManager dfm =
> > >> > bus.getExtension(DestinationFactoryManager.class);
> > >> >       try {
> > >> >           DestinationFactory df = dfm.getDestinationFactory("
> > >> > http://cxf.apache.org/transports/http/configuration");
> > >> >           if (df instanceof ServletTransportFactory) {
> > >> >             ServletTransportFactory servletTransportFactory =
> > >> > (ServletTransportFactory)df;
> > >> >               LOG.info("DESTIONFACTORY_ALREADY_REGISTERED");
> > >> >               return;
> > >> >           }
> > >> >       } catch (BusException e) {
> > >> >       }
> > >> >
> > >> >       DestinationFactory factory = new
> > >> > ServletTransportFactory(bus);
> > >> >
> > >> >
> > >> >       for (String s : factory.getTransportIds()) {
> > >> >
> > >> > bus.getExtension(DestinationFactoryManager.class).registerDestina
> > >> >tionF actory(s, factory);
> > >> >       }
> > >> >       LOG.info("REPLACED_HTTP_DESTIONFACTORY");
> > >> >
> > >> >       DestinationFactoryManager factoryManager =
> > >> > bus.getExtension(DestinationFactoryManager.class);
> > >> >
> > >> >       String address = "
> > >> > http://localhost:8080/ws-examples/soap/services/TicketOrderServic
> > >> >e"; TicketOrderServiceImpl implementor = new
> > >> > TicketOrderServiceImpl(); Endpoint.publish(address, implementor);
> > >> > ...
> > >> > -----------------------------------------------------------------
> > >> >----- ----------------------
> > >> >
> > >> >
> > >> > In the MyCxfNonSpringServlet
> > >> > -----------------------------------------------------------------
> > >> >----- ------------------------- ...
> > >> >   @Override
> > >> >   public void loadBus(ServletConfig servletConfig) throws
> > >> > ServletException { super.loadBus(servletConfig);
> > >> >     LOG.info("loadBus method entering");
> > >> >
> > >> >     Bus bus = getBus();
> > >> >     BusFactory.setDefaultBus(bus);
> > >> >   }
> > >> >
> > >> >   @Override
> > >> >   public ServletController createServletController(ServletConfig
> > >> > servletConfig) {
> > >> >     DestinationFactoryManager dfm =
> > >> > bus.getExtension(DestinationFactoryManager.class);
> > >> >     try {
> > >> >       servletTransportFactory = (ServletTransportFactory)
> > >> > dfm.getDestinationFactory("
> > >> > http://cxf.apache.org/transports/http/configuration");
> > >> >     } catch (Exception e) {
> > >> >       e.printStackTrace();
> > >> >     }
> > >> >     return super.createServletController(servletConfig);
> > >> >   }
> > >> > ...
> > >> > -----------------------------------------------------------------
> > >> >----- -------------------------
> > >> >
> > >> >
> > >> > In the process of deployment were not exceptions.
> > >> >
> > >> > On a console:
> > >> > [INFO] WebServiceLoader - REPLACED_HTTP_DESTIONFACTORY
> > >> >
> > >> > On a browser at url:
> > >> > http://localhost:8080/ws-examples/soap/services/TicketOrderServic
> > >> >e?wsd l "No service was found."
> > >> >
> > >> > On Wed, Oct 1, 2008 at 8:51 PM, Daniel Kulp <dk...@apache.org>
> wrote:
> > >> > > I think it's possible, but it's certainly not trivial.
> > >> > >
> > >> > > Looking at the code in the AbstractCXFServlet, it LOOKS like
> > >> > > you could do:
> > >> > >
> > >> > > 1) Before creating your services, if you create a bus and add
> > >> > > the servlet transport into it.   You can take that code from
> > >> > > replaceDestinationFactory in the AbstractCXFSerlvlet.   That
> > >> > > should allow the services to register fine.
> > >> > >
> > >> > > 2) In you servlet subclass, override the
> > >> > > createServletController to do:
> > >> > >
> > >> > > DestinationFactoryManager dfm =
> > >> > >     bus.getExtension(DestinationFactoryManager.class);
> > >> > > servletTransportFactory = (SerlvetTransportFactory)
> > >> > >     dfm.getDestinationFactory(
> > >> > >
> > >> > > "http://cxf.apache.org/transports/http/configuration");
> > >> > > super.createServletController(....);
> > >> > >
> > >> > > That looks like it SHOULD work.
> > >> > >
> > >> > > Dan
> > >> > >
> > >> > > On Wednesday 01 October 2008, Alexey Zavizionov wrote:
> > >> > > > Hello list,
> > >> > > >
> > >> > > > Is there a CXF API methods to hold on deploy service from
> > >> > > > listener before MyCxfNonSpringServlet servlet is started.
> > >> > > > Will it work with register service to the servlet context
> > >> > > > outside servlet code?
> > >> > > >
> > >> > > > Thanks and regards,
> > >> > > > Alexey.
> > >> > > >
> > >> > > > On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
> > >> > > >
> > >> > > > alexey.zavizionov@gmail.com> wrote:
> > >> > > > > Thanks for reply,
> > >> > > > >
> > >> > > > > NOTE: I have a listener which starts before
> > >> > > > > MyCxfNonSpringServlet is deployed.
> > >> > > > >    All code for registering endpoint I moved to the
> > >> > > > > listener.
> > >> > > > >
> > >> > > > > How can I register the servlets transport factory with the
> > >> > > > > bus?
> > >> > > > >
> > >> > > > > Regards,
> > >> > > > > Alexey.
> > >> > > > >
> > >> > > > > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp
> > >> > > > > <dk...@apache.org>
> > >> > >
> > >> > > wrote:
> > >> > > > >> It looks like the servlets transport factory is not
> > >> > > > >> registered with the bus.
> > >> > > > >> Are you subclassing our CXFNonSpringServlet or similar to
> > >> > > > >> make sure the appropriate transport is setup to handle
> > >> > > > >> that namespace?
> > >> > > > >>
> > >> > > > >> Dan
> > >> > > > >>
> > >> > > > >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov
> wrote:
> > >> > > > >> > Hello list,
> > >> > > > >> >
> > >> > > > >> > I published services within test unit and in a servlet
> > >> > > > >> > (nonspring) successfully with command
> > >> > > > >> > "Endpoint.publish(address, object);".
> > >> > > > >> >
> > >> > > > >> > But, the same thing has failed within listener (in the
> > >> > > > >> > Tomcat ).
> > >> > > > >> >
> > >> > > > >> > Does somebody have publish your service within listener?
> > >> > > > >> >
> > >> > > > >> > INFO: Creating Service
> > >> > > > >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> <
> > >> > > > >> >http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> > >>
> > >> <http:
> > >> > > > >> >//exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> > >> > >
> > >> > > <http://ex
> > >> > >
> > >> > > > >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
> > >> > > > >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderServi
> > >> > > > >> >ce org.picocontainer.PicoIntrospectionException: Failed
> > >> > > > >> > when calling start
> > >> > > > >>
> > >> > > > >> on
> > >> > > > >>
> > >> > > > >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7b
> > >> > > > >> >c899 at
> > >>
> > >>
> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > >> > > > >> >81) at
> > >> > > > >>
> > >> > > > >> org.picocontainer.defaults.LifecycleVisitor.start(Lifecycl
> > >> > > > >>eVisi tor. java:113
> > >> > > > >>
> > >> > > > >> >) at
> > >> > > > >>
> > >> > > > >> org.picocontainer.defaults.DefaultPicoContainer.start(Defa
> > >> > > > >>ultPi coCo ntainer.
> > >> > > > >>
> > >> > > > >> >java:369) at
> > >> > > > >>
> > >> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(
> > >> > > > >>Stand alon eContain
> > >> > > > >>
> > >> > > > >> >er.java:124) at
> > >> > > > >>
> > >> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(
> > >> > > > >>Stand alon eContain
> > >> > > > >>
> > >> > > > >> >er.java:91) at
> > >> > > > >>
> > >> > > > >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerI
> > >> > > > >>nitia lize dListene
> > >> > > > >>
> > >> > > > >> >r.contextInitialized(StandaloneContainerInitializedListen
> > >> > > > >> >er.ja va:7 1) at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.core.StandardContext.listenerStart(Sta
> > >> > > > >>ndard Cont ext.java
> > >> > > > >>
> > >> > > > >> >:3827) at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.core.StandardContext.start(StandardCon
> > >> > > > >>text. java
> > >> > > > >>
> > >> > > > >>:4336)
> > >> > > > >>:
> > >> > > > >> >         at
> > >>
> > >>
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> > >> > > > >> >761) at
> > >> > > > >> > org.apache.catalina.core.ContainerBase.addChild(Containe
> > >> > > > >> >rBase .jav a:741) at
> > >> > > > >> > org.apache.catalina.core.StandardHost.addChild(StandardH
> > >> > > > >> >ost.j ava: 525) at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptor(Ho
> > >> > > > >>stCon fig. java:626
> > >> > > > >>
> > >> > > > >> >) at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptors(H
> > >> > > > >>ostCo nfig .java:55
> > >> > > > >>
> > >> > > > >> >3) at
> > >> > > > >> > org.apache.catalina.startup.HostConfig.deployApps(HostCo
> > >> > > > >> >nfig. java
> > >> > > > >> >
> > >> > > > >> >:488) at
> > >> > > > >> >
> > >> > > > >> > org.apache.catalina.startup.HostConfig.start(HostConfig.
> > >> > > > >> >java: 1138 ) at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.startup.HostConfig.lifecycleEvent(Host
> > >> > > > >>Confi g.ja va:311)
> > >> > > > >>
> > >> > > > >> >         at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEve
> > >> > > > >>nt(Li fecy cleSuppo
> > >> > > > >>
> > >> > > > >> >rt.java:120) at
> > >> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBa
> > >> > > > >> >se.ja va:1 023) at
> > >> > > > >> > org.apache.catalina.core.StandardHost.start(StandardHost
> > >> > > > >> >.java
> > >> > > > >> >
> > >> > > > >> >:719 ) at
> > >> > > > >> >
> > >> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBa
> > >> > > > >> >se.ja va:1 015) at
> > >> > > > >> > org.apache.catalina.core.StandardEngine.start(StandardEn
> > >> > > > >> >gine. java
> > >> > > > >> >
> > >> > > > >> >:443) at
> > >> > > > >> >
> > >> > > > >> > org.apache.catalina.core.StandardService.start(StandardS
> > >> > > > >> >ervic e.ja va:448) at
> > >> > > > >> > org.apache.catalina.core.StandardServer.start(StandardSe
> > >> > > > >> >rver. java
> > >> > > > >> >
> > >> > > > >> >:710) at
> > >> > > > >> >
> > >> > > > >> > org.apache.catalina.startup.Catalina.start(Catalina.java
> > >> > > > >> >:552) at
> > >> > > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > >> > > > >> > Method) at
> > >> > > > >>
> > >> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAc
> > >> > > > >>cesso rImp l.java:3
> > >> > > > >>
> > >> > > > >> >9) at
> > >> > > > >>
> > >> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
> > >> > > > >>Metho dAcc essorImp
> > >> > > > >>
> > >> > > > >> >l.java:25) at
> > >> > > > >> > java.lang.reflect.Method.invoke(Method.java:585) at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java
> > >> > > > >>:288)
> > >> > > > >>
> > >> > > > >> >         at
> > >> > > > >>
> > >> > > > >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
> > >> > > > >>413)
> > >> > > > >>
> > >> > > > >> > Caused by: java.lang.RuntimeException: Could not find
> > >> > > > >> > destination
> > >> > > > >>
> > >> > > > >> factory
> > >> > > > >>
> > >> > > > >> > for transport http://schemas.xmlsoap.org/soap/http
> > >> > > > >> >         at
> > >> > > > >>
> > >> > > > >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestin
> > >> > > > >>ation (Soa pTranspo
> > >> > > > >>
> > >> > > > >> >rtFactory.java:76) at
> > >> > > > >> > org.apache.cxf.endpoint.ServerImpl.initDestination(Serve
> > >> > > > >> >rImpl .jav a:90) at
> > >> > > > >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.jav
> > >> > > > >> >a:69) at
> > >> > > > >>
> > >> > > > >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFac
> > >> > > > >>toryB ean. java:117
> > >> > > > >>
> > >> > > > >> >) at
> > >> > > > >>
> > >> > > > >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsSe
> > >> > > > >>rverF acto ryBean.j
> > >> > > > >>
> > >> > > > >> >ava:168) at
> > >> > > > >>
> > >> > > > >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeplo
> > >> > > > >>yServ ice( CXFUtils
> > >> > > > >>
> > >> > > > >> >.java:83) at
> > >> > > > >>
> > >> > > > >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.star
> > >> > > > >>t(Web Serv iceLoade
> > >> > > > >>
> > >> > > > >> >r.java:82) at
> > >> > > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > >> > > > >> > Method)
> > >> > > > >>
> > >> > > > >> at
> > >> > > > >>
> > >> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAc
> > >> > > > >>cesso rImp l.java:3
> > >> > > > >>
> > >> > > > >> >9) at
> > >> > > > >>
> > >> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
> > >> > > > >>Metho dAcc essorImp
> > >> > > > >>
> > >> > > > >> >l.java:25) at
> > >> > > > >> > java.lang.reflect.Method.invoke(Method.java:585) at
> > >>
> > >>
> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > >> > > > >> >75) ... 29 more
> > >> > > > >> >
> > >> > > > >> > Regards,
> > >> > > > >> > Alexey.
> > >> > > > >>
> > >> > > > >> --
> > >> > > > >> Daniel Kulp
> > >> > > > >> dkulp@apache.org
> > >> > > > >> http://www.dankulp.com/blog
> > >> > >
> > >> > > --
> > >> > > J. Daniel Kulp
> > >> > > Principal Engineer, IONA
> > >> > > dkulp@apache.org
> > >> > > http://www.dankulp.com/blog
> > >>
> > >> --
> > >> J. Daniel Kulp
> > >> dkulp@apache.org
> > >> http://www.dankulp.com/blog
>
>
>
> --
> J. Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Daniel Kulp <dk...@apache.org>.
Is there anyway you could package up a simple example project with your 
listener and servlet (and a simple hello world service type thing) and 
send it along to me?   I can then step through parts of it in the 
debugger to see what is going on.    If the Bus is the same, it really 
looks like it should have worked.  :-(

Thanks!
Dan


On Friday 03 October 2008, Alexey Zavizionov wrote:
> Ok, I have the same objects of Bus in both classes listener and
> servlet. In a browser the same message "No service was found.".
>
> Iit doesn't work. Why?
>
> On Fri, Oct 3, 2008 at 10:26 AM, Alexey Zavizionov <
>
> alexey.zavizionov@gmail.com> wrote:
> > There are different buses.
> >
> > Listener:
> > >>> EXOMAN MyListener.start() 2 = 2
> > >>> EXOMAN MyListener.start() bus =
> >
> > org.apache.cxf.bus.extension.ExtensionManagerBus@162ba99
> >
> > >>> EXOMAN MyListener.start() System.identityHashCode(bus) =
> > >>> 23247513
> >
> > Servlet:
> > [INFO] MyCxfNonSpringServlet - loadBus method entering
> >
> > >>> EXOMAN MyCxfNonSpringServlet.loadBus() bus =
> >
> > org.apache.cxf.bus.extension.ExtensionManagerBus@1e9f5cc
> >
> > >>> EXOMAN MyCxfNonSpringServlet.loadBus()
> > >>> System.identityHashCode(bus) =
> >
> > 32110028
> >
> > Thanks and regards,
> > Alexey
> >
> > On Thu, Oct 2, 2008 at 10:15 PM, Daniel Kulp <dk...@apache.org> 
wrote:
> >> That all looks correct.    The only thing I can think of is if a
> >> different Bus is getting used in the servlet.   Can you do
> >> something like:
> >> System.out.println(System.identityHashCode(bus));
> >> in your listener and in your servlet to see if they are the same.  
> >> If not, that's definitely the issue.
> >>
> >> You MAY need to stick the Bus into a static variable or something
> >> to make sure the correct Bus is used.
> >>
> >> Dan
> >>
> >> On Thursday 02 October 2008, Alexey Zavizionov wrote:
> >> > Hello Dan,
> >> >
> >> > I tried different ways to do it but I did not get successful
> >> > result. What did I do wrong?
> >> >
> >> > In the listener code:
> >> > -----------------------------------------------------------------
> >> >----- ---------------------- ...
> >> >       Bus bus = BusFactory.newInstance().createBus();
> >> >       BusFactory.setDefaultBus(bus);
> >> >
> >> >       // snap of code from
> >> > AbstractCXFServlet.replaceDestinationFactory()
> >> >
> >> >       DestinationFactoryManager dfm =
> >> > bus.getExtension(DestinationFactoryManager.class);
> >> >       try {
> >> >           DestinationFactory df = dfm.getDestinationFactory("
> >> > http://cxf.apache.org/transports/http/configuration");
> >> >           if (df instanceof ServletTransportFactory) {
> >> >             ServletTransportFactory servletTransportFactory =
> >> > (ServletTransportFactory)df;
> >> >               LOG.info("DESTIONFACTORY_ALREADY_REGISTERED");
> >> >               return;
> >> >           }
> >> >       } catch (BusException e) {
> >> >       }
> >> >
> >> >       DestinationFactory factory = new
> >> > ServletTransportFactory(bus);
> >> >
> >> >
> >> >       for (String s : factory.getTransportIds()) {
> >> >
> >> > bus.getExtension(DestinationFactoryManager.class).registerDestina
> >> >tionF actory(s, factory);
> >> >       }
> >> >       LOG.info("REPLACED_HTTP_DESTIONFACTORY");
> >> >
> >> >       DestinationFactoryManager factoryManager =
> >> > bus.getExtension(DestinationFactoryManager.class);
> >> >
> >> >       String address = "
> >> > http://localhost:8080/ws-examples/soap/services/TicketOrderServic
> >> >e"; TicketOrderServiceImpl implementor = new
> >> > TicketOrderServiceImpl(); Endpoint.publish(address, implementor);
> >> > ...
> >> > -----------------------------------------------------------------
> >> >----- ----------------------
> >> >
> >> >
> >> > In the MyCxfNonSpringServlet
> >> > -----------------------------------------------------------------
> >> >----- ------------------------- ...
> >> >   @Override
> >> >   public void loadBus(ServletConfig servletConfig) throws
> >> > ServletException { super.loadBus(servletConfig);
> >> >     LOG.info("loadBus method entering");
> >> >
> >> >     Bus bus = getBus();
> >> >     BusFactory.setDefaultBus(bus);
> >> >   }
> >> >
> >> >   @Override
> >> >   public ServletController createServletController(ServletConfig
> >> > servletConfig) {
> >> >     DestinationFactoryManager dfm =
> >> > bus.getExtension(DestinationFactoryManager.class);
> >> >     try {
> >> >       servletTransportFactory = (ServletTransportFactory)
> >> > dfm.getDestinationFactory("
> >> > http://cxf.apache.org/transports/http/configuration");
> >> >     } catch (Exception e) {
> >> >       e.printStackTrace();
> >> >     }
> >> >     return super.createServletController(servletConfig);
> >> >   }
> >> > ...
> >> > -----------------------------------------------------------------
> >> >----- -------------------------
> >> >
> >> >
> >> > In the process of deployment were not exceptions.
> >> >
> >> > On a console:
> >> > [INFO] WebServiceLoader - REPLACED_HTTP_DESTIONFACTORY
> >> >
> >> > On a browser at url:
> >> > http://localhost:8080/ws-examples/soap/services/TicketOrderServic
> >> >e?wsd l "No service was found."
> >> >
> >> > On Wed, Oct 1, 2008 at 8:51 PM, Daniel Kulp <dk...@apache.org> 
wrote:
> >> > > I think it's possible, but it's certainly not trivial.
> >> > >
> >> > > Looking at the code in the AbstractCXFServlet, it LOOKS like
> >> > > you could do:
> >> > >
> >> > > 1) Before creating your services, if you create a bus and add
> >> > > the servlet transport into it.   You can take that code from
> >> > > replaceDestinationFactory in the AbstractCXFSerlvlet.   That
> >> > > should allow the services to register fine.
> >> > >
> >> > > 2) In you servlet subclass, override the
> >> > > createServletController to do:
> >> > >
> >> > > DestinationFactoryManager dfm =
> >> > >     bus.getExtension(DestinationFactoryManager.class);
> >> > > servletTransportFactory = (SerlvetTransportFactory)
> >> > >     dfm.getDestinationFactory(
> >> > >          
> >> > > "http://cxf.apache.org/transports/http/configuration");
> >> > > super.createServletController(....);
> >> > >
> >> > > That looks like it SHOULD work.
> >> > >
> >> > > Dan
> >> > >
> >> > > On Wednesday 01 October 2008, Alexey Zavizionov wrote:
> >> > > > Hello list,
> >> > > >
> >> > > > Is there a CXF API methods to hold on deploy service from
> >> > > > listener before MyCxfNonSpringServlet servlet is started.
> >> > > > Will it work with register service to the servlet context
> >> > > > outside servlet code?
> >> > > >
> >> > > > Thanks and regards,
> >> > > > Alexey.
> >> > > >
> >> > > > On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
> >> > > >
> >> > > > alexey.zavizionov@gmail.com> wrote:
> >> > > > > Thanks for reply,
> >> > > > >
> >> > > > > NOTE: I have a listener which starts before
> >> > > > > MyCxfNonSpringServlet is deployed.
> >> > > > >    All code for registering endpoint I moved to the
> >> > > > > listener.
> >> > > > >
> >> > > > > How can I register the servlets transport factory with the
> >> > > > > bus?
> >> > > > >
> >> > > > > Regards,
> >> > > > > Alexey.
> >> > > > >
> >> > > > > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp
> >> > > > > <dk...@apache.org>
> >> > >
> >> > > wrote:
> >> > > > >> It looks like the servlets transport factory is not
> >> > > > >> registered with the bus.
> >> > > > >> Are you subclassing our CXFNonSpringServlet or similar to
> >> > > > >> make sure the appropriate transport is setup to handle
> >> > > > >> that namespace?
> >> > > > >>
> >> > > > >> Dan
> >> > > > >>
> >> > > > >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov 
wrote:
> >> > > > >> > Hello list,
> >> > > > >> >
> >> > > > >> > I published services within test unit and in a servlet
> >> > > > >> > (nonspring) successfully with command
> >> > > > >> > "Endpoint.publish(address, object);".
> >> > > > >> >
> >> > > > >> > But, the same thing has failed within listener (in the
> >> > > > >> > Tomcat ).
> >> > > > >> >
> >> > > > >> > Does somebody have publish your service within listener?
> >> > > > >> >
> >> > > > >> > INFO: Creating Service
> >> > > > >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<
> >> > > > >> >http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> >>
> >> <http:
> >> > > > >> >//exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> >> > >
> >> > > <http://ex
> >> > >
> >> > > > >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
> >> > > > >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderServi
> >> > > > >> >ce org.picocontainer.PicoIntrospectionException: Failed
> >> > > > >> > when calling start
> >> > > > >>
> >> > > > >> on
> >> > > > >>
> >> > > > >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7b
> >> > > > >> >c899 at
> >>
> >> 
org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> >> > > > >> >81) at
> >> > > > >>
> >> > > > >> org.picocontainer.defaults.LifecycleVisitor.start(Lifecycl
> >> > > > >>eVisi tor. java:113
> >> > > > >>
> >> > > > >> >) at
> >> > > > >>
> >> > > > >> org.picocontainer.defaults.DefaultPicoContainer.start(Defa
> >> > > > >>ultPi coCo ntainer.
> >> > > > >>
> >> > > > >> >java:369) at
> >> > > > >>
> >> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(
> >> > > > >>Stand alon eContain
> >> > > > >>
> >> > > > >> >er.java:124) at
> >> > > > >>
> >> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(
> >> > > > >>Stand alon eContain
> >> > > > >>
> >> > > > >> >er.java:91) at
> >> > > > >>
> >> > > > >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerI
> >> > > > >>nitia lize dListene
> >> > > > >>
> >> > > > >> >r.contextInitialized(StandaloneContainerInitializedListen
> >> > > > >> >er.ja va:7 1) at
> >> > > > >>
> >> > > > >> org.apache.catalina.core.StandardContext.listenerStart(Sta
> >> > > > >>ndard Cont ext.java
> >> > > > >>
> >> > > > >> >:3827) at
> >> > > > >>
> >> > > > >> org.apache.catalina.core.StandardContext.start(StandardCon
> >> > > > >>text. java
> >> > > > >>
> >> > > > >>:4336)
> >> > > > >>:
> >> > > > >> >         at
> >>
> >> 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> >> > > > >> >761) at
> >> > > > >> > org.apache.catalina.core.ContainerBase.addChild(Containe
> >> > > > >> >rBase .jav a:741) at
> >> > > > >> > org.apache.catalina.core.StandardHost.addChild(StandardH
> >> > > > >> >ost.j ava: 525) at
> >> > > > >>
> >> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptor(Ho
> >> > > > >>stCon fig. java:626
> >> > > > >>
> >> > > > >> >) at
> >> > > > >>
> >> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptors(H
> >> > > > >>ostCo nfig .java:55
> >> > > > >>
> >> > > > >> >3) at
> >> > > > >> > org.apache.catalina.startup.HostConfig.deployApps(HostCo
> >> > > > >> >nfig. java
> >> > > > >> >
> >> > > > >> >:488) at
> >> > > > >> >
> >> > > > >> > org.apache.catalina.startup.HostConfig.start(HostConfig.
> >> > > > >> >java: 1138 ) at
> >> > > > >>
> >> > > > >> org.apache.catalina.startup.HostConfig.lifecycleEvent(Host
> >> > > > >>Confi g.ja va:311)
> >> > > > >>
> >> > > > >> >         at
> >> > > > >>
> >> > > > >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEve
> >> > > > >>nt(Li fecy cleSuppo
> >> > > > >>
> >> > > > >> >rt.java:120) at
> >> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBa
> >> > > > >> >se.ja va:1 023) at
> >> > > > >> > org.apache.catalina.core.StandardHost.start(StandardHost
> >> > > > >> >.java
> >> > > > >> >
> >> > > > >> >:719 ) at
> >> > > > >> >
> >> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBa
> >> > > > >> >se.ja va:1 015) at
> >> > > > >> > org.apache.catalina.core.StandardEngine.start(StandardEn
> >> > > > >> >gine. java
> >> > > > >> >
> >> > > > >> >:443) at
> >> > > > >> >
> >> > > > >> > org.apache.catalina.core.StandardService.start(StandardS
> >> > > > >> >ervic e.ja va:448) at
> >> > > > >> > org.apache.catalina.core.StandardServer.start(StandardSe
> >> > > > >> >rver. java
> >> > > > >> >
> >> > > > >> >:710) at
> >> > > > >> >
> >> > > > >> > org.apache.catalina.startup.Catalina.start(Catalina.java
> >> > > > >> >:552) at
> >> > > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> > > > >> > Method) at
> >> > > > >>
> >> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAc
> >> > > > >>cesso rImp l.java:3
> >> > > > >>
> >> > > > >> >9) at
> >> > > > >>
> >> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
> >> > > > >>Metho dAcc essorImp
> >> > > > >>
> >> > > > >> >l.java:25) at
> >> > > > >> > java.lang.reflect.Method.invoke(Method.java:585) at
> >> > > > >>
> >> > > > >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java
> >> > > > >>:288)
> >> > > > >>
> >> > > > >> >         at
> >> > > > >>
> >> > > > >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
> >> > > > >>413)
> >> > > > >>
> >> > > > >> > Caused by: java.lang.RuntimeException: Could not find
> >> > > > >> > destination
> >> > > > >>
> >> > > > >> factory
> >> > > > >>
> >> > > > >> > for transport http://schemas.xmlsoap.org/soap/http
> >> > > > >> >         at
> >> > > > >>
> >> > > > >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestin
> >> > > > >>ation (Soa pTranspo
> >> > > > >>
> >> > > > >> >rtFactory.java:76) at
> >> > > > >> > org.apache.cxf.endpoint.ServerImpl.initDestination(Serve
> >> > > > >> >rImpl .jav a:90) at
> >> > > > >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.jav
> >> > > > >> >a:69) at
> >> > > > >>
> >> > > > >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFac
> >> > > > >>toryB ean. java:117
> >> > > > >>
> >> > > > >> >) at
> >> > > > >>
> >> > > > >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsSe
> >> > > > >>rverF acto ryBean.j
> >> > > > >>
> >> > > > >> >ava:168) at
> >> > > > >>
> >> > > > >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeplo
> >> > > > >>yServ ice( CXFUtils
> >> > > > >>
> >> > > > >> >.java:83) at
> >> > > > >>
> >> > > > >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.star
> >> > > > >>t(Web Serv iceLoade
> >> > > > >>
> >> > > > >> >r.java:82) at
> >> > > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> > > > >> > Method)
> >> > > > >>
> >> > > > >> at
> >> > > > >>
> >> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAc
> >> > > > >>cesso rImp l.java:3
> >> > > > >>
> >> > > > >> >9) at
> >> > > > >>
> >> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
> >> > > > >>Metho dAcc essorImp
> >> > > > >>
> >> > > > >> >l.java:25) at
> >> > > > >> > java.lang.reflect.Method.invoke(Method.java:585) at
> >>
> >> 
org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> >> > > > >> >75) ... 29 more
> >> > > > >> >
> >> > > > >> > Regards,
> >> > > > >> > Alexey.
> >> > > > >>
> >> > > > >> --
> >> > > > >> Daniel Kulp
> >> > > > >> dkulp@apache.org
> >> > > > >> http://www.dankulp.com/blog
> >> > >
> >> > > --
> >> > > J. Daniel Kulp
> >> > > Principal Engineer, IONA
> >> > > dkulp@apache.org
> >> > > http://www.dankulp.com/blog
> >>
> >> --
> >> J. Daniel Kulp
> >> dkulp@apache.org
> >> http://www.dankulp.com/blog



-- 
J. Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Alexey Zavizionov <al...@gmail.com>.
Ok, I have the same objects of Bus in both classes listener and servlet.
In a browser the same message "No service was found.".

Iit doesn't work. Why?

On Fri, Oct 3, 2008 at 10:26 AM, Alexey Zavizionov <
alexey.zavizionov@gmail.com> wrote:

> There are different buses.
>
> Listener:
> >>> EXOMAN MyListener.start() 2 = 2
> >>> EXOMAN MyListener.start() bus =
> org.apache.cxf.bus.extension.ExtensionManagerBus@162ba99
> >>> EXOMAN MyListener.start() System.identityHashCode(bus) = 23247513
>
> Servlet:
> [INFO] MyCxfNonSpringServlet - loadBus method entering
> >>> EXOMAN MyCxfNonSpringServlet.loadBus() bus =
> org.apache.cxf.bus.extension.ExtensionManagerBus@1e9f5cc
> >>> EXOMAN MyCxfNonSpringServlet.loadBus() System.identityHashCode(bus) =
> 32110028
>
> Thanks and regards,
> Alexey
>
>
> On Thu, Oct 2, 2008 at 10:15 PM, Daniel Kulp <dk...@apache.org> wrote:
>
>>
>>
>> That all looks correct.    The only thing I can think of is if a
>> different Bus is getting used in the servlet.   Can you do something
>> like:
>> System.out.println(System.identityHashCode(bus));
>> in your listener and in your servlet to see if they are the same.   If
>> not, that's definitely the issue.
>>
>> You MAY need to stick the Bus into a static variable or something to make
>> sure the correct Bus is used.
>>
>> Dan
>>
>>
>> On Thursday 02 October 2008, Alexey Zavizionov wrote:
>> > Hello Dan,
>> >
>> > I tried different ways to do it but I did not get successful result.
>> > What did I do wrong?
>> >
>> > In the listener code:
>> > ----------------------------------------------------------------------
>> >---------------------- ...
>> >       Bus bus = BusFactory.newInstance().createBus();
>> >       BusFactory.setDefaultBus(bus);
>> >
>> >       // snap of code from
>> > AbstractCXFServlet.replaceDestinationFactory()
>> >
>> >       DestinationFactoryManager dfm =
>> > bus.getExtension(DestinationFactoryManager.class);
>> >       try {
>> >           DestinationFactory df = dfm.getDestinationFactory("
>> > http://cxf.apache.org/transports/http/configuration");
>> >           if (df instanceof ServletTransportFactory) {
>> >             ServletTransportFactory servletTransportFactory =
>> > (ServletTransportFactory)df;
>> >               LOG.info("DESTIONFACTORY_ALREADY_REGISTERED");
>> >               return;
>> >           }
>> >       } catch (BusException e) {
>> >       }
>> >
>> >       DestinationFactory factory = new ServletTransportFactory(bus);
>> >
>> >
>> >       for (String s : factory.getTransportIds()) {
>> >
>> > bus.getExtension(DestinationFactoryManager.class).registerDestinationF
>> >actory(s, factory);
>> >       }
>> >       LOG.info("REPLACED_HTTP_DESTIONFACTORY");
>> >
>> >       DestinationFactoryManager factoryManager =
>> > bus.getExtension(DestinationFactoryManager.class);
>> >
>> >       String address = "
>> > http://localhost:8080/ws-examples/soap/services/TicketOrderService";
>> >       TicketOrderServiceImpl implementor = new
>> > TicketOrderServiceImpl(); Endpoint.publish(address, implementor);
>> > ...
>> > ----------------------------------------------------------------------
>> >----------------------
>> >
>> >
>> > In the MyCxfNonSpringServlet
>> > ----------------------------------------------------------------------
>> >------------------------- ...
>> >   @Override
>> >   public void loadBus(ServletConfig servletConfig) throws
>> > ServletException { super.loadBus(servletConfig);
>> >     LOG.info("loadBus method entering");
>> >
>> >     Bus bus = getBus();
>> >     BusFactory.setDefaultBus(bus);
>> >   }
>> >
>> >   @Override
>> >   public ServletController createServletController(ServletConfig
>> > servletConfig) {
>> >     DestinationFactoryManager dfm =
>> > bus.getExtension(DestinationFactoryManager.class);
>> >     try {
>> >       servletTransportFactory = (ServletTransportFactory)
>> > dfm.getDestinationFactory("
>> > http://cxf.apache.org/transports/http/configuration");
>> >     } catch (Exception e) {
>> >       e.printStackTrace();
>> >     }
>> >     return super.createServletController(servletConfig);
>> >   }
>> > ...
>> > ----------------------------------------------------------------------
>> >-------------------------
>> >
>> >
>> > In the process of deployment were not exceptions.
>> >
>> > On a console:
>> > [INFO] WebServiceLoader - REPLACED_HTTP_DESTIONFACTORY
>> >
>> > On a browser at url:
>> > http://localhost:8080/ws-examples/soap/services/TicketOrderService?wsd
>> >l "No service was found."
>> >
>> > On Wed, Oct 1, 2008 at 8:51 PM, Daniel Kulp <dk...@apache.org> wrote:
>> > > I think it's possible, but it's certainly not trivial.
>> > >
>> > > Looking at the code in the AbstractCXFServlet, it LOOKS like you
>> > > could do:
>> > >
>> > > 1) Before creating your services, if you create a bus and add the
>> > > servlet transport into it.   You can take that code from
>> > > replaceDestinationFactory in the AbstractCXFSerlvlet.   That should
>> > > allow the services to register fine.
>> > >
>> > > 2) In you servlet subclass, override the createServletController to
>> > > do:
>> > >
>> > > DestinationFactoryManager dfm =
>> > >     bus.getExtension(DestinationFactoryManager.class);
>> > > servletTransportFactory = (SerlvetTransportFactory)
>> > >     dfm.getDestinationFactory(
>> > >           "http://cxf.apache.org/transports/http/configuration");
>> > > super.createServletController(....);
>> > >
>> > > That looks like it SHOULD work.
>> > >
>> > > Dan
>> > >
>> > > On Wednesday 01 October 2008, Alexey Zavizionov wrote:
>> > > > Hello list,
>> > > >
>> > > > Is there a CXF API methods to hold on deploy service from listener
>> > > > before MyCxfNonSpringServlet servlet is started.
>> > > > Will it work with register service to the servlet context outside
>> > > > servlet code?
>> > > >
>> > > > Thanks and regards,
>> > > > Alexey.
>> > > >
>> > > > On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
>> > > >
>> > > > alexey.zavizionov@gmail.com> wrote:
>> > > > > Thanks for reply,
>> > > > >
>> > > > > NOTE: I have a listener which starts before
>> > > > > MyCxfNonSpringServlet is deployed.
>> > > > >    All code for registering endpoint I moved to the listener.
>> > > > >
>> > > > > How can I register the servlets transport factory with the bus?
>> > > > >
>> > > > > Regards,
>> > > > > Alexey.
>> > > > >
>> > > > > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp <dk...@apache.org>
>> > >
>> > > wrote:
>> > > > >> It looks like the servlets transport factory is not registered
>> > > > >> with the bus.
>> > > > >> Are you subclassing our CXFNonSpringServlet or similar to make
>> > > > >> sure the appropriate transport is setup to handle that
>> > > > >> namespace?
>> > > > >>
>> > > > >> Dan
>> > > > >>
>> > > > >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov wrote:
>> > > > >> > Hello list,
>> > > > >> >
>> > > > >> > I published services within test unit and in a servlet
>> > > > >> > (nonspring) successfully with command
>> > > > >> > "Endpoint.publish(address, object);".
>> > > > >> >
>> > > > >> > But, the same thing has failed within listener (in the Tomcat
>> > > > >> > ).
>> > > > >> >
>> > > > >> > Does somebody have publish your service within listener?
>> > > > >> >
>> > > > >> > INFO: Creating Service
>> > > > >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
>> <http:
>> > > > >> >//exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
>> > >
>> > > <http://ex
>> > >
>> > > > >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
>> > > > >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderService
>> > > > >> > org.picocontainer.PicoIntrospectionException: Failed when
>> > > > >> > calling start
>> > > > >>
>> > > > >> on
>> > > > >>
>> > > > >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7bc899
>> > > > >> >         at
>> > >
>> > >
>>
>> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
>> > > > >> >81) at
>> > > > >>
>> > > > >> org.picocontainer.defaults.LifecycleVisitor.start(LifecycleVisi
>> > > > >>tor. java:113
>> > > > >>
>> > > > >> >) at
>> > > > >>
>> > > > >> org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPi
>> > > > >>coCo ntainer.
>> > > > >>
>> > > > >> >java:369) at
>> > > > >>
>> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(Stand
>> > > > >>alon eContain
>> > > > >>
>> > > > >> >er.java:124) at
>> > > > >>
>> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(Stand
>> > > > >>alon eContain
>> > > > >>
>> > > > >> >er.java:91) at
>> > > > >>
>> > > > >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerInitia
>> > > > >>lize dListene
>> > > > >>
>> > > > >> >r.contextInitialized(StandaloneContainerInitializedListener.ja
>> > > > >> >va:7 1) at
>> > > > >>
>> > > > >> org.apache.catalina.core.StandardContext.listenerStart(Standard
>> > > > >>Cont ext.java
>> > > > >>
>> > > > >> >:3827) at
>> > > > >>
>> > > > >> org.apache.catalina.core.StandardContext.start(StandardContext.
>> > > > >>java
>> > > > >>
>> > > > >>:4336)
>> > > > >>:
>> > > > >> >         at
>> > >
>> > >
>>
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
>> > > > >> >761) at
>> > > > >> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase
>> > > > >> >.jav a:741) at
>> > > > >> > org.apache.catalina.core.StandardHost.addChild(StandardHost.j
>> > > > >> >ava: 525) at
>> > > > >>
>> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptor(HostCon
>> > > > >>fig. java:626
>> > > > >>
>> > > > >> >) at
>> > > > >>
>> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptors(HostCo
>> > > > >>nfig .java:55
>> > > > >>
>> > > > >> >3) at
>> > > > >> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.
>> > > > >> >java
>> > > > >> >
>> > > > >> >:488) at
>> > > > >> >
>> > > > >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:
>> > > > >> >1138 ) at
>> > > > >>
>> > > > >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfi
>> > > > >>g.ja va:311)
>> > > > >>
>> > > > >> >         at
>> > > > >>
>> > > > >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Li
>> > > > >>fecy cleSuppo
>> > > > >>
>> > > > >> >rt.java:120) at
>> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.ja
>> > > > >> >va:1 023) at
>> > > > >> > org.apache.catalina.core.StandardHost.start(StandardHost.java
>> > > > >> >:719 ) at
>> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.ja
>> > > > >> >va:1 015) at
>> > > > >> > org.apache.catalina.core.StandardEngine.start(StandardEngine.
>> > > > >> >java
>> > > > >> >
>> > > > >> >:443) at
>> > > > >> >
>> > > > >> > org.apache.catalina.core.StandardService.start(StandardServic
>> > > > >> >e.ja va:448) at
>> > > > >> > org.apache.catalina.core.StandardServer.start(StandardServer.
>> > > > >> >java
>> > > > >> >
>> > > > >> >:710) at
>> > > > >> >
>> > > > >> > org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>> > > > >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > > > >> > Method) at
>> > > > >>
>> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
>> > > > >>rImp l.java:3
>> > > > >>
>> > > > >> >9) at
>> > > > >>
>> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
>> > > > >>dAcc essorImp
>> > > > >>
>> > > > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
>> > > > >> >         at
>> > > > >>
>> > > > >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>> > > > >>
>> > > > >> >         at
>> > > > >>
>> > > > >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
>> > > > >>
>> > > > >> > Caused by: java.lang.RuntimeException: Could not find
>> > > > >> > destination
>> > > > >>
>> > > > >> factory
>> > > > >>
>> > > > >> > for transport http://schemas.xmlsoap.org/soap/http
>> > > > >> >         at
>> > > > >>
>> > > > >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination
>> > > > >>(Soa pTranspo
>> > > > >>
>> > > > >> >rtFactory.java:76) at
>> > > > >> > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl
>> > > > >> >.jav a:90) at
>> > > > >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>> > > > >> > at
>> > > > >>
>> > > > >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryB
>> > > > >>ean. java:117
>> > > > >>
>> > > > >> >) at
>> > > > >>
>> > > > >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerF
>> > > > >>acto ryBean.j
>> > > > >>
>> > > > >> >ava:168) at
>> > > > >>
>> > > > >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeployServ
>> > > > >>ice( CXFUtils
>> > > > >>
>> > > > >> >.java:83) at
>> > > > >>
>> > > > >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.start(Web
>> > > > >>Serv iceLoade
>> > > > >>
>> > > > >> >r.java:82) at
>> > > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > > > >>
>> > > > >> at
>> > > > >>
>> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
>> > > > >>rImp l.java:3
>> > > > >>
>> > > > >> >9) at
>> > > > >>
>> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
>> > > > >>dAcc essorImp
>> > > > >>
>> > > > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
>> > > > >> >         at
>> > >
>> > >
>>
>> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
>> > > > >> >75) ... 29 more
>> > > > >> >
>> > > > >> > Regards,
>> > > > >> > Alexey.
>> > > > >>
>> > > > >> --
>> > > > >> Daniel Kulp
>> > > > >> dkulp@apache.org
>> > > > >> http://www.dankulp.com/blog
>> > >
>> > > --
>> > > J. Daniel Kulp
>> > > Principal Engineer, IONA
>> > > dkulp@apache.org
>> > > http://www.dankulp.com/blog
>>
>>
>>
>> --
>> J. Daniel Kulp
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>
>

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Alexey Zavizionov <al...@gmail.com>.
There are different buses.

Listener:
>>> EXOMAN MyListener.start() 2 = 2
>>> EXOMAN MyListener.start() bus =
org.apache.cxf.bus.extension.ExtensionManagerBus@162ba99
>>> EXOMAN MyListener.start() System.identityHashCode(bus) = 23247513

Servlet:
[INFO] MyCxfNonSpringServlet - loadBus method entering
>>> EXOMAN MyCxfNonSpringServlet.loadBus() bus =
org.apache.cxf.bus.extension.ExtensionManagerBus@1e9f5cc
>>> EXOMAN MyCxfNonSpringServlet.loadBus() System.identityHashCode(bus) =
32110028

Thanks and regards,
Alexey

On Thu, Oct 2, 2008 at 10:15 PM, Daniel Kulp <dk...@apache.org> wrote:

>
>
> That all looks correct.    The only thing I can think of is if a
> different Bus is getting used in the servlet.   Can you do something
> like:
> System.out.println(System.identityHashCode(bus));
> in your listener and in your servlet to see if they are the same.   If
> not, that's definitely the issue.
>
> You MAY need to stick the Bus into a static variable or something to make
> sure the correct Bus is used.
>
> Dan
>
>
> On Thursday 02 October 2008, Alexey Zavizionov wrote:
> > Hello Dan,
> >
> > I tried different ways to do it but I did not get successful result.
> > What did I do wrong?
> >
> > In the listener code:
> > ----------------------------------------------------------------------
> >---------------------- ...
> >       Bus bus = BusFactory.newInstance().createBus();
> >       BusFactory.setDefaultBus(bus);
> >
> >       // snap of code from
> > AbstractCXFServlet.replaceDestinationFactory()
> >
> >       DestinationFactoryManager dfm =
> > bus.getExtension(DestinationFactoryManager.class);
> >       try {
> >           DestinationFactory df = dfm.getDestinationFactory("
> > http://cxf.apache.org/transports/http/configuration");
> >           if (df instanceof ServletTransportFactory) {
> >             ServletTransportFactory servletTransportFactory =
> > (ServletTransportFactory)df;
> >               LOG.info("DESTIONFACTORY_ALREADY_REGISTERED");
> >               return;
> >           }
> >       } catch (BusException e) {
> >       }
> >
> >       DestinationFactory factory = new ServletTransportFactory(bus);
> >
> >
> >       for (String s : factory.getTransportIds()) {
> >
> > bus.getExtension(DestinationFactoryManager.class).registerDestinationF
> >actory(s, factory);
> >       }
> >       LOG.info("REPLACED_HTTP_DESTIONFACTORY");
> >
> >       DestinationFactoryManager factoryManager =
> > bus.getExtension(DestinationFactoryManager.class);
> >
> >       String address = "
> > http://localhost:8080/ws-examples/soap/services/TicketOrderService";
> >       TicketOrderServiceImpl implementor = new
> > TicketOrderServiceImpl(); Endpoint.publish(address, implementor);
> > ...
> > ----------------------------------------------------------------------
> >----------------------
> >
> >
> > In the MyCxfNonSpringServlet
> > ----------------------------------------------------------------------
> >------------------------- ...
> >   @Override
> >   public void loadBus(ServletConfig servletConfig) throws
> > ServletException { super.loadBus(servletConfig);
> >     LOG.info("loadBus method entering");
> >
> >     Bus bus = getBus();
> >     BusFactory.setDefaultBus(bus);
> >   }
> >
> >   @Override
> >   public ServletController createServletController(ServletConfig
> > servletConfig) {
> >     DestinationFactoryManager dfm =
> > bus.getExtension(DestinationFactoryManager.class);
> >     try {
> >       servletTransportFactory = (ServletTransportFactory)
> > dfm.getDestinationFactory("
> > http://cxf.apache.org/transports/http/configuration");
> >     } catch (Exception e) {
> >       e.printStackTrace();
> >     }
> >     return super.createServletController(servletConfig);
> >   }
> > ...
> > ----------------------------------------------------------------------
> >-------------------------
> >
> >
> > In the process of deployment were not exceptions.
> >
> > On a console:
> > [INFO] WebServiceLoader - REPLACED_HTTP_DESTIONFACTORY
> >
> > On a browser at url:
> > http://localhost:8080/ws-examples/soap/services/TicketOrderService?wsd
> >l "No service was found."
> >
> > On Wed, Oct 1, 2008 at 8:51 PM, Daniel Kulp <dk...@apache.org> wrote:
> > > I think it's possible, but it's certainly not trivial.
> > >
> > > Looking at the code in the AbstractCXFServlet, it LOOKS like you
> > > could do:
> > >
> > > 1) Before creating your services, if you create a bus and add the
> > > servlet transport into it.   You can take that code from
> > > replaceDestinationFactory in the AbstractCXFSerlvlet.   That should
> > > allow the services to register fine.
> > >
> > > 2) In you servlet subclass, override the createServletController to
> > > do:
> > >
> > > DestinationFactoryManager dfm =
> > >     bus.getExtension(DestinationFactoryManager.class);
> > > servletTransportFactory = (SerlvetTransportFactory)
> > >     dfm.getDestinationFactory(
> > >           "http://cxf.apache.org/transports/http/configuration");
> > > super.createServletController(....);
> > >
> > > That looks like it SHOULD work.
> > >
> > > Dan
> > >
> > > On Wednesday 01 October 2008, Alexey Zavizionov wrote:
> > > > Hello list,
> > > >
> > > > Is there a CXF API methods to hold on deploy service from listener
> > > > before MyCxfNonSpringServlet servlet is started.
> > > > Will it work with register service to the servlet context outside
> > > > servlet code?
> > > >
> > > > Thanks and regards,
> > > > Alexey.
> > > >
> > > > On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
> > > >
> > > > alexey.zavizionov@gmail.com> wrote:
> > > > > Thanks for reply,
> > > > >
> > > > > NOTE: I have a listener which starts before
> > > > > MyCxfNonSpringServlet is deployed.
> > > > >    All code for registering endpoint I moved to the listener.
> > > > >
> > > > > How can I register the servlets transport factory with the bus?
> > > > >
> > > > > Regards,
> > > > > Alexey.
> > > > >
> > > > > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp <dk...@apache.org>
> > >
> > > wrote:
> > > > >> It looks like the servlets transport factory is not registered
> > > > >> with the bus.
> > > > >> Are you subclassing our CXFNonSpringServlet or similar to make
> > > > >> sure the appropriate transport is setup to handle that
> > > > >> namespace?
> > > > >>
> > > > >> Dan
> > > > >>
> > > > >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov wrote:
> > > > >> > Hello list,
> > > > >> >
> > > > >> > I published services within test unit and in a servlet
> > > > >> > (nonspring) successfully with command
> > > > >> > "Endpoint.publish(address, object);".
> > > > >> >
> > > > >> > But, the same thing has failed within listener (in the Tomcat
> > > > >> > ).
> > > > >> >
> > > > >> > Does somebody have publish your service within listener?
> > > > >> >
> > > > >> > INFO: Creating Service
> > > > >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> <http:
> > > > >> >//exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> > >
> > > <http://ex
> > >
> > > > >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
> > > > >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderService
> > > > >> > org.picocontainer.PicoIntrospectionException: Failed when
> > > > >> > calling start
> > > > >>
> > > > >> on
> > > > >>
> > > > >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7bc899
> > > > >> >         at
> > >
> > >
> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > > > >> >81) at
> > > > >>
> > > > >> org.picocontainer.defaults.LifecycleVisitor.start(LifecycleVisi
> > > > >>tor. java:113
> > > > >>
> > > > >> >) at
> > > > >>
> > > > >> org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPi
> > > > >>coCo ntainer.
> > > > >>
> > > > >> >java:369) at
> > > > >>
> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(Stand
> > > > >>alon eContain
> > > > >>
> > > > >> >er.java:124) at
> > > > >>
> > > > >> org.exoplatform.container.StandaloneContainer.getInstance(Stand
> > > > >>alon eContain
> > > > >>
> > > > >> >er.java:91) at
> > > > >>
> > > > >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerInitia
> > > > >>lize dListene
> > > > >>
> > > > >> >r.contextInitialized(StandaloneContainerInitializedListener.ja
> > > > >> >va:7 1) at
> > > > >>
> > > > >> org.apache.catalina.core.StandardContext.listenerStart(Standard
> > > > >>Cont ext.java
> > > > >>
> > > > >> >:3827) at
> > > > >>
> > > > >> org.apache.catalina.core.StandardContext.start(StandardContext.
> > > > >>java
> > > > >>
> > > > >>:4336)
> > > > >>:
> > > > >> >         at
> > >
> > >
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> > > > >> >761) at
> > > > >> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase
> > > > >> >.jav a:741) at
> > > > >> > org.apache.catalina.core.StandardHost.addChild(StandardHost.j
> > > > >> >ava: 525) at
> > > > >>
> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptor(HostCon
> > > > >>fig. java:626
> > > > >>
> > > > >> >) at
> > > > >>
> > > > >> org.apache.catalina.startup.HostConfig.deployDescriptors(HostCo
> > > > >>nfig .java:55
> > > > >>
> > > > >> >3) at
> > > > >> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.
> > > > >> >java
> > > > >> >
> > > > >> >:488) at
> > > > >> >
> > > > >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:
> > > > >> >1138 ) at
> > > > >>
> > > > >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfi
> > > > >>g.ja va:311)
> > > > >>
> > > > >> >         at
> > > > >>
> > > > >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Li
> > > > >>fecy cleSuppo
> > > > >>
> > > > >> >rt.java:120) at
> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.ja
> > > > >> >va:1 023) at
> > > > >> > org.apache.catalina.core.StandardHost.start(StandardHost.java
> > > > >> >:719 ) at
> > > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.ja
> > > > >> >va:1 015) at
> > > > >> > org.apache.catalina.core.StandardEngine.start(StandardEngine.
> > > > >> >java
> > > > >> >
> > > > >> >:443) at
> > > > >> >
> > > > >> > org.apache.catalina.core.StandardService.start(StandardServic
> > > > >> >e.ja va:448) at
> > > > >> > org.apache.catalina.core.StandardServer.start(StandardServer.
> > > > >> >java
> > > > >> >
> > > > >> >:710) at
> > > > >> >
> > > > >> > org.apache.catalina.startup.Catalina.start(Catalina.java:552)
> > > > >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > >> > Method) at
> > > > >>
> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> > > > >>rImp l.java:3
> > > > >>
> > > > >> >9) at
> > > > >>
> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> > > > >>dAcc essorImp
> > > > >>
> > > > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > > > >> >         at
> > > > >>
> > > > >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> > > > >>
> > > > >> >         at
> > > > >>
> > > > >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > > > >>
> > > > >> > Caused by: java.lang.RuntimeException: Could not find
> > > > >> > destination
> > > > >>
> > > > >> factory
> > > > >>
> > > > >> > for transport http://schemas.xmlsoap.org/soap/http
> > > > >> >         at
> > > > >>
> > > > >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination
> > > > >>(Soa pTranspo
> > > > >>
> > > > >> >rtFactory.java:76) at
> > > > >> > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl
> > > > >> >.jav a:90) at
> > > > >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
> > > > >> > at
> > > > >>
> > > > >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryB
> > > > >>ean. java:117
> > > > >>
> > > > >> >) at
> > > > >>
> > > > >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerF
> > > > >>acto ryBean.j
> > > > >>
> > > > >> >ava:168) at
> > > > >>
> > > > >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeployServ
> > > > >>ice( CXFUtils
> > > > >>
> > > > >> >.java:83) at
> > > > >>
> > > > >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.start(Web
> > > > >>Serv iceLoade
> > > > >>
> > > > >> >r.java:82) at
> > > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > >>
> > > > >> at
> > > > >>
> > > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> > > > >>rImp l.java:3
> > > > >>
> > > > >> >9) at
> > > > >>
> > > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> > > > >>dAcc essorImp
> > > > >>
> > > > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > > > >> >         at
> > >
> > >
> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > > > >> >75) ... 29 more
> > > > >> >
> > > > >> > Regards,
> > > > >> > Alexey.
> > > > >>
> > > > >> --
> > > > >> Daniel Kulp
> > > > >> dkulp@apache.org
> > > > >> http://www.dankulp.com/blog
> > >
> > > --
> > > J. Daniel Kulp
> > > Principal Engineer, IONA
> > > dkulp@apache.org
> > > http://www.dankulp.com/blog
>
>
>
> --
> J. Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Daniel Kulp <dk...@apache.org>.

That all looks correct.    The only thing I can think of is if a 
different Bus is getting used in the servlet.   Can you do something 
like:
System.out.println(System.identityHashCode(bus));
in your listener and in your servlet to see if they are the same.   If 
not, that's definitely the issue.

You MAY need to stick the Bus into a static variable or something to make 
sure the correct Bus is used.

Dan


On Thursday 02 October 2008, Alexey Zavizionov wrote:
> Hello Dan,
>
> I tried different ways to do it but I did not get successful result.
> What did I do wrong?
>
> In the listener code:
> ----------------------------------------------------------------------
>---------------------- ...
>       Bus bus = BusFactory.newInstance().createBus();
>       BusFactory.setDefaultBus(bus);
>
>       // snap of code from
> AbstractCXFServlet.replaceDestinationFactory()
>
>       DestinationFactoryManager dfm =
> bus.getExtension(DestinationFactoryManager.class);
>       try {
>           DestinationFactory df = dfm.getDestinationFactory("
> http://cxf.apache.org/transports/http/configuration");
>           if (df instanceof ServletTransportFactory) {
>             ServletTransportFactory servletTransportFactory =
> (ServletTransportFactory)df;
>               LOG.info("DESTIONFACTORY_ALREADY_REGISTERED");
>               return;
>           }
>       } catch (BusException e) {
>       }
>
>       DestinationFactory factory = new ServletTransportFactory(bus);
>
>
>       for (String s : factory.getTransportIds()) {
>
> bus.getExtension(DestinationFactoryManager.class).registerDestinationF
>actory(s, factory);
>       }
>       LOG.info("REPLACED_HTTP_DESTIONFACTORY");
>
>       DestinationFactoryManager factoryManager =
> bus.getExtension(DestinationFactoryManager.class);
>
>       String address = "
> http://localhost:8080/ws-examples/soap/services/TicketOrderService";
>       TicketOrderServiceImpl implementor = new
> TicketOrderServiceImpl(); Endpoint.publish(address, implementor);
> ...
> ----------------------------------------------------------------------
>----------------------
>
>
> In the MyCxfNonSpringServlet
> ----------------------------------------------------------------------
>------------------------- ...
>   @Override
>   public void loadBus(ServletConfig servletConfig) throws
> ServletException { super.loadBus(servletConfig);
>     LOG.info("loadBus method entering");
>
>     Bus bus = getBus();
>     BusFactory.setDefaultBus(bus);
>   }
>
>   @Override
>   public ServletController createServletController(ServletConfig
> servletConfig) {
>     DestinationFactoryManager dfm =
> bus.getExtension(DestinationFactoryManager.class);
>     try {
>       servletTransportFactory = (ServletTransportFactory)
> dfm.getDestinationFactory("
> http://cxf.apache.org/transports/http/configuration");
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
>     return super.createServletController(servletConfig);
>   }
> ...
> ----------------------------------------------------------------------
>-------------------------
>
>
> In the process of deployment were not exceptions.
>
> On a console:
> [INFO] WebServiceLoader - REPLACED_HTTP_DESTIONFACTORY
>
> On a browser at url:
> http://localhost:8080/ws-examples/soap/services/TicketOrderService?wsd
>l "No service was found."
>
> On Wed, Oct 1, 2008 at 8:51 PM, Daniel Kulp <dk...@apache.org> wrote:
> > I think it's possible, but it's certainly not trivial.
> >
> > Looking at the code in the AbstractCXFServlet, it LOOKS like you
> > could do:
> >
> > 1) Before creating your services, if you create a bus and add the
> > servlet transport into it.   You can take that code from
> > replaceDestinationFactory in the AbstractCXFSerlvlet.   That should
> > allow the services to register fine.
> >
> > 2) In you servlet subclass, override the createServletController to
> > do:
> >
> > DestinationFactoryManager dfm =
> >     bus.getExtension(DestinationFactoryManager.class);
> > servletTransportFactory = (SerlvetTransportFactory)
> >     dfm.getDestinationFactory(
> >           "http://cxf.apache.org/transports/http/configuration");
> > super.createServletController(....);
> >
> > That looks like it SHOULD work.
> >
> > Dan
> >
> > On Wednesday 01 October 2008, Alexey Zavizionov wrote:
> > > Hello list,
> > >
> > > Is there a CXF API methods to hold on deploy service from listener
> > > before MyCxfNonSpringServlet servlet is started.
> > > Will it work with register service to the servlet context outside
> > > servlet code?
> > >
> > > Thanks and regards,
> > > Alexey.
> > >
> > > On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
> > >
> > > alexey.zavizionov@gmail.com> wrote:
> > > > Thanks for reply,
> > > >
> > > > NOTE: I have a listener which starts before
> > > > MyCxfNonSpringServlet is deployed.
> > > >    All code for registering endpoint I moved to the listener.
> > > >
> > > > How can I register the servlets transport factory with the bus?
> > > >
> > > > Regards,
> > > > Alexey.
> > > >
> > > > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp <dk...@apache.org>
> >
> > wrote:
> > > >> It looks like the servlets transport factory is not registered
> > > >> with the bus.
> > > >> Are you subclassing our CXFNonSpringServlet or similar to make
> > > >> sure the appropriate transport is setup to handle that
> > > >> namespace?
> > > >>
> > > >> Dan
> > > >>
> > > >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov wrote:
> > > >> > Hello list,
> > > >> >
> > > >> > I published services within test unit and in a servlet
> > > >> > (nonspring) successfully with command
> > > >> > "Endpoint.publish(address, object);".
> > > >> >
> > > >> > But, the same thing has failed within listener (in the Tomcat
> > > >> > ).
> > > >> >
> > > >> > Does somebody have publish your service within listener?
> > > >> >
> > > >> > INFO: Creating Service
> > > >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http:
> > > >> >//exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> >
> > <http://ex
> >
> > > >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
> > > >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderService
> > > >> > org.picocontainer.PicoIntrospectionException: Failed when
> > > >> > calling start
> > > >>
> > > >> on
> > > >>
> > > >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7bc899
> > > >> >         at
> >
> > 
org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > > >> >81) at
> > > >>
> > > >> org.picocontainer.defaults.LifecycleVisitor.start(LifecycleVisi
> > > >>tor. java:113
> > > >>
> > > >> >) at
> > > >>
> > > >> org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPi
> > > >>coCo ntainer.
> > > >>
> > > >> >java:369) at
> > > >>
> > > >> org.exoplatform.container.StandaloneContainer.getInstance(Stand
> > > >>alon eContain
> > > >>
> > > >> >er.java:124) at
> > > >>
> > > >> org.exoplatform.container.StandaloneContainer.getInstance(Stand
> > > >>alon eContain
> > > >>
> > > >> >er.java:91) at
> > > >>
> > > >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerInitia
> > > >>lize dListene
> > > >>
> > > >> >r.contextInitialized(StandaloneContainerInitializedListener.ja
> > > >> >va:7 1) at
> > > >>
> > > >> org.apache.catalina.core.StandardContext.listenerStart(Standard
> > > >>Cont ext.java
> > > >>
> > > >> >:3827) at
> > > >>
> > > >> org.apache.catalina.core.StandardContext.start(StandardContext.
> > > >>java
> > > >>
> > > >>:4336)
> > > >>:
> > > >> >         at
> >
> > 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> > > >> >761) at
> > > >> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase
> > > >> >.jav a:741) at
> > > >> > org.apache.catalina.core.StandardHost.addChild(StandardHost.j
> > > >> >ava: 525) at
> > > >>
> > > >> org.apache.catalina.startup.HostConfig.deployDescriptor(HostCon
> > > >>fig. java:626
> > > >>
> > > >> >) at
> > > >>
> > > >> org.apache.catalina.startup.HostConfig.deployDescriptors(HostCo
> > > >>nfig .java:55
> > > >>
> > > >> >3) at
> > > >> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.
> > > >> >java
> > > >> >
> > > >> >:488) at
> > > >> >
> > > >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:
> > > >> >1138 ) at
> > > >>
> > > >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfi
> > > >>g.ja va:311)
> > > >>
> > > >> >         at
> > > >>
> > > >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Li
> > > >>fecy cleSuppo
> > > >>
> > > >> >rt.java:120) at
> > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.ja
> > > >> >va:1 023) at
> > > >> > org.apache.catalina.core.StandardHost.start(StandardHost.java
> > > >> >:719 ) at
> > > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.ja
> > > >> >va:1 015) at
> > > >> > org.apache.catalina.core.StandardEngine.start(StandardEngine.
> > > >> >java
> > > >> >
> > > >> >:443) at
> > > >> >
> > > >> > org.apache.catalina.core.StandardService.start(StandardServic
> > > >> >e.ja va:448) at
> > > >> > org.apache.catalina.core.StandardServer.start(StandardServer.
> > > >> >java
> > > >> >
> > > >> >:710) at
> > > >> >
> > > >> > org.apache.catalina.startup.Catalina.start(Catalina.java:552)
> > > >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > >> > Method) at
> > > >>
> > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> > > >>rImp l.java:3
> > > >>
> > > >> >9) at
> > > >>
> > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> > > >>dAcc essorImp
> > > >>
> > > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > > >> >         at
> > > >>
> > > >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> > > >>
> > > >> >         at
> > > >>
> > > >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > > >>
> > > >> > Caused by: java.lang.RuntimeException: Could not find
> > > >> > destination
> > > >>
> > > >> factory
> > > >>
> > > >> > for transport http://schemas.xmlsoap.org/soap/http
> > > >> >         at
> > > >>
> > > >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination
> > > >>(Soa pTranspo
> > > >>
> > > >> >rtFactory.java:76) at
> > > >> > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl
> > > >> >.jav a:90) at
> > > >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
> > > >> > at
> > > >>
> > > >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryB
> > > >>ean. java:117
> > > >>
> > > >> >) at
> > > >>
> > > >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerF
> > > >>acto ryBean.j
> > > >>
> > > >> >ava:168) at
> > > >>
> > > >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeployServ
> > > >>ice( CXFUtils
> > > >>
> > > >> >.java:83) at
> > > >>
> > > >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.start(Web
> > > >>Serv iceLoade
> > > >>
> > > >> >r.java:82) at
> > > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > >>
> > > >> at
> > > >>
> > > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccesso
> > > >>rImp l.java:3
> > > >>
> > > >> >9) at
> > > >>
> > > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMetho
> > > >>dAcc essorImp
> > > >>
> > > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > > >> >         at
> >
> > 
org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > > >> >75) ... 29 more
> > > >> >
> > > >> > Regards,
> > > >> > Alexey.
> > > >>
> > > >> --
> > > >> Daniel Kulp
> > > >> dkulp@apache.org
> > > >> http://www.dankulp.com/blog
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Alexey Zavizionov <al...@gmail.com>.
Hello Dan,

I tried different ways to do it but I did not get successful result.
What did I do wrong?

In the listener code:
--------------------------------------------------------------------------------------------
...
      Bus bus = BusFactory.newInstance().createBus();
      BusFactory.setDefaultBus(bus);

      // snap of code from AbstractCXFServlet.replaceDestinationFactory()

      DestinationFactoryManager dfm =
bus.getExtension(DestinationFactoryManager.class);
      try {
          DestinationFactory df = dfm.getDestinationFactory("
http://cxf.apache.org/transports/http/configuration");
          if (df instanceof ServletTransportFactory) {
            ServletTransportFactory servletTransportFactory =
(ServletTransportFactory)df;
              LOG.info("DESTIONFACTORY_ALREADY_REGISTERED");
              return;
          }
      } catch (BusException e) {
      }

      DestinationFactory factory = new ServletTransportFactory(bus);


      for (String s : factory.getTransportIds()) {

bus.getExtension(DestinationFactoryManager.class).registerDestinationFactory(s,
factory);
      }
      LOG.info("REPLACED_HTTP_DESTIONFACTORY");

      DestinationFactoryManager factoryManager =
bus.getExtension(DestinationFactoryManager.class);

      String address = "
http://localhost:8080/ws-examples/soap/services/TicketOrderService";
      TicketOrderServiceImpl implementor = new TicketOrderServiceImpl();
      Endpoint.publish(address, implementor);
...
--------------------------------------------------------------------------------------------


In the MyCxfNonSpringServlet
-----------------------------------------------------------------------------------------------
...
  @Override
  public void loadBus(ServletConfig servletConfig) throws ServletException {
    super.loadBus(servletConfig);
    LOG.info("loadBus method entering");

    Bus bus = getBus();
    BusFactory.setDefaultBus(bus);
  }

  @Override
  public ServletController createServletController(ServletConfig
servletConfig) {
    DestinationFactoryManager dfm =
bus.getExtension(DestinationFactoryManager.class);
    try {
      servletTransportFactory = (ServletTransportFactory)
dfm.getDestinationFactory("
http://cxf.apache.org/transports/http/configuration");
    } catch (Exception e) {
      e.printStackTrace();
    }
    return super.createServletController(servletConfig);
  }
...
-----------------------------------------------------------------------------------------------


In the process of deployment were not exceptions.

On a console:
[INFO] WebServiceLoader - REPLACED_HTTP_DESTIONFACTORY

On a browser at url:
http://localhost:8080/ws-examples/soap/services/TicketOrderService?wsdl
"No service was found."


On Wed, Oct 1, 2008 at 8:51 PM, Daniel Kulp <dk...@apache.org> wrote:

>
>
> I think it's possible, but it's certainly not trivial.
>
> Looking at the code in the AbstractCXFServlet, it LOOKS like you could
> do:
>
> 1) Before creating your services, if you create a bus and add the servlet
> transport into it.   You can take that code from
> replaceDestinationFactory in the AbstractCXFSerlvlet.   That should
> allow the services to register fine.
>
> 2) In you servlet subclass, override the createServletController to do:
>
> DestinationFactoryManager dfm =
>     bus.getExtension(DestinationFactoryManager.class);
> servletTransportFactory = (SerlvetTransportFactory)
>     dfm.getDestinationFactory(
>           "http://cxf.apache.org/transports/http/configuration");
> super.createServletController(....);
>
> That looks like it SHOULD work.
>
> Dan
>
>
>
> On Wednesday 01 October 2008, Alexey Zavizionov wrote:
> > Hello list,
> >
> > Is there a CXF API methods to hold on deploy service from listener
> > before MyCxfNonSpringServlet servlet is started.
> > Will it work with register service to the servlet context outside
> > servlet code?
> >
> > Thanks and regards,
> > Alexey.
> >
> > On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
> >
> > alexey.zavizionov@gmail.com> wrote:
> > > Thanks for reply,
> > >
> > > NOTE: I have a listener which starts before MyCxfNonSpringServlet is
> > > deployed.
> > >    All code for registering endpoint I moved to the listener.
> > >
> > > How can I register the servlets transport factory with the bus?
> > >
> > > Regards,
> > > Alexey.
> > >
> > > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp <dk...@apache.org>
> wrote:
> > >> It looks like the servlets transport factory is not registered with
> > >> the bus.
> > >> Are you subclassing our CXFNonSpringServlet or similar to make sure
> > >> the appropriate transport is setup to handle that namespace?
> > >>
> > >> Dan
> > >>
> > >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov wrote:
> > >> > Hello list,
> > >> >
> > >> > I published services within test unit and in a servlet
> > >> > (nonspring) successfully with command "Endpoint.publish(address,
> > >> > object);".
> > >> >
> > >> > But, the same thing has failed within listener (in the Tomcat ).
> > >> >
> > >> > Does somebody have publish your service within listener?
> > >> >
> > >> > INFO: Creating Service
> > >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http://exoplatform.org/soap/cxf%7DTicketOrderServicefrom>
> <http://ex
> > >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
> > >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderService
> > >> > org.picocontainer.PicoIntrospectionException: Failed when calling
> > >> > start
> > >>
> > >> on
> > >>
> > >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7bc899
> > >> >         at
> > >>
> > >>
> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > >> >81) at
> > >>
> > >> org.picocontainer.defaults.LifecycleVisitor.start(LifecycleVisitor.
> > >>java:113
> > >>
> > >> >) at
> > >>
> > >> org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPicoCo
> > >>ntainer.
> > >>
> > >> >java:369) at
> > >>
> > >> org.exoplatform.container.StandaloneContainer.getInstance(Standalon
> > >>eContain
> > >>
> > >> >er.java:124) at
> > >>
> > >> org.exoplatform.container.StandaloneContainer.getInstance(Standalon
> > >>eContain
> > >>
> > >> >er.java:91) at
> > >>
> > >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerInitialize
> > >>dListene
> > >>
> > >> >r.contextInitialized(StandaloneContainerInitializedListener.java:7
> > >> >1) at
> > >>
> > >> org.apache.catalina.core.StandardContext.listenerStart(StandardCont
> > >>ext.java
> > >>
> > >> >:3827) at
> > >>
> > >> org.apache.catalina.core.StandardContext.start(StandardContext.java
> > >>:4336)
> > >>
> > >> >         at
> > >>
> > >>
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> > >> >761) at
> > >> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.jav
> > >> >a:741) at
> > >> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
> > >> >525) at
> > >>
> > >> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.
> > >>java:626
> > >>
> > >> >) at
> > >>
> > >> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig
> > >>.java:55
> > >>
> > >> >3) at
> > >> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java
> > >> >:488) at
> > >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138
> > >> >) at
> > >>
> > >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.ja
> > >>va:311)
> > >>
> > >> >         at
> > >>
> > >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecy
> > >>cleSuppo
> > >>
> > >> >rt.java:120) at
> > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1
> > >> >023) at
> > >> > org.apache.catalina.core.StandardHost.start(StandardHost.java:719
> > >> >) at
> > >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1
> > >> >015) at
> > >> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java
> > >> >:443) at
> > >> > org.apache.catalina.core.StandardService.start(StandardService.ja
> > >> >va:448) at
> > >> > org.apache.catalina.core.StandardServer.start(StandardServer.java
> > >> >:710) at
> > >> > org.apache.catalina.startup.Catalina.start(Catalina.java:552) at
> > >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> > >>
> > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> > >>l.java:3
> > >>
> > >> >9) at
> > >>
> > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> > >>essorImp
> > >>
> > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > >> >         at
> > >>
> > >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> > >>
> > >> >         at
> > >>
> > >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> > >>
> > >> > Caused by: java.lang.RuntimeException: Could not find destination
> > >>
> > >> factory
> > >>
> > >> > for transport http://schemas.xmlsoap.org/soap/http
> > >> >         at
> > >>
> > >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(Soa
> > >>pTranspo
> > >>
> > >> >rtFactory.java:76) at
> > >> > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.jav
> > >> >a:90) at
> > >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69) at
> > >>
> > >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.
> > >>java:117
> > >>
> > >> >) at
> > >>
> > >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFacto
> > >>ryBean.j
> > >>
> > >> >ava:168) at
> > >>
> > >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeployService(
> > >>CXFUtils
> > >>
> > >> >.java:83) at
> > >>
> > >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.start(WebServ
> > >>iceLoade
> > >>
> > >> >r.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > >> > Method)
> > >>
> > >> at
> > >>
> > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> > >>l.java:3
> > >>
> > >> >9) at
> > >>
> > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> > >>essorImp
> > >>
> > >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > >> >         at
> > >>
> > >>
> org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> > >> >75) ... 29 more
> > >> >
> > >> > Regards,
> > >> > Alexey.
> > >>
> > >> --
> > >> Daniel Kulp
> > >> dkulp@apache.org
> > >> http://www.dankulp.com/blog
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: Starting up service within listener: Could not find destination factory for transport.

Posted by Daniel Kulp <dk...@apache.org>.

I think it's possible, but it's certainly not trivial.

Looking at the code in the AbstractCXFServlet, it LOOKS like you could 
do:

1) Before creating your services, if you create a bus and add the servlet 
transport into it.   You can take that code from 
replaceDestinationFactory in the AbstractCXFSerlvlet.   That should 
allow the services to register fine.

2) In you servlet subclass, override the createServletController to do:

DestinationFactoryManager dfm =
     bus.getExtension(DestinationFactoryManager.class); 
servletTransportFactory = (SerlvetTransportFactory)
     dfm.getDestinationFactory(
           "http://cxf.apache.org/transports/http/configuration");
super.createServletController(....);

That looks like it SHOULD work.

Dan



On Wednesday 01 October 2008, Alexey Zavizionov wrote:
> Hello list,
>
> Is there a CXF API methods to hold on deploy service from listener
> before MyCxfNonSpringServlet servlet is started.
> Will it work with register service to the servlet context outside
> servlet code?
>
> Thanks and regards,
> Alexey.
>
> On Tue, Sep 30, 2008 at 11:30 AM, Alexey Zavizionov <
>
> alexey.zavizionov@gmail.com> wrote:
> > Thanks for reply,
> >
> > NOTE: I have a listener which starts before MyCxfNonSpringServlet is
> > deployed.
> >    All code for registering endpoint I moved to the listener.
> >
> > How can I register the servlets transport factory with the bus?
> >
> > Regards,
> > Alexey.
> >
> > On Mon, Sep 29, 2008 at 8:36 PM, Daniel Kulp <dk...@apache.org> 
wrote:
> >> It looks like the servlets transport factory is not registered with
> >> the bus.
> >> Are you subclassing our CXFNonSpringServlet or similar to make sure
> >> the appropriate transport is setup to handle that namespace?
> >>
> >> Dan
> >>
> >> On Monday 29 September 2008 5:26:39 am Alexey Zavizionov wrote:
> >> > Hello list,
> >> >
> >> > I published services within test unit and in a servlet
> >> > (nonspring) successfully with command "Endpoint.publish(address,
> >> > object);".
> >> >
> >> > But, the same thing has failed within listener (in the Tomcat ).
> >> >
> >> > Does somebody have publish your service within listener?
> >> >
> >> > INFO: Creating Service
> >> > {http://exoplatform.org/soap/cxf}TicketOrderServicefrom<http://ex
> >> >oplatform.org/soap/cxf%7DTicketOrderServicefrom>class
> >> > org.exoplatform.services.ws.soap.jsr181.TicketOrderService
> >> > org.picocontainer.PicoIntrospectionException: Failed when calling
> >> > start
> >>
> >> on
> >>
> >> > org.exoplatform.services.ws.impl.cxf.WebServiceLoader@7bc899
> >> >         at
> >>
> >> 
org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> >> >81) at
> >>
> >> org.picocontainer.defaults.LifecycleVisitor.start(LifecycleVisitor.
> >>java:113
> >>
> >> >) at
> >>
> >> org.picocontainer.defaults.DefaultPicoContainer.start(DefaultPicoCo
> >>ntainer.
> >>
> >> >java:369) at
> >>
> >> org.exoplatform.container.StandaloneContainer.getInstance(Standalon
> >>eContain
> >>
> >> >er.java:124) at
> >>
> >> org.exoplatform.container.StandaloneContainer.getInstance(Standalon
> >>eContain
> >>
> >> >er.java:91) at
> >>
> >> org.exoplatform.ws.frameworks.servlet.StandaloneContainerInitialize
> >>dListene
> >>
> >> >r.contextInitialized(StandaloneContainerInitializedListener.java:7
> >> >1) at
> >>
> >> org.apache.catalina.core.StandardContext.listenerStart(StandardCont
> >>ext.java
> >>
> >> >:3827) at
> >>
> >> org.apache.catalina.core.StandardContext.start(StandardContext.java
> >>:4336)
> >>
> >> >         at
> >>
> >> 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> >> >761) at
> >> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.jav
> >> >a:741) at
> >> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
> >> >525) at
> >>
> >> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.
> >>java:626
> >>
> >> >) at
> >>
> >> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig
> >>.java:55
> >>
> >> >3) at
> >> > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java
> >> >:488) at
> >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138
> >> >) at
> >>
> >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.ja
> >>va:311)
> >>
> >> >         at
> >>
> >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecy
> >>cleSuppo
> >>
> >> >rt.java:120) at
> >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1
> >> >023) at
> >> > org.apache.catalina.core.StandardHost.start(StandardHost.java:719
> >> >) at
> >> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1
> >> >015) at
> >> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java
> >> >:443) at
> >> > org.apache.catalina.core.StandardService.start(StandardService.ja
> >> >va:448) at
> >> > org.apache.catalina.core.StandardServer.start(StandardServer.java
> >> >:710) at
> >> > org.apache.catalina.startup.Catalina.start(Catalina.java:552) at
> >> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> >>
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> >>l.java:3
> >>
> >> >9) at
> >>
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> >>essorImp
> >>
> >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> >> >         at
> >>
> >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> >>
> >> >         at
> >>
> >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> >>
> >> > Caused by: java.lang.RuntimeException: Could not find destination
> >>
> >> factory
> >>
> >> > for transport http://schemas.xmlsoap.org/soap/http
> >> >         at
> >>
> >> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(Soa
> >>pTranspo
> >>
> >> >rtFactory.java:76) at
> >> > org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.jav
> >> >a:90) at
> >> > org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69) at
> >>
> >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.
> >>java:117
> >>
> >> >) at
> >>
> >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFacto
> >>ryBean.j
> >>
> >> >ava:168) at
> >>
> >> org.exoplatform.services.ws.impl.cxf.CXFUtils.complexDeployService(
> >>CXFUtils
> >>
> >> >.java:83) at
> >>
> >> org.exoplatform.services.ws.impl.cxf.WebServiceLoader.start(WebServ
> >>iceLoade
> >>
> >> >r.java:82) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> > Method)
> >>
> >> at
> >>
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
> >>l.java:3
> >>
> >> >9) at
> >>
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
> >>essorImp
> >>
> >> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> >> >         at
> >>
> >> 
org.picocontainer.defaults.LifecycleVisitor.traverse(LifecycleVisitor.java:
> >> >75) ... 29 more
> >> >
> >> > Regards,
> >> > Alexey.
> >>
> >> --
> >> Daniel Kulp
> >> dkulp@apache.org
> >> http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog