Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Thread.currentThread().getContextClassLoader().getResourceAsStream() bug?

843802Jun 22 2010 — edited Sep 10 2010
Hello

I have a problem with Thread.currentThread().getContextClassLoader().getResourceAsStream() sporadically returning null when my app is running via JNLP using Win XP/build 1.6.0_20-b02 and tomcat 6-20/JnlpDownLoadServlet.

The code is:
final InputStream resourceStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
I have added a map that counts the number of non null streams returned by getResourceAsStream. Here is the output when running with tracing level 5:
cache: Reading Signers from 1024 http://x.x.x.x:8080/MDA/webstart/VTSDBClient-SOK.jar | C:\Users\xxx\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\61\6b90d63d-4feb6af0-1.7-SNAPSHOT-.idx
cache:  Read manifest for http://10.10.20.64:8080/MDA/webstart/VTSDBClient-SOK.jar: read=117 full=14269
...
cache: Reading Signers from 1024 http://x.x.x.x:8080/MDA/webstart/VTSDBClient-SOK.jar | C:\Users\xxx\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\61\6b90d63d-4feb6af0-1.7-SNAPSHOT-.idx
Weird! data/eez-de.shp has been loaded 77 time(s) previously but is now null
Loader is com.sun.jnlp.JNLPClassLoader
So getResourceAsStream managed to open the file 77 times before it suddenly returns null.

From the trace it looks like it happens when the cache is doing " Reading Signers from 1024 ..." the second time for VTSDBClient-SOK.jar. Could it be related to bug 6911763 (http://bugs.sun.com/view_bug.do?bug_id=6911763)?

What causes the cache to reread the Signers in general and is there a way to provoke it?

Thanks
Carsten
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2010
Added on Jun 22 2010
3 comments
2,087 views