Hi,
I'm running a jetty-container to host a CFXNonSpringServlet. This works
fine, but then I tried to inject the WebServiceContext into my Webservice.
This didn't work (neither with field- nor with setter-injection). There is a
warning that the injection wasn't performed and then the variable is
null:24.06.2009 19:08:11 org.apache.cxf.common.injection.ResourceInjector
visitField
INFO: failed to resolve resource
biz.horus.database.ws.servercxf.WSReferenceManager/context
When debugging through the visit-field method it seems to me that the
Context is there, but it isn't found/assigned.
The code starting the servlet is as following (using with jetty 6 and
starting it in an equinox-container but this shouldn't be the point I
think?):
Server server = new Server();
Connector connector = new SelectChannelConnector();
connector.setPort(8080);
server.setConnectors(new Connector[] { connector });
Constraint constraint = new Constraint(Constraint.__DIGEST_AUTH,
Constraint.ANY_ROLE);
constraint.setAuthenticate(true);
ConstraintMapping cm = new ConstraintMapping();
cm.setConstraint(constraint);
cm.setPathSpec("/*");
SecurityHandler sh = new SecurityHandler();
sh.setUserRealm(new HashUserRealm("MyRealm", "hashRealm.config"));
sh.setConstraintMappings(new ConstraintMapping[] { cm });
Context jettyContext = new Context(server, "/");
jettyContext.setSecurityHandler(sh);
CXFNonSpringServlet cxf = new CXFNonSpringServlet();
ServletHolder servlet = new ServletHolder(cxf);
servlet.setName("soap");
servlet.setForcedPath("soap");
jettyContext.addServlet(servlet, "/soap/*");
server.start();
Bus bus = cxf.getBus();
BusFactory.setDefaultBus(bus);
ServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setBus(bus);
factory.setServiceClass(WSReferenceManager.class);
factory.setAddress("/Referencemanager");
factory.create();
Any hints what I could do to solve the Problem? I read about a @Context
annotation, but there is no sucht annotation (having loaded cxf-2.2.2.jar,
wsdl4j-1.6.2.jar and XmlSchema-1.4.5.jar)
Any help would be appreciated,
best regards
- orgler