Thanks for your replies. But I would like to come back to some questions I asked before. There is this big difference in using the CXFServlet and the CXFNonSpringServlet in how you have to define the Soap-Context so that the HTTP Transport is chosen instead of the jms (please see my last postings). My examples are according to the user's guide, which is in some ways a little confusing. So I want to exclude a misconfiguration. Can someone confirm my experiences so that I can create a bug entry?
willem.jiang wrote: > > If you don't want to use Spring to wire the components in the CXF Bus , > you can use CXFNoSpringServlet for the servlet transport initiation. > Otherwise please use the CXFServlet because you can leverage Spring > configuration file to publish your service endpoints. > > BTW, if you are using the CXF module jars, you could just remove the > cxf-rt-transport-jms* jar from your class path and it will not bother > you anymore. > > Willem > > Serethos wrote: >> Hello, >> >> now I have discovered a very interesting Point: >> According to the Jetty-NoSpring-Servlet-Transport tutorial I used the >> CXFNoSpringServlet. But if I use the normal CXFServlet the protocol http >> is >> automatically chosen! >> This makes absolutely no sense: >> How can I configure the CXFNoSpringServlet to use http (leaving the >> relative >> service path for jetty)? >> Why should I choose CXFNoSpringServlet when CXFServlet does the same job? >> >> >> >> Serethos wrote: >> >>> Hello, >>> >>> first of all: thanks for your effort. >>> >>> Another time I digged through the example from the link you posted. It's >>> quite the same thing >>> I tried before and produces the same result: >>> Not giving the http:// -Protocol-Prefix ends in a misconfiguration of >>> using JMS instead of servlet/http >>> transport. But this is how the example works. >>> Moreover it is very odd that giving a fully qualified URI _without_ port >>> leads to an wsdl. Using >>> a port does not. >>> >>> >>> >>> Ulhas Bhole wrote: >>> >>>> Hi Serentos, >>>> >>>> I have added [email protected] so that others will have chance to >>>> look at your mail and respond to it. >>>> I don't know much about servlet transport but as far as I remember CXF >>>> will match the URI prefix (e.g. http:// or jms:// or local://) with the >>>> URI prefix returned by TransportFactories that are instantiated and >>>> will >>>> choose the transport based on that. >>>> >>>> For servlet transport I would suggest you take a look at system test in >>>> CXF source here >>>> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ >>>> >>>> Regards, >>>> >>>> Ulhas Bhole >>>> >>>> [EMAIL PROTECTED] wrote: >>>> >>>>> At the moment my attempts and results are very confusing. >>>>> So I will try to describe my approach. >>>>> >>>>> First, the Webservice Interface: >>>>> >>>>> @WebService >>>>> public interface HelloWorld >>>>> { >>>>> String sayHi(@WebParam(name="text") String text); >>>>> } >>>>> >>>>> The implementing Service: >>>>> >>>>> @WebService(endpointInterface = "webservices.HelloWorld", serviceName >>>>> = >>>>> "hello") >>>>> public class HelloWorldImplementation implements HelloWorld >>>>> { >>>>> @Override >>>>> public String sayHi(String text) >>>>> { >>>>> return "waaaaazzzzuuuuuupp?! you said: " + text; >>>>> } >>>>> } >>>>> >>>>> The Servlet which shall control the Transport: >>>>> >>>>> public class HelloWorldServlet extends CXFNonSpringServlet implements >>>>> Servlet >>>>> { >>>>> @Override >>>>> public void loadBus(ServletConfig servletConfig) throws >>>>> ServletException >>>>> { >>>>> super.loadBus(servletConfig); >>>>> >>>>> Bus bus = getBus(); >>>>> BusFactory.setDefaultBus(bus); >>>>> HelloWorldImplementation service = new >>>>> HelloWorldImplementation(); >>>>> Endpoint.publish("/testService", service); >>>>> } >>>>> } >>>>> >>>>> An finally the Server with its publishing mechanism: >>>>> >>>>> public class JettyServletLauncher >>>>> { >>>>> public static void main(String args[]) >>>>> { >>>>> // String busFactory = >>>>> System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME); >>>>> System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, >>>>> "org.apache.cxf.bus.CXFBusFactory"); >>>>> >>>>> Server server = new Server(8080); >>>>> Context root = new Context(server, "/", Context.SESSIONS); >>>>> HelloWorldServlet nonSpringServlet = new HelloWorldServlet(); >>>>> root.addServlet(new ServletHolder(nonSpringServlet), "/*"); >>>>> >>>>> try >>>>> { >>>>> server.start(); >>>>> } >>>>> catch (Exception e) >>>>> { >>>>> e.printStackTrace(); >>>>> } >>>>> >>>>> } >>>>> } >>>>> >>>>> Now to my masses of questions: >>>>> >>>>> 1. If I get it right, CXF detects if a jetty/ webserver instance is >>>>> already bound. In my case, I start >>>>> jetty @ port:8080 with its root as context path. From my experiences I >>>>> am used to bin the soap service >>>>> url as relative path which is added to the jetty's context path. In my >>>>> example /testService, so that the >>>>> services should be bound to http://localhost:8080/testService?wsdl, >>>>> the >>>>> service itself is mapped to the >>>>> name "hello". >>>>> This raises the exception I mentioned before, where you detected the >>>>> problem of the wrong protocol: >>>>> an AnnotationVisitor >>>>> ([EMAIL PROTECTED]) raised an >>>>> exception on element >>>>> public void >>>>> org.apache.cxf.transport.jms.JMSTransportFactory.setBus(org.apache.cxf.Bus) >>>>> >>>>> You suggest to control the URIs again which are published through the >>>>> endpoint. But why should I add the >>>>> protocol within the Endpoint.publish method? >>>>> But if I do so, it seems that http-transport is chosen: >>>>> >>>>> Endpoint.publish("http://localhost:8080/testService", service); >>>>> >>>>> This URI seems redundant to me, because the port and the root path is >>>>> already defined by the jetty configuration. >>>>> >>>>> But the problem isn't solved then: accessing localhost:8080 gives me >>>>> an >>>>> hyperlink: >>>>> {http://webservices/}HelloWorldImplementationPort >>>>> which references: >>>>> http://localhost:8080/testService?wsdl - resulting in a message "No >>>>> service was found." >>>>> >>>>> I am especially wondering how (name of) the hyperlink is created .. >>>>> >>>>> just tried another thing: >>>>> Endpoint.publish("http://localhost/testService", service); // notice: >>>>> no >>>>> port >>>>> >>>>> This works (I get a wsdl)! But now an IllegalStateException from the >>>>> servlet is thrown .. >>>>> java.lang.IllegalStateException: STREAM >>>>> at org.mortbay.jetty.Response.getWriter(Response.java:585) >>>>> >>>>> 2. As comparison I used the internally started jetty, the main code >>>>> reduces then to this: >>>>> >>>>> CXFNonSpringServlet servlet = new CXFNonSpringServlet(); >>>>> BusFactory.setDefaultBus(servlet.getBus()); >>>>> HelloWorldImplementation service = new HelloWorldImplementation(); >>>>> Endpoint.publish("http://localhost:8080/testService", service); >>>>> JOptionPane.showMessageDialog(null, "Stop Server"); >>>>> >>>>> This works pretty good, the URI http://localhost:8080/testService?wsdl >>>>> creates a valid wsdl. >>>>> >>>>> 3. My main problems seems to be the choice of the transport protocol, >>>>> where JMS is used. Is this configuration >>>>> only dependend on the URI I use by the endpoint publishing? >>>>> >>>>> 4. There is one point within the use of the framework, I do not >>>>> understand: >>>>> The Endpoint class is from the JDK. Enpoint.publish() uses the >>>>> Provider-factory to get EndpointImpl for publishing >>>>> the service. Where and at which point is the Endpoint-Implementation >>>>> of >>>>> CXF injected? >>>>> >>>>> Many thanks in advance for digging through my questions! >>>>> >>>>> >>>>> Ulhas Bhole wrote: >>>>> >>>>> >>>>>> Hi Serethos, >>>>>> >>>>>> You are picking up JMS transport and not servlet. Make sure you have >>>>>> proper URI in your wsdl service and endpoint.publish() call. >>>>>> >>>>>> Regards, >>>>>> >>>>>> Ulhas Bhole >>>>>> >>>>>> Serethos wrote: >>>>>> >>>>>> >>>>>>> Hello! >>>>>>> >>>>>>> I need to get the Servlet Transport of CXF and Jetty to work >>>>>>> together >>>>>>> but >>>>>>> have several problems with it. >>>>>>> Searching within forums, mailing lists and the inet there is often >>>>>>> mentioned >>>>>>> the complete source the to code snippet example of the user doc >>>>>>> (http://cwiki.apache.org/CXF20DOC/servlet-transport.html). >>>>>>> The problem ist that the links to the cxf repository are always dead >>>>>>> (like >>>>>>> this one: >>>>>>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java >>>>>>> ) >>>>>>> >>>>>>> Is there any source to get all classes of the example so that I can >>>>>>> test >>>>>>> it >>>>>>> and exclude an error of mine? >>>>>>> >>>>>>> >>>>>>> As addition I want to attach my StackStrace of the error. Perhaps >>>>>>> someone >>>>>>> could give me a hint, what the problem could be (and what an >>>>>>> 'AnnotationVisitor' is) >>>>>>> >>>>>>> an AnnotationVisitor >>>>>>> ([EMAIL PROTECTED]) raised an >>>>>>> exception on element public void >>>>>>> org.apache.cxf.transport.jms.JMSTransportFactory.setBus(org.apache.cxf.Bus). >>>>>>> java.lang.NullPointerException >>>>>>> at >>>>>>> javax.naming.InitialContext.getURLScheme(InitialContext.java:269) >>>>>>> at >>>>>>> javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:318) >>>>>>> at javax.naming.InitialContext.lookup(InitialContext.java:392) >>>>>>> at >>>>>>> org.apache.cxf.transport.servlet.ServletContextResourceResolver.resolve(ServletContextResourceResolver.java:62) >>>>>>> at >>>>>>> org.apache.cxf.resource.DefaultResourceManager.findResource(DefaultResourceManager.java:99) >>>>>>> at >>>>>>> org.apache.cxf.resource.DefaultResourceManager.resolveResource(DefaultResourceManager.java:55) >>>>>>> at >>>>>>> org.apache.cxf.common.injection.ResourceInjector.resolveResource(ResourceInjector.java:401) >>>>>>> at >>>>>>> org.apache.cxf.common.injection.ResourceInjector.visitMethod(ResourceInjector.java:185) >>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>>>> at >>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>>>>>> at >>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>>>>>> at java.lang.reflect.Method.invoke(Method.java:597) >>>>>>> at >>>>>>> org.apache.cxf.common.annotation.AnnotationProcessor.visitAnnotatedElement(AnnotationProcessor.java:131) >>>>>>> at >>>>>>> org.apache.cxf.common.annotation.AnnotationProcessor.processMethods(AnnotationProcessor.java:103) >>>>>>> at >>>>>>> org.apache.cxf.common.annotation.AnnotationProcessor.accept(AnnotationProcessor.java:90) >>>>>>> at >>>>>>> org.apache.cxf.common.injection.ResourceInjector.inject(ResourceInjector.java:81) >>>>>>> at >>>>>>> org.apache.cxf.common.injection.ResourceInjector.inject(ResourceInjector.java:76) >>>>>>> at >>>>>>> org.apache.cxf.bus.extension.ExtensionManagerImpl.loadAndRegister(ExtensionManagerImpl.java:165) >>>>>>> at >>>>>>> org.apache.cxf.bus.extension.ExtensionManagerImpl.activateViaNS(ExtensionManagerImpl.java:86) >>>>>>> at >>>>>>> org.apache.cxf.bus.extension.ExtensionManagerImpl.activateAll(ExtensionManagerImpl.java:94) >>>>>>> at >>>>>>> org.apache.cxf.bus.extension.DeferredMap.undefer(DeferredMap.java:36) >>>>>>> at >>>>>>> org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactoryForUri(DestinationFactoryManagerImpl.java:136) >>>>>>> at >>>>>>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:160) >>>>>>> at >>>>>>> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102) >>>>>>> at >>>>>>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:114) >>>>>>> at >>>>>>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:160) >>>>>>> at >>>>>>> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:322) >>>>>>> at >>>>>>> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:244) >>>>>>> at >>>>>>> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:194) >>>>>>> at >>>>>>> org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:84) >>>>>>> at javax.xml.ws.Endpoint.publish(Endpoint.java:170) >>>>>>> at xoz.JettyServletLauncher.main(JettyServletLauncher.java:55) >>>>>>> >>>>>>> >>>>>>> >>>>>> ---------------------------- >>>>>> IONA Technologies PLC (registered in Ireland) >>>>>> Registered Number: 171387 >>>>>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, >>>>>> Ireland >>>>>> >>>>>> >>>>>> >>>>>> >>>>> Quoted from: >>>>> http://www.nabble.com/Using-CXF-with-Jetty-Servlet-Transport-tp18136831p18137167.html >>>>> >>>>> >>>> ---------------------------- >>>> IONA Technologies PLC (registered in Ireland) >>>> Registered Number: 171387 >>>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, >>>> Ireland >>>> >>>> >>>> >>> >> >> > > > -- View this message in context: http://www.nabble.com/Using-CXF-with-Jetty-Servlet-Transport-tp18136831p18253851.html Sent from the cxf-user mailing list archive at Nabble.com.
