You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by John Smith <cx...@googlemail.com> on 2010/09/07 15:44:50 UTC

java.lang.IllegalStateException: Local destination does not have a MessageObserver on address local://...

Hi!

Try to utililize local transport instead of HTTP on CXF 2.0.13. Read the
simple guide at http://cxf.apache.org/docs/local-transport.html, googled,
debugged CXF back and forth but failed anyway:

INFO: Interceptor has thrown exception, unwinding now
java.lang.IllegalStateException: Local destination does not have a
MessageObserver on address local://fooService
at
org.apache.cxf.transport.local.LocalConduit.dispatchViaPipe(LocalConduit.java:109)
 at
org.apache.cxf.transport.local.LocalConduit.prepare(LocalConduit.java:59)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
 at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:226)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
 at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:231)
 at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)

Tried a couple of different approached and ran into different problems but
the above one was what I got first. The problem is that
LocalDestination.incomingObserver stays null. The wrapped conduit gets
ClientImpl as observer set. There's a client that's actually instantiated
via @WebService and .wsdl (but not used) but the endpoint and in-JVM client
is done in code like this:

        String localPath = "local:/" + path; // path="/fooService"

        ServerFactoryBean sf = new ServerFactoryBean();
        sf.setAddress(localPath);
        sf.setServiceBean(implementor);
        sf.setTransportId(LocalTransportFactory.TRANSPORT_ID); // reset to
soap by CXF
//        sf.setInInterceptors(new ArrayList<Interceptor>(2) {
//            {
//                add(new GlobalInitInInterceptor(ds));
//                add(new CleanupInInterceptor(Phase.POST_INVOKE));
//            }
//        });
        sf.create();

Alternatively:

//        EndpointImpl e = new EndpointImpl(implementor);
//        e.setAddress(localPath);
//        // e.setBindingUri("http://cxf.apache.org/transports/local");
//        e.getInInterceptors().add(new GlobalInitInInterceptor(ds));
//        e.getInInterceptors().add(new
CleanupInInterceptor(Phase.POST_INVOKE));
//        e.getOutFaultInterceptors().add(new
CleanupOutFaultInterceptor(Phase.MARSHAL));
//        e.publish();

The client:

      ClientProxyFactoryBean cf = new ClientProxyFactoryBean();
      cf.setAddress("local://fooService");
      cf.setServiceClass(IFooService.class); // Optionally specify the
service interface
      ... = cf.create();

Pretty simple, quite exactly like the example.

I dropped all these initial registerConduitInitiator()s and
registerDestinationsFactory()s these seem to attempt to transfer all traffic
in-JVM (?). However the service needs to continue to serve remote clients
via HTTP (-> Endpoint.publish(path, instance)).

Can't imaging to be the first one struggling this problem. What am I
supposed to do LocalDestination gets a message observer?

Thanks a lot!

Re: java.lang.IllegalStateException: Local destination does not have a MessageObserver on address local://...

Posted by Daniel Kulp <dk...@apache.org>.
Any chance you can try with CXF 2.2.10?   Lots of stuff has changes and many 
bugs fixed so it might "just work" now.   Not really sure though.

In general, this type of thing USUALLY means they are using a different Bus 
and thus the Conduit cannot find the right thing registered as a local 
destination.   

Dan


On Tuesday 07 September 2010 9:44:50 am John Smith wrote:
> Hi!
> 
> Try to utililize local transport instead of HTTP on CXF 2.0.13. Read the
> simple guide at http://cxf.apache.org/docs/local-transport.html, googled,
> debugged CXF back and forth but failed anyway:
> 
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.IllegalStateException: Local destination does not have a
> MessageObserver on address local://fooService
> at
> org.apache.cxf.transport.local.LocalConduit.dispatchViaPipe(LocalConduit.ja
> va:109) at
> org.apache.cxf.transport.local.LocalConduit.prepare(LocalConduit.java:59)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSe
> nderInterceptor.java:46) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:226) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
>  at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:231)
>  at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
> 
> Tried a couple of different approached and ran into different problems but
> the above one was what I got first. The problem is that
> LocalDestination.incomingObserver stays null. The wrapped conduit gets
> ClientImpl as observer set. There's a client that's actually instantiated
> via @WebService and .wsdl (but not used) but the endpoint and in-JVM client
> is done in code like this:
> 
>         String localPath = "local:/" + path; // path="/fooService"
> 
>         ServerFactoryBean sf = new ServerFactoryBean();
>         sf.setAddress(localPath);
>         sf.setServiceBean(implementor);
>         sf.setTransportId(LocalTransportFactory.TRANSPORT_ID); // reset to
> soap by CXF
> //        sf.setInInterceptors(new ArrayList<Interceptor>(2) {
> //            {
> //                add(new GlobalInitInInterceptor(ds));
> //                add(new CleanupInInterceptor(Phase.POST_INVOKE));
> //            }
> //        });
>         sf.create();
> 
> Alternatively:
> 
> //        EndpointImpl e = new EndpointImpl(implementor);
> //        e.setAddress(localPath);
> //        // e.setBindingUri("http://cxf.apache.org/transports/local");
> //        e.getInInterceptors().add(new GlobalInitInInterceptor(ds));
> //        e.getInInterceptors().add(new
> CleanupInInterceptor(Phase.POST_INVOKE));
> //        e.getOutFaultInterceptors().add(new
> CleanupOutFaultInterceptor(Phase.MARSHAL));
> //        e.publish();
> 
> The client:
> 
>       ClientProxyFactoryBean cf = new ClientProxyFactoryBean();
>       cf.setAddress("local://fooService");
>       cf.setServiceClass(IFooService.class); // Optionally specify the
> service interface
>       ... = cf.create();
> 
> Pretty simple, quite exactly like the example.
> 
> I dropped all these initial registerConduitInitiator()s and
> registerDestinationsFactory()s these seem to attempt to transfer all
> traffic in-JVM (?). However the service needs to continue to serve remote
> clients via HTTP (-> Endpoint.publish(path, instance)).
> 
> Can't imaging to be the first one struggling this problem. What am I
> supposed to do LocalDestination gets a message observer?
> 
> Thanks a lot!

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