Community
Participate
Working Groups
When running a java application from Eclipse with Debug or Run, then code requesting a Cipher object through Cipher.getInstance will fail. This only happens if the JRE used is not configured (Window, Preferences, Java, Installed JREs, ${jre}, Edit) to "Use default system libraries ". Example code to produce the error: --- public static void main(String[] args) { Cipher cp; try { cp=Cipher.getInstance("DES/ECB/NoPadding", "SunJCE"); cp=Cipher.getInstance("DES/ECB/NoPadding"); System.out.println("JCE OK"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchProviderException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { e.printStackTrace(); } } --- With "Use default system libraries" it works without problems. With default configuration for JRE and "Use default system libraries" switched off, it produces following stack dump: --- Exception in thread "main" java.lang.SecurityException: JCE cannot authenticate the provider SunJCE at javax.crypto.Cipher.getInstance(DashoA12275) at javax.crypto.Cipher.getInstance(DashoA12275) at TestCaseJCE.main(TestCaseJCE.java:22) Caused by: java.util.jar.JarException: Class is on the bootclasspath at javax.crypto.SunJCE_d.a(DashoA12275) at javax.crypto.SunJCE_b.b(DashoA12275) at javax.crypto.SunJCE_b.a(DashoA12275) ... 3 more --- As far as I have discovered this is caused by JRE default setting, placing all jar files from lib/ext directory into bootclasspath when "Use default system libraries" is switched off. This includes the SUN JCE provider "sunjce_provider.jar". Obviously the verification of the JCE provider fails if it is located in bootclasspath. The problem can be easily solved by removing sunjce_provider.jar from list of JRE jar files. Then again the above code runs without problems. In my opinion the default settings when importing a JRE into Eclipse should be changed not to include sunjce_provider.jar. One may argue that switching off "Use default system libraries" is typically not the case, but if source code is attached to one of the JRE jar files (including the lib/ext files), then this is done automatically by Eclipse. PS: I have discovered the problem running Windows XP on PC platform. Anyway I expect the problem to be platform and OS independent. I may have assigned the problem to the wrong component, please correct this if there is a better component fitting this problem.
Verified that changing a source attachment on a system lib does cause the bootpath to be specified explcitly on the launch commad line. Chaing a source attachment or javadoc location should not require the boot path to be specified by the launcher - only a change in libs or ordering of them.
Fixed in JRERuntimeClasspathEntryResolver and AbstractJavaLaunchConfigurationDelegate. When comparing the default libaries to the user specified libraries, the comparison only considers the archive locations (ignores source attachment, javadoc, etc). At runtime, only the binaries matter.
Please verify, Luc.
Very related bug Bug 95898
*** Bug 95898 has been marked as a duplicate of this bug. ***
Verified.
Hi guys, can someone explain/verify that this bug is fixed in Eclipse 3.1 final with Sun JDK 1.5.0_04? Could there have been a regression? I still get the error when trying to establish a connection to an SSL Endpoint via Apache Axis Client code from my JUnit Test cases. When I activate "Use default system libraries" in the JRE properties, it works, when I deactivate it, and add JDK's src.zip, I get the error. When I run the JUnit Testcase from the command line against the same JDK (with the same set of options) everything works fine... Scratching my head, waiting for enlightenment, Flexx
I cannot reproduce the problem with the test case from this bug report. It is possible there's still a problem when launching a JUnit test case (it's not the same code). Please file an new bug report, with a simple test case if possible.
*** Bug 46510 has been marked as a duplicate of this bug. ***