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 {


    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 "<faultstring>No 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>(JettyHT
TP Destination.java:87) at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDes
ti nation(JettyHTTPTransportFactory.java:96) at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestin
at ion(JettyHTTPTransportFactory.java:83) at
org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTra
ns 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
**********************************************************************

Reply via email to