On Friday, December 02, 2011 12:16:44 PM Aaron Alpar wrote:
> All,
> 
> I am getting:
> 
> Exception in thread "main" java.lang.IllegalArgumentException: Cannot
> create URL for this address /Greeter
>       at
> com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointI
> mpl.java:134) at
> com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint(ProviderIm
> pl.java:102) at javax.xml.ws.Endpoint.publish(Endpoint.java:170)
>       at com.mowry.server.Main.main(Main.java:33)

This isn't picking up the CXF jaxws implementation.   Are you sure you have 
the cxf-rt-frontend-jaxws jar on the classpath?

Dan



> 
> When running the "CXF without Spring" example.
> 
> Does this problem sound like a common problem?
> 
> Full code below:
> ---8K--- (Main.java) ---
> import javax.xml.ws.Endpoint;
> 
> import org.apache.cxf.Bus;
> import org.apache.cxf.BusFactory;
> import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
> import org.mortbay.jetty.Server;
> import org.mortbay.jetty.handler.ContextHandlerCollection;
> import org.mortbay.jetty.servlet.Context;
> import org.mortbay.jetty.servlet.ServletHolder;
> 
> public class Main {
> 
>       public static void main(final String[] args) throws Exception {
>               final String busFactory =
> System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
>               System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME,
> "org.apache.cxf.bus.CXFBusFactory");
>               try {
>                       // Start up the jetty embedded server
>                       final Server httpServer = new Server(9000);
>                       final ContextHandlerCollection contexts = new
> ContextHandlerCollection();
>                       httpServer.setHandler(contexts);
>                       final Context root = new Context(contexts, "/", 
Context.SESSIONS);
>                       final CXFNonSpringServlet cxf = new 
> CXFNonSpringServlet();
>                       final ServletHolder servlet = new ServletHolder(cxf);
>                       servlet.setName("soap");
>                       servlet.setForcedPath("soap");
>                       root.addServlet(servlet, "/soap/*");
>                       httpServer.start();
>                       final Bus bus = cxf.getBus();
>                       BusFactory.setDefaultBus(bus);
>                       final GreeterImpl impl = new GreeterImpl();
>                       Endpoint.publish("/Greeter", impl);
>               } finally {
>                       // clean up the system properties
>                       if (busFactory != null) {
>                               
> System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME,
> busFactory);
>                       } else {
>                               
System.clearProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
>                       }
>               }
>       }
> ---(Main.java)---
> ---(GreeterImpl.java)---
> 
> import java.util.logging.Logger;
> 
> // wsdlLocation = "file:./wsdl/hello_world.wsdl"
> @javax.jws.WebService(name = "Greeter",
>         serviceName = "SOAPService",
>         targetNamespace = "http://apache.org/hello_world_soap_http";)
> public class GreeterImpl implements Greeter {
> 
>       private static final Logger LOG =
> Logger.getLogger(GreeterImpl.class.getPackage().getName());
> 
>       /*
>        * (non-Javadoc)
>        *
>        * @see
>        *
> org.objectweb.hello_world_soap_http.Greeter#greetMe(java.lang.String)
>        */
>       @Override
>       public String greetMe(final String me) {
>               LOG.info("Executing operation greetMe");
>               System.out.println("Executing operation greetMe");
>               System.out.println("Message received: " + me + "\n");
>               return "Hello " + me;
>       }
> }
> ---(GreeterImpl.java)---
-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to