Skip to main content

Busted Java 1.6 Webstart?

3 replies [Last post]
aaronhughes
Offline
Joined: 2006-08-20

Hello peoples,

We seem to be having a 'weird' issue with the latest Java 1.6 build and our companies webstart application. We realise that 1.6 is still in beta stages but its good to stay ontop of these things.

Basically the applications works fine in 1.4 and 1.5 however if you try running the application in any version of 1.6 it falls over without much explanation.

We've come across 2 major issues so far with 1.6 and our webstart app, one we have been able to work around and the other is currently proving hard to debug.

The first bug we have noticed is that Java 1.6 doesn't like signed JAR files which don't include files outside of the META-INF directory. This problem was easily solved but creating a dummy file in the root of the JAR file and signing it accordingly. Bit of a crazy new feature.

The next issue we have encountered (and this is our problem) relates to opening URL connections from our app. It seems that in 1.6 a simple application can be written to access URLs over the web and can be executed via webstart with no problems however when this exact same code is inserted into our application (into a code location which has no problems in accessing the web in 1.4 or 1.5) java seems to fall over and throw some wobbly exceptions. Im not too sure if anyones experienced anything similar but if anyone has any suggestions on a code fix from our end or suggesting a requirement for 1.6 it would be greatly appreciated. I suspect theres an issue with Java 1.6 somewhere but wouldn't have at a guess as to where.

The suspect code we are having problems with looks like this...

URL url = new URL("jar:http://localhost:8080/webapp.jar!/webapp.war");
URLConnection connection = url.openConnection();
BufferedInputStream bufferedInputStream = new BufferedInputStream((InputStream) connection.getContent());
bufferedInputStream.read();
bufferedInputStream.close();

as I mentioned when this same code is run stand-alone in 1.6 webstart it works without problems. This problem only occurs when the code is inserted into the app in 1.6 and it works fine in 1.4 and 1.5.

And for those still reading the exception looks something like

java.io.IOException: Stream closed
at java.io.BufferedInputStream.getInIfOpen(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at au.com.zurich.jnlp.server.JettyServer.startServer(JettyServer.java:244)
at au.com.zurich.jnlp.server.JettyServer.applyPatchesAndStartServer(JettyServer.java:130)
at au.com.zurich.jnlp.server.JettyServer.start(JettyServer.java:97)
at au.com.zurich.jnlp.server.SingleInstanceJnlpJettyServer.runServer(SingleInstanceJnlpJettyServer.java:127)
at au.com.zurich.jnlp.server.SingleInstanceJnlpJettyServer.start(SingleInstanceJnlpJettyServer.java:90)
at au.com.zurich.jnlp.server.SingleInstanceJnlpJettyServer.main(SingleInstanceJnlpJettyServer.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

with line 244 being the bufferedInputStream.read(); line.

Any questions, suggestions etc. all welcome.

Aaron

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aaronhughes
Offline
Joined: 2006-08-20

Hey Alan,

It seems I was wrong to guess that these 2 bugs were the same. It turns out that b97 still does not work correctly with even with the above mentioned bug fixed.

One of the guys in the office has managed to figure out a hack for this bug however and it seems that if the URL is referenced in the following way (with a trailing slash) the url will work.

URL url = new URL("jar:http://localhost:8080/webapp.jar!/webapp.war/");

Onto the next phase of the test however it seems that Jetty 5.1.5 has problems loading some of the compiled JSPs from the war when in 1.4 and 1.5 this is once again not a problem.

Still trying to get some more info on the problem to post...

Aaron

aaronhughes
Offline
Joined: 2006-08-20

Incase anyone was going to reply to this message...

The answer is yes something is busted in Java 1.6 and its acutally the JarURLConnection class which is the reason this problem is occuring.

Incase anyone else is having this same problem check out http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6449504 to see the status of this bug.

Aaron

alanb
Offline
Joined: 2005-08-08

I checked 6449504 and it has been fixed for b97 - it appears the fix for 6212146 in b77 caused this regression.