我们使用 WebSphere 作为我们的 servlet 容器,当我将 war 文件部署到服务器中时,键入http://localhost:9080/jwsProject/launch.jnlp
总是返回DownloadResponse$NotFoundResponse。我们使用 JNLPServlet 重定向所有请求,异常由 jnlp-serlvet 类抛出。
以下是战争文件布局:
- 索引.html
- 应用程序.jar
- 启动.jnlp
- 网络信息
- 库
- web.xml
launch.jnlp 有:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" codebase="$$codebase" href="launch.jnlp">
<information>
...
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.2+"/>
<jar href="application.jar" version="1.0" main="true" download="eager"/>
<jar href="WEB-INF/lib/jnlp-servlet.jar"/>
<jar href="WEB-INF/lib/jnlp.jar"/>
</resources>
<application-desc main-class="test.maintest.java">
<argument...</argument>
</application-desc>
web.xml 有:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>JnlpDownloadServlet</servlet-name>
<servlet-class>com.sun.javaws.servlet.JnlpDownloadServlet</servlet-class>
<init-param>
<param-name> logLevel </param-name>
<param-value> DEBUG </param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JnlpDownloadServlet</servlet-name>
<url-pattern>*.jnlp</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>jnlp</extension>
<mime-type>application/x-java-jnlp-file</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jar</extension>
<mime-type>application/java-archive</mime-type>
</mime-mapping>
</web-app>