【发布时间】:2011-06-08 14:02:41
【问题描述】:
我正在尝试使用 WAR 文件将 Web 服务部署到 WebSphere 上,我被直接告知这是完全可能的,并且之前已经做过很多次。 WebSphere 允许我上传文件、指定上下文根,甚至启动应用程序。但是,当我尝试通过指定我的基础 URI 来访问它时,WebSphere 404s 在我身上。显示的比较没用的错误信息是:
Error 404: SRVE0202E: Servlet [Jersey REST Service]: com.sun.jersey.spi.container.servlet.ServletContainer was found, but is corrupt: SRVE0227I: 1. Check that the class resides in the proper package directory. SRVE0228I: 2. Check that the classname has been defined in the server using the proper case and fully qualified package. SRVE0229I: 3. Check that the class was transferred to the filesystem using a binary transfer mode. SRVE0230I: 4. Check that the class was compiled using the proper case (as defined in the class definition). SRVE0231E: 5. Check that the class file was not renamed after it was compiled.
我检查了我的命名约定,根据this 博客文章修改了我的 web.xml,尝试了packaging it into an ear file(当我尝试上传它时抛出了它自己的错误),并试图找出哪些配置我可能有错。关于我可以改变什么来完成这项工作的任何想法?
编辑
这是我的 web.xml 文件的相关部分:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
id="WebAppId"
xmlns="http://java.sun.com/xml/ns/j2ee"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemalocation="http://java.sun.com/xml/ns/j2ee @987654323@_2_4.xsd">
<display-name>MYPROJECT'SDISPLAYNAME</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>MYPROJECTNAME</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
另一个编辑
我使用的是 Jersey 的最新版本——这是问题的一部分吗?
又一次编辑
我很确定这就是整个问题。 WebSphere 6.1 运行 jdk1.5,Jersey 在 Jersey 1.2 之后停止支持它......
【问题讨论】:
-
可以分享war文件的结构和配置文件吗?
-
@Kamahire 我已经从 Eclipse 中导出了它,所以我不确定包含的所有内容,但是我的类根据输入的 URI 调用不同的方法(即 root/foo/bar 会调用MethodA,root/foo/bar/party 将调用 MethodB)。我将添加要包含的 web.xml 文件的相关 sn-p。
标签: java eclipse websphere jersey war