cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eoghan Glynn <>
Subject premature Endpoint.publish() during CXFServlet initialization
Date Wed, 09 Apr 2008 10:25:32 GMT


I've tripped over a nasty issue when deploying a CXF application to 
Tomcat, so I'm looking for some ideas from the collective big brain on 
possible work-arounds.

The problem is that the process of init()ializing the CXFServlet 
includes publishing the <jaxws:endpoint> defined in the cxf-servlet.xml. 
However this publish() call is slightly premature, as Tomcat will not 
deliver any incoming requests to the endpoint until *after* the servlet 
init() returns (whereas the JAX-WS spec expects that "Published 
endpoints are active and capable of receiving incoming requests and 
dispatching them to their implementor"). So the endpoint is in limbo for 
a short period and this is the root of my problem.

Now I'm using a CXF ServerLifecycleListener to trigger the handing out 
of an EPR for the newly published endpoint. As a side-effect of this, 
there are some call-backs on the endpoint (both a "?wsdl" style query 
and a real invocation). These calls are failing on me as the publish()ed 
endpoint is not yet fully active, and will not be so until after the 
servlet init()ialization completes. And these failures cause the handing 
out of the supposedly live EPR to fail.

So I'm looking for alternative trigger-points, so as to either delay the 
Endpoint.publish(), or my ServerLifecycleListener.startServer() logic, 
until *after* Tomcat starts dispatching incoming requests to the webapp.

Unfortunately registering a ServletContextListener with Tomcat is no 
help, as contextInitialized() is triggered *before* the webapp is 
started. Which is odd IMO, as the method name connotes initialization in 
the past tense, but that's the way it's implemented in Tomcat 5.5.25 at 

If anyone has any other brain-waves, please shout.


IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

View raw message