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 <[EMAIL PROTECTED]> 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 <
> > >
> > > [EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
> >
> > 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
> > > >>
> > > >> > [EMAIL PROTECTED]
> > > >> > 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
> > > >> [EMAIL PROTECTED]
> > > >> http://www.dankulp.com/blog
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > [EMAIL PROTECTED]
> > http://www.dankulp.com/blog
--
J. Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog