cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Meeraj Kunnumpurath" <>
Subject Could not find destination factory
Date Sat, 02 Jun 2007 10:51:00 GMT

I have got a simple scenario where a service provisioned using CXF is
accessed from a client.

This is the interface of the service that is provisioned,

public interface Greeter {
    public abstract String greet(String name);

The server-side code looks like this,

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.fabric3.jetty.JettyServiceImpl;
import org.fabric3.jetty.TransportMonitor;

public class Server {

     * @param args
     * @throws Exception
    public static void main(String[] args) throws Exception {

        // This is a wrapper around embedded Jetty
        JettyServiceImpl jettyService = new JettyServiceImpl(new
TransportMonitor() {
            public void debug(String msg, Object... args) { }
            public void shutdown() { }
            public void started() { }
            public void warn(String msg, Object... args) { }

        CXFServlet cxfServlet = new CXFServlet();
        jettyService.registerMapping("/services/*", cxfServlet);
        InvocationHandler handler = new InvocationHandler() {
            public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
                return "Hello " + args[0];
        ClassLoader cl = Server.class.getClassLoader();
        Class<?>[] interfaces = {Greeter.class};
        Object implementor = Proxy.newProxyInstance(cl, interfaces,

        ServerFactoryBean serverFactoryBean = new ServerFactoryBean();



This is the client used to invoke the service,

import java.lang.reflect.Method;

import org.apache.cxf.frontend.ClientProxyFactoryBean;

public class Client {

     * @param args
     * @throws Exception
    public static void main(String[] args) throws Exception {

        ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
        Object proxy = factory.create();
        Method method = proxy.getClass().getDeclaredMethod("greet",

        System.err.println(method.invoke(proxy, "Fred"));


The server starts up fine, however, when I invoke the client, I get the
following exception

Caused by: java.lang.RuntimeException: Could not find destination factory
for transport
    at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(
    at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(
    at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(
    at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(
    at org.apache.cxf.endpoint.ClientImpl.invoke(
    at org.apache.cxf.frontend.ClientProxy.invokeSync(
    at org.apache.cxf.frontend.ClientProxy.invoke(
    at $Proxy37.greet(Unknown Source)

I am not sure whether I need to add anything more in the client code to
register the destination factory. BTW, the client works if I run it in the
same JVM as the server. However, when I try them in two JVMs I get the above
exception. Any help would be highly appreciated.

Many thanks

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message