Re: undocumented configuration with jetty
OMG! I just make some progress... I noticed that it was missing a library. One of our guys here changed the maven pom b/c it caused some conflicts with other libraries we use (for the record, I hate maven). Anyway, I got the neethi jar and it works now. Thanks, and sorry that the problem turned out to be on my end. - Miguel ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com **
Re: undocumented configuration with jetty
So I do that, and I get these log messages: 2007-10-29 17:45:47.094::INFO: Logging to STDERR via org.mortbay.log.StdErrLog 2007-10-29 17:45:47.181::INFO: jetty-6.0.2 Oct 29, 2007 5:45:47 PM org.apache.cxf.transport.servlet.CXFServlet loadBusNoConfig INFO: load the bus without application context Oct 29, 2007 5:45:47 PM org.apache.cxf.transport.servlet.CXFServlet replaceDestinationFactory INFO: replaced the http destionFactory with servlet transport factory 2007-10-29 17:45:47.866::INFO: Started SocketConnector @ 0.0.0.0:9000 Oct 29, 2007 5:45:47 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: Creating Service {http://test.tandbergtv.com/}HelloWorldImplService from class com.tandbergtv.test.HelloWorldImpl test.tandbergtv.com is the package that my HelloWorldImpl and interface are in. I did have to change the line to Endpoint.publish(http://localhost:9000/soap/hello;, new HelloWorldImpl()); because I was getting a no protocol exception. I find it odd that it says load the bus without application context. Anyway, when I try to load it, I get a null pointer exception. http://localhost:9000/soap/?wsdl 2007-10-29 17:50:18.397::WARN: /soap/: java.lang.NullPointerException at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:89) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278) at org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141) at org.mortbay.jetty.Server.handle(Server.java:303) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:217) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) 2007-10-29 17:50:18.399::WARN: /soap/ java.lang.NullPointerException at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:89) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278) at org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141) at org.mortbay.jetty.Server.handle(Server.java:303) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:217) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) On Thursday 25 October 2007, Willem Jiang wrote: Hi , I write a simple test with your case. The services are all published :) Please see the below code. public class JettyServer { public static void main(String[] args) throws Exception { org.mortbay.jetty.Server httpServer = new Server(9000); ContextHandlerCollection contexts = new ContextHandlerCollection(); httpServer.setHandler(contexts); Context root = new Context(contexts,/,Context.SESSIONS);
Re: undocumented configuration with jetty
Actually I do like spring. However, we are currently using it to allow the customer to configure the app and I don't feel its appropriate for them to configure the soap interface this way. Our app runs as a standalone java app and doesn't use an application context. I'm just loading objects using the following: Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Object o = factory.getBean(bean); After I have o I don't keep a bean factory or anything around. So after looking at that bug report, it makes me wonder if there is something else. The bug says that it has something to do with an application context class not being around. Could it be that I'm getting nulls because there is an application class? What can I do to make it work? Should I load my jetty server from a bean and through the application context so that cxf can find it and register the endpoints properly? In other words, if I make my xml config look like what you have in http://cwiki.apache.org/CXF20DOC/jetty-configuration.html how can I get reference to the server in my app so that my other servlets can be registered as well? Thanks for all your help so far. On Monday 29 October 2007, Willem Jiang wrote: O, I can tell the reason form your stack trace, you are not the fans of Spring ;). It's definitely a bug of CXFServlet, here is a JIRA[1] for it and I will do a quick fix for it. Please have an eye on JIRA[1]. [1]https://issues.apache.org/jira/browse/CXF-1072 Willem. ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com **
Re: undocumented configuration with jetty
O, I can tell the reason form your stack trace, you are not the fans of Spring ;). It's definitely a bug of CXFServlet, here is a JIRA[1] for it and I will do a quick fix for it. Please have an eye on JIRA[1]. [1]https://issues.apache.org/jira/browse/CXF-1072 Willem. Miguel De Anda wrote: So I do that, and I get these log messages: 2007-10-29 17:45:47.094::INFO: Logging to STDERR via org.mortbay.log.StdErrLog 2007-10-29 17:45:47.181::INFO: jetty-6.0.2 Oct 29, 2007 5:45:47 PM org.apache.cxf.transport.servlet.CXFServlet loadBusNoConfig INFO: load the bus without application context Oct 29, 2007 5:45:47 PM org.apache.cxf.transport.servlet.CXFServlet replaceDestinationFactory INFO: replaced the http destionFactory with servlet transport factory 2007-10-29 17:45:47.866::INFO: Started SocketConnector @ 0.0.0.0:9000 Oct 29, 2007 5:45:47 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: Creating Service {http://test.tandbergtv.com/}HelloWorldImplService from class com.tandbergtv.test.HelloWorldImpl test.tandbergtv.com is the package that my HelloWorldImpl and interface are in. I did have to change the line to Endpoint.publish(http://localhost:9000/soap/hello;, new HelloWorldImpl()); because I was getting a no protocol exception. I find it odd that it says load the bus without application context. Anyway, when I try to load it, I get a null pointer exception. http://localhost:9000/soap/?wsdl 2007-10-29 17:50:18.397::WARN: /soap/: java.lang.NullPointerException at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:89) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278) at org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141) at org.mortbay.jetty.Server.handle(Server.java:303) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:217) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) 2007-10-29 17:50:18.399::WARN: /soap/ java.lang.NullPointerException at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:89) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278) at org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141) at org.mortbay.jetty.Server.handle(Server.java:303) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:217) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475) On Thursday 25 October 2007, Willem Jiang wrote: Hi , I write a simple test with your case. The services are all published :) Please see the below code. public class JettyServer { public static void main(String[] args) throws Exception {
Re: undocumented configuration with jetty
Hi, I had got to ask you what version of CXF are you using. I just traced the code which I had showed to you, I did not step into the loadBusNoConfig method, because I had the spring-context-*.jar in my class path. But I found the key, we should call replaceDestinationFactory() before createServletController in loadBusNoConfig to avoid passing the NP (ServletTransport) to the ServletController. If you are using CXF 2.0.2 , I think adding the spring-context-2.*.jar into your class path will solve this problem. My coming up fixing will help you to solve the NPE in most case. BTW, you do not need to do any configuration on Jetty as the Jetty-configuration said. Because it is for using Jetty-http transport and not for the Servlet-http transport. Willem. Miguel De Anda wrote: Actually I do like spring. However, we are currently using it to allow the customer to configure the app and I don't feel its appropriate for them to configure the soap interface this way. Our app runs as a standalone java app and doesn't use an application context. I'm just loading objects using the following: Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Object o = factory.getBean(bean); After I have o I don't keep a bean factory or anything around. So after looking at that bug report, it makes me wonder if there is something else. The bug says that it has something to do with an application context class not being around. Could it be that I'm getting nulls because there is an application class? What can I do to make it work? Should I load my jetty server from a bean and through the application context so that cxf can find it and register the endpoints properly? In other words, if I make my xml config look like what you have in http://cwiki.apache.org/CXF20DOC/jetty-configuration.html how can I get reference to the server in my app so that my other servlets can be registered as well? Thanks for all your help so far. On Monday 29 October 2007, Willem Jiang wrote: O, I can tell the reason form your stack trace, you are not the fans of Spring ;). It's definitely a bug of CXFServlet, here is a JIRA[1] for it and I will do a quick fix for it. Please have an eye on JIRA[1]. [1]https://issues.apache.org/jira/browse/CXF-1072 Willem. ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com **
RE: undocumented configuration with jetty
What version of jetty? -Original Message- From: Miguel De Anda [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:29 PM To: cxf-user@incubator.apache.org Subject: undocumented configuration with jetty i've got an application (my server) that launches its own jetty server for sending files to external nodes. they currently talk to each other using simple xml passed in as a post request and in the response. the external nodes don't run a web server of any kind. i now need to add a soap interface on my server but can't figure out how. this is how my jetty server is started: ServletHolder servlet; org.mortbay.jetty.Server jettyServer = new org.mortbay.jetty.Server(PORT); Context root = new Context(jettyServer, /, Context.SESSIONS); servlet = new ServletHolder(someServlet); root.addServlet(servlet, /*); CXFServlet cxf = new CXFServlet(); servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); HelloWorld hw = new HelloWorldImpl(); Endpoint.publish(/soap/HelloWorld, hw); jettyServer.start(); package a.b.c; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } import javax.jws.WebService; @WebService(endpointInterface = a.b.c.HelloWorld) public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return The interesting question becomes is what is soap?; } } i got errors ranging from a null pointer exception when i went to http://localhost:PORT/soap/ to /soap/HelloWorld not being a valid url (in the line Endpoint.publish). i had to set a full url there, when i used http://localhost:PORT/soap/HelloWorld; it told me that the port was being used, so i figured its launching its own internal instance of jetty (or whatever it uses). i then replaced the port to some 8087 and it almost works, but i get a faultstringNo such operation: /faultstring message when viewing http://localhost:8087/soap/HelloWorld i would really like to be able to use the same jetty server, and be able to give access to my existing objects in my application. i'm using spring to load up an object that has all of my configuration settings but not in the same way you would in a typical web app that runs on a webserver. the customer currently has access to that spring config file and it would be wrong to give them access (or force them to configure) the soap services. in other words, my app is launched this way: public static void main(...) { Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Config config = (Config)factory.getBean(bean); configApp(config); startServices(); } Actual error messages: (using /soap/... in publish line) Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld at java.net.URL.init(URL.java:567) at java.net.URL.init(URL.java:464) at java.net.URL.init(URL.java:413) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.init(JettyHTT PD estination.java:87) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDest in ation(JettyHTTPTransportFactory.java:96) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestina ti on(JettyHTTPTransportFactory.java:83) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTran sp ortFactory.java:74) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:69) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java: 10 8) ... 8 more (using http://...:PORT/ in publish line) Exception in thread main java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com **
Re: undocumented configuration with jetty
Hi, You need to use the bus of the CXFServlet. You could use the CXF Servlet transport with this bus. Please add the below code just before Endpoint.publish(...) Bus bus = cxf.getBus(); BusFactory.setDefaultBus(bus); Willem. Miguel De Anda-2 wrote: i've got an application (my server) that launches its own jetty server for sending files to external nodes. they currently talk to each other using simple xml passed in as a post request and in the response. the external nodes don't run a web server of any kind. i now need to add a soap interface on my server but can't figure out how. this is how my jetty server is started: ServletHolder servlet; org.mortbay.jetty.Server jettyServer = new org.mortbay.jetty.Server(PORT); Context root = new Context(jettyServer, /, Context.SESSIONS); servlet = new ServletHolder(someServlet); root.addServlet(servlet, /*); CXFServlet cxf = new CXFServlet(); servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); HelloWorld hw = new HelloWorldImpl(); Endpoint.publish(/soap/HelloWorld, hw); jettyServer.start(); package a.b.c; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } import javax.jws.WebService; @WebService(endpointInterface = a.b.c.HelloWorld) public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return The interesting question becomes is what is soap?; } } i got errors ranging from a null pointer exception when i went to http://localhost:PORT/soap/ to /soap/HelloWorld not being a valid url (in the line Endpoint.publish). i had to set a full url there, when i used http://localhost:PORT/soap/HelloWorld; it told me that the port was being used, so i figured its launching its own internal instance of jetty (or whatever it uses). i then replaced the port to some 8087 and it almost works, but i get a faultstringNo such operation: /faultstring message when viewing http://localhost:8087/soap/HelloWorld i would really like to be able to use the same jetty server, and be able to give access to my existing objects in my application. i'm using spring to load up an object that has all of my configuration settings but not in the same way you would in a typical web app that runs on a webserver. the customer currently has access to that spring config file and it would be wrong to give them access (or force them to configure) the soap services. in other words, my app is launched this way: public static void main(...) { Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Config config = (Config)factory.getBean(bean); configApp(config); startServices(); } Actual error messages: (using /soap/... in publish line) Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld at java.net.URL.init(URL.java:567) at java.net.URL.init(URL.java:464) at java.net.URL.init(URL.java:413) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.init(JettyHTTPDestination.java:87) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:96) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:83) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:74) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:69) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108) ... 8 more (using http://...:PORT/ in publish line) Exception in thread main java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com ** -- View this message in context: http://www.nabble.com/undocumented-configuration-with-jetty-tf4688264.html#a13407166 Sent from the cxf-user mailing list archive at Nabble.com.
Re: undocumented configuration with jetty
using jetty 6.0.2 On Thursday 25 October 2007, Benson Margulies wrote: What version of jetty? -Original Message- From: Miguel De Anda [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:29 PM To: cxf-user@incubator.apache.org Subject: undocumented configuration with jetty i've got an application (my server) that launches its own jetty server for sending files to external nodes. they currently talk to each other using simple xml passed in as a post request and in the response. the external nodes don't run a web server of any kind. i now need to add a soap interface on my server but can't figure out how. this is how my jetty server is started: ServletHolder servlet; org.mortbay.jetty.Server jettyServer = new org.mortbay.jetty.Server(PORT); Context root = new Context(jettyServer, /, Context.SESSIONS); servlet = new ServletHolder(someServlet); root.addServlet(servlet, /*); CXFServlet cxf = new CXFServlet(); servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); HelloWorld hw = new HelloWorldImpl(); Endpoint.publish(/soap/HelloWorld, hw); jettyServer.start(); package a.b.c; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } import javax.jws.WebService; @WebService(endpointInterface = a.b.c.HelloWorld) public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return The interesting question becomes is what is soap?; } } i got errors ranging from a null pointer exception when i went to http://localhost:PORT/soap/ to /soap/HelloWorld not being a valid url (in the line Endpoint.publish). i had to set a full url there, when i used http://localhost:PORT/soap/HelloWorld; it told me that the port was being used, so i figured its launching its own internal instance of jetty (or whatever it uses). i then replaced the port to some 8087 and it almost works, but i get a faultstringNo such operation: /faultstring message when viewing http://localhost:8087/soap/HelloWorld i would really like to be able to use the same jetty server, and be able to give access to my existing objects in my application. i'm using spring to load up an object that has all of my configuration settings but not in the same way you would in a typical web app that runs on a webserver. the customer currently has access to that spring config file and it would be wrong to give them access (or force them to configure) the soap services. in other words, my app is launched this way: public static void main(...) { Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Config config = (Config)factory.getBean(bean); configApp(config); startServices(); } Actual error messages: (using /soap/... in publish line) Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld at java.net.URL.init(URL.java:567) at java.net.URL.init(URL.java:464) at java.net.URL.init(URL.java:413) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.init(JettyHTT PD estination.java:87) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDest in ation(JettyHTTPTransportFactory.java:96) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestina ti on(JettyHTTPTransportFactory.java:83) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTran sp ortFactory.java:74) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:69) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java: 10 8) ... 8 more (using http://...:PORT/ in publish line) Exception in thread main java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com ** -- Miguel De Anda Software Engineer TANDBERG Television | Part of the Ericsson Group 100 N. Sepulveda Blvd. Suite 1600 | El Segundo | CA 90245 Tel: 310.591.3041 | Fax: 310.591.3099 Email: [EMAIL
Re: undocumented configuration with jetty
I tried that and nothing changed. I tried moving that block to after the jetty server is running and it doesn't make that much of a difference. Should I be worried that I have to use a full url as the first parameter to Endpoint.publish? In the example I saw, it only had the path. On Thursday 25 October 2007, Willem2 wrote: Hi, You need to use the bus of the CXFServlet. You could use the CXF Servlet transport with this bus. Please add the below code just before Endpoint.publish(...) Bus bus = cxf.getBus(); BusFactory.setDefaultBus(bus); Willem. Miguel De Anda-2 wrote: i've got an application (my server) that launches its own jetty server for sending files to external nodes. they currently talk to each other using simple xml passed in as a post request and in the response. the external nodes don't run a web server of any kind. i now need to add a soap interface on my server but can't figure out how. this is how my jetty server is started: ServletHolder servlet; org.mortbay.jetty.Server jettyServer = new org.mortbay.jetty.Server(PORT); Context root = new Context(jettyServer, /, Context.SESSIONS); servlet = new ServletHolder(someServlet); root.addServlet(servlet, /*); CXFServlet cxf = new CXFServlet(); servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); HelloWorld hw = new HelloWorldImpl(); Endpoint.publish(/soap/HelloWorld, hw); jettyServer.start(); package a.b.c; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } import javax.jws.WebService; @WebService(endpointInterface = a.b.c.HelloWorld) public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return The interesting question becomes is what is soap?; } } i got errors ranging from a null pointer exception when i went to http://localhost:PORT/soap/ to /soap/HelloWorld not being a valid url (in the line Endpoint.publish). i had to set a full url there, when i used http://localhost:PORT/soap/HelloWorld; it told me that the port was being used, so i figured its launching its own internal instance of jetty (or whatever it uses). i then replaced the port to some 8087 and it almost works, but i get a faultstringNo such operation: /faultstring message when viewing http://localhost:8087/soap/HelloWorld i would really like to be able to use the same jetty server, and be able to give access to my existing objects in my application. i'm using spring to load up an object that has all of my configuration settings but not in the same way you would in a typical web app that runs on a webserver. the customer currently has access to that spring config file and it would be wrong to give them access (or force them to configure) the soap services. in other words, my app is launched this way: public static void main(...) { Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Config config = (Config)factory.getBean(bean); configApp(config); startServices(); } Actual error messages: (using /soap/... in publish line) Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld at java.net.URL.init(URL.java:567) at java.net.URL.init(URL.java:464) at java.net.URL.init(URL.java:413) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.init(JettyHTTP Destination.java:87) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDesti nation(JettyHTTPTransportFactory.java:96) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestinat ion(JettyHTTPTransportFactory.java:83) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTrans portFactory.java:74) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:69) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:1 08) ... 8 more (using http://...:PORT/ in publish line) Exception in thread main java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com **
RE: undocumented configuration with jetty
I've done this by letting CXF configure Jetty for me. (Example at the end). You then need to write code in your application to locate the Jetty server and anything you need to connect up to it. If you don't want to do that, I'd suggest configuring your CXF service as a full webapp that deploys the CXFServlet and configures your services with Spring. Then add an org.mortbay.jetty.WebAppContext to your Jetty initialization stack, passing it a base URL and the pathname of the web app (.war or unpacked). Endpoints would look like address=/blooie, and the result is to concatenate /blooie onto the end of the context URL for the WebAppContext. httpj:engine-factory bus=cxf httpj:engine port=8808 httpj:handlers !-- bean class=org.mortbay.jetty.handler.RequestLogHandler property name=requestLog bean class=org.mortbay.jetty.NCSARequestLog property name=filename value=jetty.log/ /bean /property /bean -- bean class=org.mortbay.jetty.webapp.WebAppContext constructor-arg value=${jsunitPathname}/ constructor-arg value=/jsunit/ /bean bean class=org.mortbay.jetty.handler.ContextHandler property name=contextPath value=/${staticResourceBase} / property name=handler bean class=org.mortbay.jetty.handler.ResourceHandler property name=baseResource bean class=org.mortbay.resource.FileResource constructor-arg value=${staticResourceURL} / /bean /property /bean /property /bean /httpj:handlers /httpj:engine /httpj:engine-factory
Re: undocumented configuration with jetty
Hi , I write a simple test with your case. The services are all published :) Please see the below code. public class JettyServer { public static void main(String[] args) throws Exception { org.mortbay.jetty.Server httpServer = new Server(9000); ContextHandlerCollection contexts = new ContextHandlerCollection(); httpServer.setHandler(contexts); Context root = new Context(contexts,/,Context.SESSIONS); CXFServlet cxf = new CXFServlet(); ServletHolder servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); httpServer.start(); Bus bus = cxf.getBus(); BusFactory.setDefaultBus(bus); // register service String uri = / +GreeterImpl.class.getSimpleName(); Endpoint.publish(uri, new GreeterImpl()); Endpoint.publish(/hello, new HelloImpl()); } } Willem. Miguel De Anda wrote: I tried that and nothing changed. I tried moving that block to after the jetty server is running and it doesn't make that much of a difference. Should I be worried that I have to use a full url as the first parameter to Endpoint.publish? In the example I saw, it only had the path. On Thursday 25 October 2007, Willem2 wrote: Hi, You need to use the bus of the CXFServlet. You could use the CXF Servlet transport with this bus. Please add the below code just before Endpoint.publish(...) Bus bus = cxf.getBus(); BusFactory.setDefaultBus(bus); Willem. Miguel De Anda-2 wrote: i've got an application (my server) that launches its own jetty server for sending files to external nodes. they currently talk to each other using simple xml passed in as a post request and in the response. the external nodes don't run a web server of any kind. i now need to add a soap interface on my server but can't figure out how. this is how my jetty server is started: ServletHolder servlet; org.mortbay.jetty.Server jettyServer = new org.mortbay.jetty.Server(PORT); Context root = new Context(jettyServer, /, Context.SESSIONS); servlet = new ServletHolder(someServlet); root.addServlet(servlet, /*); CXFServlet cxf = new CXFServlet(); servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); HelloWorld hw = new HelloWorldImpl(); Endpoint.publish(/soap/HelloWorld, hw); jettyServer.start(); package a.b.c; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } import javax.jws.WebService; @WebService(endpointInterface = a.b.c.HelloWorld) public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return The interesting question becomes is what is soap?; } } i got errors ranging from a null pointer exception when i went to http://localhost:PORT/soap/ to /soap/HelloWorld not being a valid url (in the line Endpoint.publish). i had to set a full url there, when i used http://localhost:PORT/soap/HelloWorld; it told me that the port was being used, so i figured its launching its own internal instance of jetty (or whatever it uses). i then replaced the port to some 8087 and it almost works, but i get a faultstringNo such operation: /faultstring message when viewing http://localhost:8087/soap/HelloWorld i would really like to be able to use the same jetty server, and be able to give access to my existing objects in my application. i'm using spring to load up an object that has all of my configuration settings but not in the same way you would in a typical web app that runs on a webserver. the customer currently has access to that spring config file and it would be wrong to give them access (or force them to configure) the soap services. in other words, my app is launched this way: public static void main(...) { Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Config config = (Config)factory.getBean(bean); configApp(config); startServices(); } Actual error messages: (using /soap/... in publish line) Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld at java.net.URL.init(URL.java:567) at java.net.URL.init(URL.java:464) at java.net.URL.init(URL.java:413) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.init(JettyHTTP Destination.java:87) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDesti nation(JettyHTTPTransportFactory.java:96) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestinat ion(JettyHTTPTransportFactory.java:83) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTrans portFactory.java:74) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
undocumented configuration with jetty
i've got an application (my server) that launches its own jetty server for sending files to external nodes. they currently talk to each other using simple xml passed in as a post request and in the response. the external nodes don't run a web server of any kind. i now need to add a soap interface on my server but can't figure out how. this is how my jetty server is started: ServletHolder servlet; org.mortbay.jetty.Server jettyServer = new org.mortbay.jetty.Server(PORT); Context root = new Context(jettyServer, /, Context.SESSIONS); servlet = new ServletHolder(someServlet); root.addServlet(servlet, /*); CXFServlet cxf = new CXFServlet(); servlet = new ServletHolder(cxf); servlet.setName(soap); servlet.setForcedPath(soap); root.addServlet(servlet, /soap/*); HelloWorld hw = new HelloWorldImpl(); Endpoint.publish(/soap/HelloWorld, hw); jettyServer.start(); package a.b.c; import javax.jws.WebService; @WebService public interface HelloWorld { String sayHi(String text); } import javax.jws.WebService; @WebService(endpointInterface = a.b.c.HelloWorld) public class HelloWorldImpl implements HelloWorld { public String sayHi(String text) { return The interesting question becomes is what is soap?; } } i got errors ranging from a null pointer exception when i went to http://localhost:PORT/soap/ to /soap/HelloWorld not being a valid url (in the line Endpoint.publish). i had to set a full url there, when i used http://localhost:PORT/soap/HelloWorld; it told me that the port was being used, so i figured its launching its own internal instance of jetty (or whatever it uses). i then replaced the port to some 8087 and it almost works, but i get a faultstringNo such operation: /faultstring message when viewing http://localhost:8087/soap/HelloWorld i would really like to be able to use the same jetty server, and be able to give access to my existing objects in my application. i'm using spring to load up an object that has all of my configuration settings but not in the same way you would in a typical web app that runs on a webserver. the customer currently has access to that spring config file and it would be wrong to give them access (or force them to configure) the soap services. in other words, my app is launched this way: public static void main(...) { Resource resource = new FileSystemResource(config); BeanFactory factory = new XmlBeanFactory(resource); Config config = (Config)factory.getBean(bean); configApp(config); startServices(); } Actual error messages: (using /soap/... in publish line) Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld at java.net.URL.init(URL.java:567) at java.net.URL.init(URL.java:464) at java.net.URL.init(URL.java:413) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.init(JettyHTTPDestination.java:87) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:96) at org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:83) at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:74) at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90) at org.apache.cxf.endpoint.ServerImpl.init(ServerImpl.java:69) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108) ... 8 more (using http://...:PORT/ in publish line) Exception in thread main java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) ** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com **