Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2192412 | 5.0u25 | Sean Coffey | P3 | Closed | Fixed | b02 |
JDK-2217456 | 1.4.2_37 | Vikram Aroskar | P2 | Closed | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b57)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b57, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Starting an application with an extension (in this case bcprov from bouncycastle.org, need to be an extension as it's a jce provider and therefore differently signed), the following exception happens
...[removed unnecessary parts]
Caused by: java.security.NoSuchAlgorithmException: No such algorithm: RSA
an javax.crypto.Cipher.getInstance(DashoA14*..)
an javax.crypto.Cipher.getInstance(DashoA14*..)
an de.ipcon.db.ClientCryptoHandler.init(CryptoManager.nrx:413)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: RSA, provider: BC, class: org.bouncycastle.jce.provider.JCERSACipher$NoPadding)
an java.security.Provider$Service.newInstance(Unknown Source)
Caused by: java.lang.IllegalStateException: zip file closed
an java.util.zip.ZipFile.ensureOpen(Unknown Source)
an java.util.zip.ZipFile.getEntry(Unknown Source)
an java.util.jar.JarFile.getEntry(Unknown Source)
an com.sun.deploy.cache.CachedJarFile.getEntry(Unknown Source)
an java.util.jar.JarFile.getJarEntry(Unknown Source)
an sun.misc.URLClassPath$JarLoader.getResource(Unknown Source)
an sun.misc.URLClassPath.getResource(Unknown Source)
an java.net.URLClassLoader$1.run(Unknown Source)
an java.security.AccessController.doPrivileged(Native Method)
an java.net.URLClassLoader.findClass(Unknown Source)
an com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
an java.lang.ClassLoader.loadClass(Unknown Source)
an java.lang.ClassLoader.loadClass(Unknown Source)
an java.security.Provider$Service.getImplClass(Unknown Source)
For me this looks like the classloader erranously closes the zip file stream, and the loading of the specific entry fails.
This does not happen in identical setup in jdk1.4 or jdk1.5, tested in both windows and linux platforms.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Download the 1.30 release of the JCE provider from bouncycastle.org.
Write an enclosing bcprov.jnlp, e.g:
<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="$myurl" href="bcprov.jnlp">
<information>
<title>Bouncy Castle Security Provider</title>
<vendor>The Legion of the Bouncy Castle</vendor>
<homepage href="$myurl/index.html"/>
<description kind="short">The Legion of the Bouncy Castle Security Provider</description>
<offline-allowed/>
</information>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.4.1+" initial-heap-size="32m" max-heap-size="192m"/>
<jar href="bcprov.jar"/>
</resources>
<component-desc name="BouncyCastleJCE"/>
<security>
<all-permissions/>
</security>
</jnlp>
Put both of these on the web server and replace $myurl with an actual url to the file on the web server.
Create another jnlp file, e.g.
<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="$myurl" href="test.jnlp">
<information>
<title>test app for bcprov</title>
<vendor>IPCON Informationssysteme oHG</vendor>
<homepage href="$myurl/index.html"/>
<description kind="short">test</description>
<icon href="is.gif"/>
<shortcut online="true">
<desktop/>
<menu submenu="test"/>
</shortcut>
</information>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.4.1+" initial-heap-size="32m" max-heap-size="$maxheap"/>
<jar main="true" href="test.jar"/>
<!-- JCE Security Provider ist von Sun signiert -->
<extension href="bcprov.jnlp"/>
</resources>
<application-desc main-class="testbcprov">
<argument>socket://$request.getServerName()$compress$!tls</argument>
</application-desc>
<security>
<all-permissions/>
</security>
</jnlp>
Now compile a class like this:
import java.security.Security;
import javax.crypto.Cipher;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
class testbcprov {
public static void main(String[] args) {
Security.addProvider(new BouncyCastleProvider());
try {
Cipher eCipher=Cipher.getInstance("RSA","BC");
} catch (java.security.GeneralSecurityException se) {
se.printStackTrace();
}
}
}
[There might be the one or other exception thrown, this is written from my head now...]
Compile it, place it into test.jar, sign that one, copy all together on the web server and see what happens.
As soon, as the provider tries to access some other class files on its own, it fails due to the already closed cached bcprov.jar.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No errors...
ACTUAL -
The above mentions exception occurs.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
See stacktrace above.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Please see step-by-step, there's more stuff needed than just source code.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use extensions (?!) in Java Web Start.
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b57)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b57, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Starting an application with an extension (in this case bcprov from bouncycastle.org, need to be an extension as it's a jce provider and therefore differently signed), the following exception happens
...[removed unnecessary parts]
Caused by: java.security.NoSuchAlgorithmException: No such algorithm: RSA
an javax.crypto.Cipher.getInstance(DashoA14*..)
an javax.crypto.Cipher.getInstance(DashoA14*..)
an de.ipcon.db.ClientCryptoHandler.init(CryptoManager.nrx:413)
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: RSA, provider: BC, class: org.bouncycastle.jce.provider.JCERSACipher$NoPadding)
an java.security.Provider$Service.newInstance(Unknown Source)
Caused by: java.lang.IllegalStateException: zip file closed
an java.util.zip.ZipFile.ensureOpen(Unknown Source)
an java.util.zip.ZipFile.getEntry(Unknown Source)
an java.util.jar.JarFile.getEntry(Unknown Source)
an com.sun.deploy.cache.CachedJarFile.getEntry(Unknown Source)
an java.util.jar.JarFile.getJarEntry(Unknown Source)
an sun.misc.URLClassPath$JarLoader.getResource(Unknown Source)
an sun.misc.URLClassPath.getResource(Unknown Source)
an java.net.URLClassLoader$1.run(Unknown Source)
an java.security.AccessController.doPrivileged(Native Method)
an java.net.URLClassLoader.findClass(Unknown Source)
an com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
an java.lang.ClassLoader.loadClass(Unknown Source)
an java.lang.ClassLoader.loadClass(Unknown Source)
an java.security.Provider$Service.getImplClass(Unknown Source)
For me this looks like the classloader erranously closes the zip file stream, and the loading of the specific entry fails.
This does not happen in identical setup in jdk1.4 or jdk1.5, tested in both windows and linux platforms.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Download the 1.30 release of the JCE provider from bouncycastle.org.
Write an enclosing bcprov.jnlp, e.g:
<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="$myurl" href="bcprov.jnlp">
<information>
<title>Bouncy Castle Security Provider</title>
<vendor>The Legion of the Bouncy Castle</vendor>
<homepage href="$myurl/index.html"/>
<description kind="short">The Legion of the Bouncy Castle Security Provider</description>
<offline-allowed/>
</information>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.4.1+" initial-heap-size="32m" max-heap-size="192m"/>
<jar href="bcprov.jar"/>
</resources>
<component-desc name="BouncyCastleJCE"/>
<security>
<all-permissions/>
</security>
</jnlp>
Put both of these on the web server and replace $myurl with an actual url to the file on the web server.
Create another jnlp file, e.g.
<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="$myurl" href="test.jnlp">
<information>
<title>test app for bcprov</title>
<vendor>IPCON Informationssysteme oHG</vendor>
<homepage href="$myurl/index.html"/>
<description kind="short">test</description>
<icon href="is.gif"/>
<shortcut online="true">
<desktop/>
<menu submenu="test"/>
</shortcut>
</information>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.4.1+" initial-heap-size="32m" max-heap-size="$maxheap"/>
<jar main="true" href="test.jar"/>
<!-- JCE Security Provider ist von Sun signiert -->
<extension href="bcprov.jnlp"/>
</resources>
<application-desc main-class="testbcprov">
<argument>socket://$request.getServerName()$compress$!tls</argument>
</application-desc>
<security>
<all-permissions/>
</security>
</jnlp>
Now compile a class like this:
import java.security.Security;
import javax.crypto.Cipher;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
class testbcprov {
public static void main(String[] args) {
Security.addProvider(new BouncyCastleProvider());
try {
Cipher eCipher=Cipher.getInstance("RSA","BC");
} catch (java.security.GeneralSecurityException se) {
se.printStackTrace();
}
}
}
[There might be the one or other exception thrown, this is written from my head now...]
Compile it, place it into test.jar, sign that one, copy all together on the web server and see what happens.
As soon, as the provider tries to access some other class files on its own, it fails due to the already closed cached bcprov.jar.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No errors...
ACTUAL -
The above mentions exception occurs.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
See stacktrace above.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Please see step-by-step, there's more stuff needed than just source code.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Don't use extensions (?!) in Java Web Start.
- backported by
-
JDK-2217456 Classloader is unable to load classes from extension jars (premature close)
- Closed
-
JDK-2192412 Classloader is unable to load classes from extension jars (premature close)
- Closed
- relates to
-
JDK-6953922 JNLP application can't find and load resource (txt file) from its application jar file
- Closed