Hi ,

You can take a look at this code[1] in the CXF systests. You just need
to change the CXFNonSpringServlet to CXFSpringServlet.
[1]
https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java

Willem

Kirill R. wrote:
> I have found a few threads on this topic but none really answered my
> question, so here goes:
> 
> We have a standalone application which uses a Spring context with embedded
> Jetty.
> I want to be able to start and stop web services in runtime using the CXF
> servlet hosted in that Jetty.
> In order to do this, I need to access servlet's bus as suggested in docs. So
> I create the servlet
> as a bean in our Spring context, hook it up to Jetty using a simple wrapper:
> 
> [code]
>     public ServletWrapperBean(ContextHandlerCollection contexts,
>         CXFServlet cxfServlet, String path) throws Exception
>     {
>         final Context root = new Context(contexts, "/", Context.SESSIONS);
>         ServletHolder servlet = new ServletHolder(cxfServlet);
>         root.addServlet(servlet, path);
>     }
> [/code]
> 
> and then pass to my class which uses it to set BusFactory's defaultBus
> before publishing services.
> 
> And it doesn't quite work:
> in 2.1.1 the servlet's bus was null and CXF was unable to locate the HTTP
> transport extension.
> With newer versions (tried 2.1.3 today), it can't even load our Spring
> context because CFXServlet throws
> an NPE in updateContext (ServletConfig is null).
> 
> How do I configure it properly?
> 
> Sorry if this is an amateurish question.

Reply via email to