I have many CXF WS to deploy (13 wars) and sometimes one of them give me this error:
java.lang.NoClassDefFoundError: org/apache/cxf/transport/servlet/BaseUrlHelper
org.apache.cxf.transport.servlet.ServletController.getBaseURL(ServletController.java:74)
org.apache.cxf.transport.servlet.ServletController.updateDestination(ServletController.java:83)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:196)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:149)
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:290)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52
The jar containing this class is in every lib application: cxf-rt-transports-http-3.0.2.jar
.
When I reload the one who's not working by the tomcat manager, I don't have the problem anymore and it reappears (on another war randomly) when I restart the server. The missing class is always the same.
I use Cxf version 3.0.2.
It appears it was a problem with the number of file opened by process. The tomcat's classloader has opened too many files because each application/war had numerous libraries in his repertory WEB-INF/lib.
When the ClassLoader can't open a java class file because of this limit, it doesn't throw any Exception: it just doesn't load the class... So when I called my application, the first class which was called and not loaded was BaseUrlHelper...
I've put some libraries in the tomcat/lib (and I have deleted them from the repertory WEB-INF/lib) and the applications have worked fine. If you have admin access in your unix system, i saw there is also a thing with the command ulimit ..
You can also put you application in more tomcats.