I have an EAR module which contian ejb client, structs web module and webservice which created by annotation. Application works fine and wsdl is published in JBOSS. But in websphere it gives
java.lang.ClassCastException SourceId:com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet ProbeId:213 Reporter:com.ibm.ws.webcontainer.servlet.ServletWrapper$1@3ae83ae8
java.lang.ClassCastException: com.test.eventmanagement.ws.EventManagementWS incompatible with javax.servlet.Servlet
The have the follwoing jar files in my lib.
commons-beanutils-1.7.0.jar,commons-digester-1.8.jar,commons-fileupload-1.1.1.jar,
freemarker-2.3.8.jar,gson-1.7.1.jar,itext-2.0.8.jar,javaee-api-5.jar,
jxl-2.6.10.jar,ognl-2.6.11.jar,retrotranslator-runtime-1.0.4.jar,
struts2-core-2.1.8.1.jar,struts2-tiles-plugin-2.1.8.1.jar,
tiles-api-2.1.0.jar,tiles-compat-2.1.0.jar,tiles-core-2.1.0.jar,
tiles-jsp- 2.1.0.jar,tiles-servlet-2.1.0.jar,xwork-core-2.1.6.jar
In my web.xml i have added
<!-- Web Service -->
<servlet>
<servlet-name>EventManagementWS</servlet-name>
<servlet-class>com.test.eventmanagement.ws.EventManagementWS</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>EventManagementWS</servlet-name>
<url-pattern>/EventManagementWS</url-pattern>
</servlet-mapping>
I have googled a lot but still nothing helped me. Some where i have read that its because of jar conflict, but i am not able to find it.
Make sure your Web.xml is correct especially the version should be 2.5 for servlet 2.5. It should be something like
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
WebSphere is very strict on this.