1

I am using eclipse 32bit in my office and developing a java code to parse JavaAST, but when I try to run the program at home I am getting a getting this exception. I am also providing where the Exception is occurred.

How can I Resolve this exception?

Exception Line

ASTParser parser = ASTParser.newParser(AST.JLS3);

Security Exception

Exception in thread "main" java.lang.SecurityException: class "org.eclipse.core.runtime.Plugin"'s signer information does not match signer information of other classes in the same package
    at java.lang.ClassLoader.checkCerts(ClassLoader.java:943)
    at java.lang.ClassLoader.preDefineClass(ClassLoader.java:657)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:785)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at org.eclipse.jdt.core.dom.ASTParser.initializeDefaults(ASTParser.java:235)
    at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:218)
    at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:118)
    at tester.runTest.main(runTest.java:33)
PiRocks
  • 1,708
  • 2
  • 18
  • 29
Sravan Kumar
  • 41
  • 2
  • 3
  • Did you recompile the classes at home or just drop in binary .class files? – Jim Garrison May 11 '12 at 05:24
  • Also, check [this](http://stackoverflow.com/q/2877262/520779) (possible duplicate) - found right after answering it myself (evidence my answer is probably correct, though other causes are also possible I think) – mgibsonbr May 11 '12 at 05:33

2 Answers2

1

Please refer to this page on Java documentation: Sealing Packages within a JAR File. That is the probable cause of the error you're seeing.

In short, when a jar file is sealed the JVM assumes every class from that jar's packages must be defined inside that jar. If there is some code in other parts of your project that belongs to the same package, it will treat is as a security exception.

Check if the code you're running at home is structured similarly to what you're running in the office. You might have some classes defined in regular .java files, accessible from your CLASSPATH, that belongs to the same package(s) defined in that jar file. Try removing any unnecessary dependencies from your project (so it looks as closely as possible to your working envirnment) and see if that solves your problem.

Edit: I might have mistaken signed for sealed; the relevant docs, then, is Signing and Verifying JAR Files. The probable cause and possible solution remains the same, though...

mgibsonbr
  • 21,755
  • 7
  • 70
  • 112
  • Thanks it was the duplication. I had two jars of same content. – Sravan Kumar May 11 '12 at 18:39
  • Anyway that was very useful information. Thanks. But now i wonder why my office system does not have that problem though it had the same repository for the dependencies. – Sravan Kumar May 11 '12 at 18:41
1

This error is caused by adding jars twice. If you add more than one jar which share some classes it will end in the error you are seeing now.

I suggest you try remove the concurrent jar and then test your code.

Hope this helps!

Jean Melo
  • 126
  • 2
  • 6