Earlier today I ran into a weird error deploying my CXF web service to an embedded Tomcat instance. The error looked a bit like this.

...
SEVERE: Servlet /myServlet threw load() exception
java.lang.ClassCastException:
org.apache.cxf.transport.servlet.CXFServlet
cannot be cast to javax.servlet.Servlet

Annoying. I've seen this before, but never actually had to solve it myself. I figured that my web.xml was misconfigured, but on checking it out, everything seemed fine.

To cut a long story short, servlet.jar is the culprit. I needed the Sun jar to test the web service with JUnit. By including the dependency in my POM, I inadvertently packaged two in my war- one with CXF, and another as a dependency of my project. I changed my dependency scope to test, and continued on my way.