Free Support Forum - aspose.com

Security Exception Thrown when using ASPOSE for Java in Jar

Hello,

I am getting following exception
java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:330)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:263)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:318)
at java.util.jar.JarVerifier.update(JarVerifier.java:230)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
at java.util.jar.JarFile.getInputStream(JarFile.java:450)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(URLClassPath.java:977)
at sun.misc.Resource.cachedInputStream(Resource.java:77)
at sun.misc.Resource.getByteBuffer(Resource.java:160)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:454)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main”

when trying to Convert Word file to PDF in my Signed Jar.

Please Advice.

@Abdulkadir,

Thanks for your inquiry. Please ZIP and upload your input Word document you are getting this problem with here for testing. We will investigate the issue on our end and provide you more information.

When i am Debugging the App it Works fine without any issues with all different files, but when i am exporting my java app as executable jar then i am not able to convert and getting this Exception i mentioned.

Also please note that i am using the Trial library.

@Abdulkadir,

This does not seem to be an issue with Aspose.Words. Can you please remove Aspose.Words JAR reference from your project and related code? After that export Java app as executable JAR and see how it goes?

@awais.hafeez
My Java App running fine when i am Exporting it without Aspose.Words.

@Abdulkadir,

I am afraid, the root cause of this problem is unclear to us. Aspose.Words’ JAR contains META-INF\Manifest.mf file. The file contains signatures of all files included in the JAR. The error may be emitted if you changed/modified some of the files (original signature became invalid).

Please remove old JAR of Aspose.Words for Java from your application and then do a fresh installation of latest version of Aspose.Words for Java via Maven. This should resolve this issue on your end.

Installing Aspose.Words for Java from Maven Repository

Do you pack or repack Aspose.Words for Java’s JAR somehow for production?

Hi

We are using jdk version jdk1.8.0_151, code we are writing using intelij to create our jar.

As per instruction, we have removed old jar files and downloaded new files from provide link https://docs.aspose.com/display/wordsjava/Installation.
but giving security exception…
Could you please send us demo project using your lib and working that libs after generating jar?

Awaiting for your reply.

@Abdulkadir,

Please see attached project that references latest version of Aspose.Words for Java from here.

JavaConsoleApp.zip (8.2 KB)

Hello @awais.hafeez,

When trying to exporting jar and run this JavaConsoleApp.zip project throwing me following Error.

no main manifest attribute, in C:\Users\Game\Desktop\jars\Java console\out\artifacts\JavaConsoleApp_jar\JavaConsoleApp.jar

NOTE :- Also tried adding main class in MANIFEST.MF file.

@Abdulkadir,

This does not seem to be an issue with Aspose.Words for Java. Please Google this problem. For example, check this thread if it helps: