Java安全异常BIRT和Apache POI Hack
我得到一份工作Java安全异常BIRT和Apache POI Hack,java,apache-poi,birt,manifest.mf,Java,Apache Poi,Birt,Manifest.mf,我得到一份工作 java.lang.SecurityException: class "org.apache.poi.POIXMLDocument"'s signer information does not match signer information of other classes in the same package 在BIRT核心jar和Apache POI jar之间 在bug报告中已经指出,这可以通过升级BIRT来修复,但是当我这样做时,我遇到了另一个运行时bug,这只能通
java.lang.SecurityException: class "org.apache.poi.POIXMLDocument"'s signer information does not match signer information of other classes in the same package
在BIRT核心jar和Apache POI jar之间
在bug报告中已经指出,这可以通过升级BIRT来修复,但是当我这样做时,我遇到了另一个运行时bug,这只能通过降级来解决。因此,就目前而言,我在这里有点困难。说我应该能够解压ApachePOI jar,删除安全信息(BIRT清单中没有),然后重新压缩它,我应该可以继续,但是当我删除安全信息时,我使用ApachePOI的代码不再编译,就好像poi依赖不再存在一样(是的,它在类路径上)。此外,我还收到aspectj weaver抛出的异常
下面是META-INF/MANIFEST.MF:
前(节略,剪贴)
之后(未桥接,完整文件):
如你所见,我删除了所有的安全信息。一路上我做错什么了吗?这是解决我问题的有效方法吗?
我不得不删除META-INF中的一些文件,并且重新压缩文件夹并将其重命名为jar是不够的,我需要使用以下命令实际创建jar:
jar cvf org.apache.poi_3.9.0.v201303080712.jar .
为了继续进行自动化操作,应执行以下操作:
<macrodef name="unsignjar">
<attribute name="jarfile"
description="The jar file to unsign" />
<sequential>
<!-- Editing the manifest file -->
<copy toFile="@{jarFile}_MANIFEST.tmp">
<resources>
<zipentry zipfile="@{jarFile}" name="META-INF/MANIFEST.MF"/>
</resources>
</copy>
<replaceregexp file="@{jarFile}_MANIFEST.tmp" match="\nName:(.+?)\nSH" replace="SH" flags="gis" byline="false"/>
<replaceregexp file="@{jarFile}_MANIFEST.tmp" match="SHA(.*)" replace="" flags="gis" byline="false"/>
<jar update="yes"
jarfile="@{jarFile}.tmp"
manifest="@{jarFile}_MANIFEST.tmp">
<zipfileset src="@{jarFile}">
<include name="**"/>
<!-- Clearing the META-INF directory -->
<exclude name="META-INF/*.SF"/>
<exclude name="META-INF/*.DSA"/>
<exclude name="META-INF/*.RSA"/>
</zipfileset>
</jar>
<delete file="@{jarFile}_MANIFEST.tmp" />
<move file="@{jarFile}.tmp"
tofile="@{jarFile}"
overwrite="true" />
</sequential>
</macrodef>
对于位于WEB-INF/lib文件夹(${webapp.libs}key)中的特定Jar文件,它在ANT任务中以以下方式调用:
<target name="unsignJar">
<unsignjar jarFile="${webapp.libs}/org.apache.poi_3.9.0.v201303080712.jar" />
</target>
<macrodef name="unsignjar">
<attribute name="jarfile"
description="The jar file to unsign" />
<sequential>
<!-- Editing the manifest file -->
<copy toFile="@{jarFile}_MANIFEST.tmp">
<resources>
<zipentry zipfile="@{jarFile}" name="META-INF/MANIFEST.MF"/>
</resources>
</copy>
<replaceregexp file="@{jarFile}_MANIFEST.tmp" match="\nName:(.+?)\nSH" replace="SH" flags="gis" byline="false"/>
<replaceregexp file="@{jarFile}_MANIFEST.tmp" match="SHA(.*)" replace="" flags="gis" byline="false"/>
<jar update="yes"
jarfile="@{jarFile}.tmp"
manifest="@{jarFile}_MANIFEST.tmp">
<zipfileset src="@{jarFile}">
<include name="**"/>
<!-- Clearing the META-INF directory -->
<exclude name="META-INF/*.SF"/>
<exclude name="META-INF/*.DSA"/>
<exclude name="META-INF/*.RSA"/>
</zipfileset>
</jar>
<delete file="@{jarFile}_MANIFEST.tmp" />
<move file="@{jarFile}.tmp"
tofile="@{jarFile}"
overwrite="true" />
</sequential>
</macrodef>
<target name="unsignJar">
<unsignjar jarFile="${webapp.libs}/org.apache.poi_3.9.0.v201303080712.jar" />
</target>