在将JAX RS应用程序部署到Websphere 8.5时,Servlet映射未发现错误



我是web服务的新手。已经使用Eclipse在java中开发了一个简单的rest web svc,Tomcat遵循此链接。应用程序在Tomcat上成功运行,但当我将其部署到IBM WebSphere 8.5.5时。它成功部署,但未能启动。我知道我的Web.xml有一些问题,所以我添加它进行更正。尝试过,但没有成功。

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>wstest</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>Java WS</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>


<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>book</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Java WS</servlet-name>
<url-pattern>/*</url-pattern>


</servlet-mapping>
</web-app> 

当我尝试启动应用程序时生成的Web Sphere日志是:-

0000112c ApplicationMg A   WSVR0204I: Application: TestWS_war  Application build level: Unknown
0000112c webapp        E com.ibm.ws.wswebcontainer.webapp.WebAppConfigurationHelper 
constructServletMappings SRVE0303E: Servlet name for the servlet mapping /* could not be found.
0000112c DeployedAppli W   WSVR0206E: Module, TestWS.war, of application, TestWS_war.ear/deployments/TestWS_war, 
failed to start
0000112c ApplicationMg W   WSVR0101W: An error occurred starting, TestWS_war
0000112c ApplicationMg A   WSVR0217I: Stopping application: TestWS_war
0000112c ApplicationMg A   WSVR0220I: Application stopped: TestWS_war
0000112c CompositionUn E   WSVR0194E: Composition unit WebSphere:cuname=TestWS_war in BLA 
WebSphere:blaname=TestWS_war failed to start.
0000112c MBeanHelper   E   Could not invoke an operation on object: 
WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=svrNode01,
version=8.5.5.0,type=ApplicationManager,mbeanIdentifier=ApplicationManager,
cell=svrNode01Cell,spec=1.0 
because of an mbean exception: com.ibm.ws.exception.RuntimeWarning: 
SRVE0303E: Servlet name for the servlet mapping /* could not be found.

我已经尝试了两个类加载选项Parent First和Parent Last,但都没有用。

它给出的错误是"org.glassfish.jersy.servlet.ServletContainer";类路径中缺少。因此应用程序没有启动。

看到与WAS 8.5.5兼容的Jersey版本了吗?(我想是Jersey 1.x(。需要使用相应的库。

<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

最新更新