Closed barbeau closed 9 years ago
Here's the problem/solution: https://bugs.eclipse.org/bugs/show_bug.cgi?id=371954
There is an issue with javax.servlet-2.5.0.v201103041518.jar packaging on which jetty-7.6.1.v20120215 depends: in the META-INF directory of the javax.servlet jar are found files ECLIPSEF.RSA and ECLIPSEF.SF.
If you generate a jar with maven that uses jetty, you get those 2 files in the META-INF directory of the final jar, and if you run it you get an Exception:
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
The fix is to exclude the 2 offending files from the generated jars.
The unwanted files can be excluded with the maven-shade-plugin adding to a POM:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.4</version> <executions> <execution> <goals> <goal>shade</goal> </goals> <configuration> <filters> <filter> <artifact>org.eclipse.jetty.orbit:javax.servlet</artifact> <excludes> <exclude>META-INF/ECLIPSEF.RSA</exclude> <exclude>META-INF/ECLIPSEF.SF</exclude> <exclude>META-INF/eclipse.inf</exclude> </excludes> </filter> </filters> </configuration> </execution> </executions> </plugin>
What if we generate .jar with the gradle ?
@gitexperience are you still seeing this error with the latest version? It should be fixed in https://github.com/OneBusAway/onebusaway-gtfs-realtime-from-nextbus-cli/commit/c6a82d028bcc08c1f1716dcbc0bc1ea88088d625.
I'm generating the jar file from gradle and seeing the same issue. Did anyone find a resolution?
@rawadrifai Not sure about Gradle - I'm assuming you'd need to do the equivalent in terms of filtering items out of the JAR as show in https://github.com/OneBusAway/onebusaway-gtfs-realtime-from-nextbus-cli/commit/c6a82d028bcc08c1f1716dcbc0bc1ea88088d625 for Maven.
@barbeau I actually just found a solution. All I needed to do is exclude some files in my jar task:
jar { // other stuff
exclude('META-INF/*.SF')
exclude('META-INF/*.DSA')
exclude('META-INF/*.RSA')
}
@rawadrifai Great, thanks for sharing! Also - would you be willing to contribute your Gradle build files for this project via a pull request? Apparently you're not the only one that wants to use Gradle to build this project.
I would love to.. but I was actually not building this project. I was searching for a resolution for the issue packaging jar files and not being able to run them later because of signature issues. And I came across this :)
Ah, gotcha. Thanks.
I'm currently seeing this when trying to run the project:
Also reported on the oba-dev list: https://groups.google.com/forum/#!topic/onebusaway-developers/jSPGZvnfsFk