2012-09-01 23 views
0

我有一個EAR模塊,它可以連接ejb客戶端,構建通過註釋創建的web模塊和webservice。應用程序工作正常,wsdl在JBOSS中發佈。但是,在WebSphere它給Websphere:ClassCastException爲Webservice

java.lang.ClassCastException SourceId:com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet ProbeId:213 Reporter:[email protected] 
java.lang.ClassCastException: com.test.eventmanagement.ws.EventManagementWS incompatible with javax.servlet.Servlet 

的在我的lib中follwoing jar文件。

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 

在我的web.xml我已經添加

<!-- 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> 

我用Google搜索了很多,但仍然沒有幫助我。有些地方因爲jar衝突而讀過它,但我無法找到它。

回答

0

確保你的Web.xml是正確的,特別是servlet 2.5的版本應該是2.5。 它應該像

<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是在這個非常嚴格。

+0

我們通常會錯過基本知識..謝謝 –

1

爲什麼在servlet的lib目錄中有javaee-api-5.jar?
不應該由您的應用程序服務器「提供」嗎? (即 - JBoss AS或Websphere)?
我認爲這是問題。

+0

它沒有幫助 –