Reputation: 3432
I have tried suggestions in other threads but they don't help me.
When I run my jar by java -jar -BigJar.jar
I receive exception :
Exception in thread main java.lang.SecurityException: no manifest section for signature fil entry edu/iris/Pissures/IfSeismogramMgr/MotionVectorAttributeHelper.class
My ant file is
<project name="USGS VHP" default="help" basedir=".">
<description>USGS VHP Main Build File</description>
<property name="root" location="." />
<property name="classdir" value="classes" />
<property name="contrib" value="http://volcanoes.usgs.gov/software/contrib" />
<target name="help">
<echo>
Available targets:
help -- displays this help information
init --
clean -- deletes lib/*.jar files
touch -- touch *.java in source tree
contrib -- download the contrib library (use before building)
build -- build the USGS codebase (use after checkout *)
</echo>
</target>
<target name="init">
</target>
<target name="clean">
<delete>
<fileset dir="${root}/lib/" includes="*.jar" />
</delete>
</target>
<target name="touch">
<touch>
<fileset dir="${root}/../" includes="**/*.java" />
</touch>
</target>
<target name="contrib" depends="init" description="Download the contrib libraries">
<mkdir dir="${root}/contrib" />
<get src="${contrib}/colt.jar" dest="${root}/contrib/colt.jar" />
<get src="${contrib}/comm.jar" dest="${root}/contrib/comm.jar" />
<get src="${contrib}/commons-collections-3.2.1.jar" dest="${root}/contrib/commons-collections-3.2.1.jar" />
<get src="${contrib}/fissuresIDL-1.0.jar" dest="${root}/contrib/fissuresIDL-1.0.jar" />
<get src="${contrib}/fissuresImpl-1.1.13.jar" dest="${root}/contrib/fissuresImpl-1.1.13.jar" />
<get src="${contrib}/fissuresUtil-1.0.18.jar" dest="${root}/contrib/fissuresUtil-1.0.18.jar" />
<get src="${contrib}/forms-1.0.7.jar" dest="${root}/contrib/forms-1.0.7.jar" />
<get src="${contrib}/jai_codec.jar" dest="${root}/contrib/jai_codec.jar" />
<get src="${contrib}/jai_core.jar" dest="${root}/contrib/jai_core.jar" />
<get src="${contrib}/jnlp.jar" dest="${root}/contrib/jnlp.jar" />
<get src="${contrib}/JSAP-2.1.jar" dest="${root}/contrib/JSAP-2.1.jar" />
<get src="${contrib}/jtransforms-2.4.jar" dest="${root}/contrib/jtransforms-2.4.jar" />
<get src="${contrib}/log4j-1.2.13.jar" dest="${root}/contrib/log4j-1.2.13.jar" />
<get src="${contrib}/looks-2.0.4.jar" dest="${root}/contrib/looks-2.0.4.jar" />
<get src="${contrib}/mysql.jar" dest="${root}/contrib/mysql.jar" />
<get src="${contrib}/rrd4j-2.0.5.jar" dest="${root}/contrib/rrd4j-2.0.5.jar" />
<get src="${contrib}/JavaSeedLite.jar" dest="${root}/contrib/JavaSeedLite.jar" />
<get src="${contrib}/seedCodec-1.0.6.jar" dest="${root}/contrib/seedCodec-1.0.6.jar" />
<get src="${contrib}/servlet.jar" dest="${root}/contrib/servlet.jar" />
<get src="${contrib}/seisFile-1.5.2.jar" dest="${root}/contrib/seisFile-1.5.2.jar" />
<get src="${contrib}/slf4j-api-1.7.1.jar" dest="${root}/contrib/slf4j-api-1.7.1.jar" />
<get src="${contrib}/slf4j-log4j12-1.7.1.jar" dest="${root}/contrib/slf4j-log4j12-1.7.1.jar" />
<get src="${contrib}/javassist.jar" dest="${root}/contrib/javassist.jar" />
<get src="${contrib}/thymeleaf-2.0.13.jar" dest="${root}/contrib/thymeleaf-2.0.13.jar" />
<get src="${contrib}/ognl-2.6.7.jar" dest="${root}/contrib/ognl-2.6.7.jar" />
<get src="${contrib}/oscache-2.1-mod2.jar" dest="${root}/contrib/oscache-2.1-mod2.jar" />
<get src="${contrib}/seedlink_lite_1.2.1.jar" dest="${root}/contrib/" />
<get src="${contrib}/seedlink_lite_src_1.2.1.jar" dest="${root}/contrib/" />
<get src="http://repo1.maven.org/maven2/com/h2database/h2/1.3.173/h2-1.3.173.jar" dest="${root}/contrib/h2.jar" />
</target>
<target name="build" depends="init" description="Build USGS codebase">
<!-- Order is important. Some projects depend on others. -->
<ant target="jar" inheritAll="false" antfile="${root}/../Util/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Math/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Net/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Plot/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Pinnacle/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../VDX/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Valve3/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Earthworm/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Winston/build.xml" />
<ant target="jar" inheritAll="false" antfile="${root}/../Swarm/build.xml" />
</target>
<target name="jar" depends="build" description="Create one large jar file">
<jar destfile="${root}/lib/usgs.jar">
<fileset includes="**/**.class" dir="${root}/../Util/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Earthworm/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Math/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Net/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Pinnacle/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Plot/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Swarm/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Valve3/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../VDX/${classdir}" />
<fileset includes="**/**.class" dir="${root}/../Winston/${classdir}" />
</jar>
</target>
<manifest file="lib/MANIFEST.MF">
<attribute name="Main-Class" value="gov.usgs.swarm.Swarm" />
</manifest>
<jar destfile="SwarmMentics.jar" manifest="lib/MANIFEST.MF">
<zipgroupfileset dir="contrib" includes="*.jar" />
<zipgroupfileset dir="lib" includes="*.jar" />
<zipfileset src="contrib/colt.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/comm.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/commons-collections-3.2.1.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/commons-net-3.2.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/fissuresIDL-1.0.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/fissuresImpl-1.1.13.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/fissuresUtil-1.0.18.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/forms-1.0.7.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/h2.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/jai_codec.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/jai_core.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/JavaSeedLite.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/javassist.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/jgoodies-looks-2.5.3.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/jnlp.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/JSAP-2.1.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/jtransforms-2.4.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/log4j-1.2.13.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/looks-2.0.4.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/mysql.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/ognl-2.6.7.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/oscache-2.1-mod2.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/rrd4j-2.0.5.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/seedCodec-1.0.6.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/seedlink_lite_1.2.1.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/seedlink_lite_src_1.2.1.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/seisFile-1.5.2.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/servlet.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/slf4j-api-1.7.1.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/slf4j-log4j12-1.7.1.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="contrib/thymeleaf-2.0.13.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/earthworm.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/math.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/net.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/pinnacle.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/plot.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/swarm.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/usgs.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/util.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/valve.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/vdx.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
<zipfileset src="lib/winston.jar">
<exclude name="**/*.RSA, **/*.SF, **/*.DSA" />
<exclude name="META-INF/MANIFEST.MF"/>
</zipfileset>
</jar>
</project>
As you see I excluded RSA,SF and DSA files and MANIFEST.MF from each jar.
But it din't help me with that error.
If you know smth please reply.
Thank you!
Upvotes: 4
Views: 17289
Reputation: 671
Just delete the *.SF file in your imported signed jar (in meta_inf folder)
Upvotes: 0
Reputation: 173
It seems like you might be inlcuding the jars twice. First with the zipgroupfilesets and then again with a series of zipfilesets.
You could probably remove the zipgroupfilesets.
I believe there is also a problem in your excludes. You could change it to this:
<zipfileset src="contrib/fissuresUtil-1.0.18.jar">
<exclude name="**/*.RSA" />
<exclude name="**/*.SF" />
<exclude name="**/*.DSA" />
</zipfileset>
Or this:
<zipfileset src="contrib/fissuresUtil-1.0.18.jar" excludes="**/*.RSA,**/*.SF,**/*.DSA"/>
See http://ant.apache.org/manual/Types/fileset.html (zipfileset is a form of fileset) for more information on that.
On another note, something like this might simplify things a bit:
<jar destfile="SwarmMentics.jar" manifest="lib/MANIFEST.MF">
<restrict>
<not>
<or>
<name name="**/*.RSA"/>
<name name="**/*.SF"/>
<name name="**/*.DSA"/>
</or>
</not>
<archives>
<zips>
<fileset dir="contrib" includes="**/*.jar"/>
<fileset dir="lib" includes="**/*.jar"/>
</zips>
</archives>
</restrict>
</jar>
I adapted this from the example at http://ant.apache.org/manual/Tasks/jar.html under the "Merging archives" section.
Upvotes: 5
Reputation: 5247
This error message tells exactly why bundled jar is not recommended for production release. The problem is some of your dependency jar is signed with signature files. repack it may violate some security policy on the dependency jar.
To make it work, you need remove all signature files from the signed jar, before copying the unpacked files into your final build jar file.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>${project.artifactId}-${project.version}-uber</finalName>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
Upvotes: 10