Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » what is the solution to java.lang.SecurityException?
what is the solution to java.lang.SecurityException? [message #911036] Mon, 10 September 2012 21:20 Go to next message
b x is currently offline b xFriend
Messages: 16
Registered: February 2012
Junior Member
I runned ant in eclipse, and there is an exception:
Exception in thread "main" java.lang.SecurityException: class "org.eclipse.jdt.core.JDTCompilerAdapter"'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 org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1387)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1064)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.tools.ant.util.ClasspathUtils.newInstance(ClasspathUtils.java:249)
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.resolveClassName(CompilerAdapterFactory.java:194)
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:155)
at org.apache.tools.ant.taskdefs.Javac.findSupportedFileExtensions(Javac.java:979)
at org.apache.tools.ant.taskdefs.Javac.scanDir(Javac.java:956)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:927)

how to handle this exception?
Re: what is the solution to java.lang.SecurityException? [message #911526 is a reply to message #911036] Tue, 11 September 2012 20:01 Go to previous messageGo to next message
b x is currently offline b xFriend
Messages: 16
Registered: February 2012
Junior Member
I found two solutions: re-sign the jar files or remove the manifest information, but I don't know how to do it.
Re: what is the solution to java.lang.SecurityException? [message #912573 is a reply to message #911526] Thu, 13 September 2012 19:41 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1166
Registered: July 2009
Senior Member
The exception seems to say that you are using a jdtCompilerAdapter.jar whose signature does not match of the jar containing the Eclipse Java Compiler.

In order to advise further we'd need to now which exact file versions of both you are using.

When installing the JDT the jdtCompilerAdapter.jar comes as a nested jar within the plugin org.eclipse.jdt.core_xxx.jar, the latter containing also the compiler. So either we'd need the version of this plugin or information where else you obtained the jars from.

Stephan
Re: what is the solution to java.lang.SecurityException? [message #912989 is a reply to message #912573] Fri, 14 September 2012 14:49 Go to previous messageGo to next message
b x is currently offline b xFriend
Messages: 16
Registered: February 2012
Junior Member
the version is org.eclipse.jdt.core_3.8.1.v20120531-0637.jar
Re: what is the solution to java.lang.SecurityException? [message #916226 is a reply to message #911036] Tue, 18 September 2012 18:58 Go to previous messageGo to next message
b x is currently offline b xFriend
Messages: 16
Registered: February 2012
Junior Member
here are the jar files I used in hte project:
ant.jar
ant-launcher.jar
jdtCompilerAdapter.jar
org.eclipse.ant.ui.source_3.5.300.v20120523-1752.jar
org.eclipse.core.contenttype_3.4.200.v20120523-2004.jar
org.eclipse.core.jobs_3.5.200.v20120521-2346.jar
org.eclipse.core.resources_3.8.0.v20120522-2034.jar
org.eclipse.core.runtime_3.8.0.v20120521-2346.jar
org.eclipse.equinox.common_3.6.100.v20120522-1841.jar
org.eclipse.equinox.preferences_3.5.0.v20120522-1841.jar
org.eclipse.jdt.compiler.tool_1.0.101.v20120522-1651.jar
org.eclipse.jdt.core_3.8.1.v20120531-0637.jar
org.eclipse.jdt.debug.ui_3.6.100.v20120530-1425.jar
org.eclipse.jface.text_3.8.0.v20120531-0600.jar
org.eclipse.jface_3.8.0.v20120521-2329.jar
org.eclipse.osgi_3.8.0.v20120529-1548.jar
org.eclipse.text_3.5.200.v20120523-1310.jar

jdtCompilerAdapter.jar is from org.eclipse.jdt.core_3.8.1.v20120531-0637.jar
ant.jar and ant-launcher.jar are from apache-ant-1.8.4-bin.zip
Re: what is the solution to java.lang.SecurityException? [message #916299 is a reply to message #916226] Tue, 18 September 2012 21:33 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1166
Registered: July 2009
Senior Member
All those versions look OK.

Meanwhile I learned that org.eclipse.jdt.core_3.8.1.v20120531-0637.jar is signed but the nested jdtCompilerAdapter.jar is not signed.

So, if you are running ant with checking of certificates enabled it will see some classes are signed and others are not, and since both jars share some packages this triggers the exception.

So why is this affecting you and not actually everybody using ecj via ant? Is certificate checking normally enabled when running ant?

In my ant installation none of the jars in ant/lib/ are signed. So I guess ant normally runs without this verification?

Stephan
Re: what is the solution to java.lang.SecurityException? [message #916306 is a reply to message #916299] Tue, 18 September 2012 21:45 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1166
Registered: July 2009
Senior Member
Here's a relevant comment from a bug [1]:
Quote:
We decided that Ant, for example, is never invoked with runtime signature verification enabled, so signing JARs that only appear on ant classpaths wasn't needed.


hm?


[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=263298#c1
Re: what is the solution to java.lang.SecurityException? [message #1699004 is a reply to message #911036] Fri, 19 June 2015 12:25 Go to previous messageGo to next message
Andres Colubri is currently offline Andres ColubriFriend
Messages: 3
Registered: June 2015
Junior Member
Hello there,

I'm running into a similar problem as the original poster. I'm using org.apache.tools.ant.Project to run a build script programmatically, where I set the JDT compiler adapter as my build.compiler property. Then I get the same "java.lang.SecurityException: class "org.eclipse.jdt.core.JDTCompilerAdapter"'s signer information does not match signer information of other classes in the same package" error. I use the jars from Eclipse 4.4.1.

As discussed in the thread so far, the problem originates from the fact that jdtCompilerAdapter.jar, nested inside org.eclipse.jdt.core.jar, is not signed while the latter is.

I tried adding/removing different options from the build script, but with no luck so far. Any comments or suggestions? I can post the relevant parts of the build script if that helps understanding what's going on.

@Stephan when you ask "Is certificate checking normally enabled when running ant?" did you mean that there is way to tell ant to not check certificates? I went through the org.apache.tools.ant.Project javadoc, but haven't found any method do do so.

Thanks!
Re: what is the solution to java.lang.SecurityException? [message #1699127 is a reply to message #1699004] Sun, 21 June 2015 19:48 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1166
Registered: July 2009
Senior Member
Some more things you may want to try:

- don't use org.eclipse.jdt.core for ant but download the dedicated batch compiler file ecj-VERSION.jar, which conveniently brings compiler plus ant adapter in a single jar

or if that doesn't help:
- remove the signatures from org.eclipse.jdt.core (I believe this can be done by removing META-INF/ECLIPSE_.* from the jar).

HTH,
Stephan
Re: what is the solution to java.lang.SecurityException? [message #1699129 is a reply to message #1699127] Sun, 21 June 2015 21:19 Go to previous messageGo to next message
Andres Colubri is currently offline Andres ColubriFriend
Messages: 3
Registered: June 2015
Junior Member
Hi Stephan, thanks so much for your reply!

We tried the second approach (removing signatures) and it works, however we would rather use a solution that does not involve modifying the jars. The ecj-VERSION.jar file doesn't seem to be included with the downloads any longer, for R4.41 the files are http://download.eclipse.org/eclipse/updates/4.4/R-4.4.1-201409250400/plugins/?d, and there is no file with ecj in its name.

Should I look somewhere else to download the corresponding ecj jar?

Andres

[Updated on: Sun, 21 June 2015 21:20]

Report message to a moderator

Re: what is the solution to java.lang.SecurityException? [message #1699131 is a reply to message #1699129] Sun, 21 June 2015 21:42 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1166
Registered: July 2009
Senior Member
Quote:
Should I look somewhere else to download the corresponding ecj jar?


See http://download.eclipse.org/eclipse/downloads/drops4/R-4.4.2-201502041700/#JDTCORE
Re: what is the solution to java.lang.SecurityException? [message #1699217 is a reply to message #1699131] Mon, 22 June 2015 16:24 Go to previous message
Andres Colubri is currently offline Andres ColubriFriend
Messages: 3
Registered: June 2015
Junior Member
That's really helpful, thanks!
Andres
Previous Topic:Debugging run configuration
Next Topic:m2eclipse seems to ignore my user settings.xml
Goto Forum:
  


Current Time: Wed Sep 02 10:37:28 GMT 2015

Powered by FUDForum. Page generated in 0.16374 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software