0
votes

I need to modify org.eclipse.jdt.core.dom.ASTParser class which is in jdt.core jar file. So I created a java project and I created the same package (org.eclipse.jdt.core.dom). but when I want to create a new instance of this class I get this error:

Exception in thread "main" java.lang.SecurityException: class "org.eclipse.jdt.core.dom.ASTParser2"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(Unknown Source) at java.lang.ClassLoader.preDefineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at typeResolution.TypeResolution.main(TypeResolution.java:80)

When I run my code in a plugin mode project I don't have problem, but in a java stand alone project I am getting this error.

Can anyone give me insight into this problem? Thanks.

1
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example. - Gustavo Morales

1 Answers

0
votes

The original artifact org.eclipse.jdt.core_xyz.jar is signed. When you try to use that jar in combination with your own modified class the JVM will detect that the integrity of the signed jar is broken. You have two options:

  • instead of replacing just one file, replace the entire jar with your own version
  • re-package the original jar without signing

Depending on your configuration there may be more ripples, because other plug-ins like org.eclipse.jdt.compiler.tool contribute classes to packages that also exist in org.eclipse.jdt.core ("split packages"), which is OK only if both jars are signed by with the same certificate - or not signed at all.