[英]java.util.zip.ZipException: Not in GZIP format exception when launching java web start app with jnlp
I am launching java web start app with jnlp. 我正在使用jnlp启动Java Web Start应用程序。 The jnlp is generated dynamically using jsp.
jnlp是使用jsp动态生成的。 I have set jnlp.packEnabled to true in jnlp file.
我在jnlp文件中将jnlp.packEnabled设置为true。 All the jars are repacked, signed and packed with java's pack200.
所有的罐子都用Java的pack200重新包装,签名和包装。 using below ant script.
使用以下蚂蚁脚本。
<echo message="Repacking jars" />
<apply executable="pack200" parallel="false">
<arg value="--repack" />
<fileset dir="${build.dir}" includes="*.jar" />
</apply>
<echo message="Signing jars" />
<signjar destdir="${build.dir}" keyPass="test" keyStore="${project.root}/testKeys" storePass="test" alias="t">
<fileset dir="${build.dir}" includes="*.jar" />
</signjar>
<echo message="Pack Signed jars" />
<apply executable="pack200" parallel="false" dest="${build.dir}">
<arg value="--modification-time=latest"/>
<arg value="--deflate-hint=true"/>
<arg value="--segment-limit=-1"/>
<fileset dir="${build.dir}" includes="*.jar" />
<targetfile />
<srcfile />
<mapper type="glob" from="*" to="*.pack.gz" />
</apply>
java.util.zip.ZipException: Not in GZIP format
at java.util.zip.GZIPInputStream.readHeader(Unknown Source)
at java.util.zip.GZIPInputStream.<init>(Unknown Source)
at java.util.zip.GZIPInputStream.<init>(Unknown Source)
at com.sun.deploy.net.HttpDownloadHelper.download(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.downloadResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.deploy.cache.ResourceProviderImpl.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
on web start application launch its giving aboveerror. 在网络启动应用程序上启动其给与错误。 Please suggest how to solve this error.
请提出如何解决此错误的建议。 And when i try to view *.pack.gz file with WINRAR, i could see only one file with .pack extension,i cant open it with WINRAR says it is a damaged file.
当我尝试用WINRAR查看* .pack.gz文件时,我只能看到一个扩展名为.pack的文件,我无法用WINRAR打开它说它是已损坏的文件。
EDIT 1 :File is not damaged. 编辑1 :文件未损坏。 I am able unpack it manually using unpack200 and run from command prompt without any issues.
我可以使用unpack200对其进行手动解压缩,并从命令提示符下运行而没有任何问题。 Exception is shown only when the file is downloaded from jnlp.
仅当从jnlp下载文件时才会显示异常。 I doubt the dynamic generation of jnlp from jsp is causing the issue.
我怀疑从jsp动态生成jnlp会导致此问题。 Below is my jsp code.
下面是我的jsp代码。 Could you please suggest me a solution to get rid of this exception when unpacking from dynamically generated jnlp file .
从动态生成的jnlp文件解压缩时,请为我提供解决该异常的解决方案 。
<%@ page contentType="application/x-java-jnlp-file" language="java"%>
<%@page session="false" %>
<%
response.setContentType("application/x-java-jnlp-file");%>
<!-- JNLP File -->
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+">
<information>
<title>Service</title>
<vendor>Service</vendor> </information>
<security> <all-permissions /> </security>
<resources>
<jfx:javafx-runtime version="2.2.4+"
href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp" />
</resources>
<resources>
<!-- Application Resources -->
<property name="jnlp.packEnabled" value="true"/>
<j2se version="1.7+" />
<jar href="Test.jar" main="true"/>
</resources>
<application-desc
name="main" main-class="com.test.Main" width="300"
height="300">
<argument><%= request.getParameter("userId")%></argument>
<argument><%= request.getParameter("userName")%></argument>
</application-desc>
<update check="always" policy="always" />
</jnlp>
I suggest you try tool unpack200
(it's in the JDK) to see if your .pack.gz is correct. 我建议您尝试使用工具
unpack200
(在JDK中)来查看您的.pack.gz是否正确。 If not, it might be a hardware issue. 如果没有,则可能是硬件问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.