Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Shade Plugin + MsSQL JDBC -> instant JNI error - Invalid signature file Manifest

My Maven shade plugin worked well until I started to use MsSQL JDBC

When I add MsSql to pom.xml and I want to run the app I get an error

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

Any suggestion how can I resolve it? However, the Main class is empty just a simple main method is there.

 <build>
        <plugins>            

          <!-- Maven Shade Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <!-- Run shade goal on package phase -->
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <!-- add Main-Class to manifest file -->
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>mdb.Main</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>    

        </plugins>
 </build>

 <dependencies>

        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>6.2.2.jre7</version>
        </dependency>                 

 </dependencies>

</project>
like image 348
user2287094 Avatar asked Oct 25 '25 15:10

user2287094


1 Answers

<configuration>                                                                 
                            <filters>

                            <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>

                        </filters>                            
</configuration>
like image 55
user2287094 Avatar answered Oct 27 '25 05:10

user2287094



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!