0

I have been tearing my hair out with this error. I am using Maven to get the dependencies for a project where I believe it is the org.eclipse.paho.client.mqttv3 which has the ECLIPSE.RSA and ECLIPSE.SF signature files in the maven pull.

I am using IntelliJ community edition 2016.2 and Build Artificats to try to get a single executable JAR for use on a PI (as you may have guessed from com.pi4j lib).

The error I am getting is:

Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

I have tried the links I have found to no avail but it is most likely my lack of understanding here and here.

POM.XML:

   <groupId>piGroup</groupId>
    <artifactId>Pi4JTrigger</artifactId>
    <version>1.0-SNAPSHOT</version>

    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <filters>
                    <filter>
                        <artifact>org.bouncycastle:*</artifact>
                        <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                        </excludes>
                    </filter>
                </filters>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>com.futuredecisions.parkingpi</mainClass>
                    </transformer>
                </transformers>
                <shadedArtifactAttached>true</shadedArtifactAttached>
            </configuration>
        </execution>
    </executions>

    <repositories>
        <repository>
            <id>Eclipse Paho Repo</id>
            <url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.pi4j</groupId>
            <artifactId>pi4j-core</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.paho</groupId>
            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
            <version>1.0.2</version>
        </dependency>
    </dependencies>
</project>

Please if you know how to solve this assume im a 4 year old. As 1 I have no hair left from pulling it out and 2, why would you ever create a an automated cool way to manage dependencies and then go and make it impossible to use in any kind of friendly way ?

DevilCode
  • 1,054
  • 3
  • 35
  • 61
  • Added - No luck. – DevilCode Jun 14 '18 at 23:58
  • Possible duplicate of [Valid JAR signature for JavaFX projects](https://stackoverflow.com/questions/25842559/valid-jar-signature-for-javafx-projects) – workaholic Jun 15 '18 at 00:45
  • Did you read the accepted answer to the question that you linked to from your question? "It's probably best to keep the official jar as is and just add it as a dependency in the manifest file for your application jar file." – Erwin Bolwidt Jun 15 '18 at 01:14
  • If you can't do that, and you go for the second answer with more upvotes, note that is says `*:*` (and you changed that to only mention bouncycastle) - it may not be (just) bouncycastle that is giving you problems; exclude the signature file from *all* dependent jars. – Erwin Bolwidt Jun 15 '18 at 01:17

0 Answers0