我们使用WebSphere作为servlet容器,当我将war文件部署到服务器时,键入http://localhost:9080/jwsProject/launch.jnlp
始终返回 DownloadResponse $ NotFoundResponse 。我们使用JNLPServlet重定向所有请求,jnlp-serlvet类抛出异常。
以下是战争档案布局:
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>