• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jar File and java.lang.SecurityException.

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I have written mail application using Java Mail API. I have packaged my classes , mail.jar and other depended libraries into a JAR file. When I am running this using java -jar Main.class it is giving following exception.
Exception in thread "main" java.lang.SecurityException: no manifiest section for signature file entry javax/mail/search/SearchTerm.class
at sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:262)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:174)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:241)
at java.util.jar.JarVerifier.update(JarVerifier.java:197)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:248)
at java.util.jar.JarFile.getInputStream(JarFile.java:310)
at sun.misc.URLClassPath$4.getInputStream(URLClassPath.java:537)
at sun.misc.Resource.getBytes(Resource.java:60)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:245)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
When I am removing all depended libraries from JAR file and included those classpath ,it is giving execption that libraries not found.
Thanks in adv.
Sonu
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The mail.jar file contains signature files to sign the jar.
When you extract it to combine it with your classes, remove the files: SUN_MICR.RSA and SUN_MICR.SF from the META-INF folder.
If you use an automated tool to create the combined jar, such as JBuilder, you will need to manually remove these files after the combined jar is created.
From the jar's folder:
mkdir temp
cd temp
jar -xvf ../jarfile.jar
rm META-INF/SUN_MICR.*
jar cvf ../jarfile.jar *
cd ..
rm temp -rf
(replace rm with dos command as needed)
(I just ran into the same problem. A little bit late to help you...but...)
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But it wasn't too late to help me. Thanks.

Btw, if you have WinRar you can just go into the jar and delete the files through the interface. If you are creating an native executable under jbuilder you need to compile the regular archive first, modify it, then build the native executable.

Thanks for the tip!
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
Had this same problem and solved it. I'm using JBuilder. I prefer to build single jars for an application which contain all the required classes so that I don't have problems with upgrades and new versions etc and don't have to worry about what be effected and what won't.

When setting up the result jar file for the application, the javamail package must be included in the jar with all classes and resources included. This is because it makes use of dynamic class loading to setup the mail providers.

However the java activation packages must be included using only known classes and resources. Telling Jbuilder to include these packages with all classes causes the signature files to be built as well.

Hope this helps.
Derek
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to the forum and I need some help with a similar problem. I am using the jce1_2_1.jar file as part of my build. In windows it works fine and am able to use it in my programs.

But when I try to run the build on my unix box, the build fails and says

" no manifiest section for signature file entry com/sun/crypto/provider/SunJCE_m.class"

Can anyone please help me with this, I tried to remove the 4jcefram.dsa and 4jcefram.sf file from the META-INF folder and ran again. But it does not solve the problem.

Please help.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much.
I changed the JAR making in JBuilder to include only the dependencies not all causing to not calling the signing and it worked.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Lovell wrote:The mail.jar file contains signature files to sign the jar.
When you extract it to combine it with your classes, remove the files: SUN_MICR.RSA and SUN_MICR.SF from the META-INF folder.
If you use an automated tool to create the combined jar, such as JBuilder, you will need to manually remove these files after the combined jar is created.
From the jar's folder:
mkdir temp
cd temp
jar -xvf ../jarfile.jar
rm META-INF/SUN_MICR.*
jar cvf ../jarfile.jar *
cd ..
rm temp -rf
(replace rm with dos command as needed)
(I just ran into the same problem. A little bit late to help you...but...)



Thanks.
Your workaround helped me get rid of the securityexception.
However, I would appreciate if someone could explain how this solution cures the problem.
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Lovell wrote:The mail.jar file contains signature files to sign the jar.
When you extract it to combine it with your classes, remove the files: SUN_MICR.RSA and SUN_MICR.SF from the META-INF folder.
(...)


i did that but still get the same error message
anyone can help me please?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic