Lazy applet JAR downloading using JNLP - Part II

Q

Qu0ll

I promised Andrew Thompson I would report back as to my progress getting
this to work and so here I am.

I can report that the progress has been good and also baffling. It is good
to the extent that I have been able to implement lazy JAR downloading for an
applet launched from JNLP using DownloadService in a way that works very
well but baffling in the sense that it only works on Windows and even then
only in some browsers.

The environments which work are:

Firefox 3.5.2 on Windows Vista
Firefox 3.0.13 on Windows Server 2003
IE 8 on Windows Vista
IE 8 on Windows Server 2003
Chrome 3.0.195.6 on Windows Vista

The environments that don't work are:

Opera 9.64 on Windows Vista
Safari 4.0.2 on Windows Vista
Firefox 3.0.11 on Solaris x86 10
Firefox 3.0.13 on Ubuntu 8.10

In all cases where the applet is failing, the exception I am getting is
this:

java.lang.NoClassDefFoundError: javax/jnlp/DownloadServiceListener
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
javax.jnlp.DownloadServiceListener
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 10 more

I get a similar ClassNotFoundException for
javax/jnlp/UnavailableServiceException if I try to use this exception class
to detect if the DownloadService is available.

So, how can this be when all environments are using the exact same version
of Java (6u16)? It appears that in some browsers on some operating systems
the JNLP services are not fully implemented or not available at all. Now, I
have a suspicion that browsers like Opera still use the old "Plugin1"
functionality instead of the new "Plugin2" functionality even though a
recent JRE is in place and I believe that launching an applet using JNLP is
only supported in Plugin2. This would explain the results for Opera and
perhaps Safari but doesn't really explain the results for Firefox on Solaris
and Ubuntu as Firefox 3.x on Windows has supported JNLP launching for some
time.

Does anyone have any thoughts, ideas or suggestions on this?

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
A

Andrew Thompson

java.lang.NoClassDefFoundError: javax/jnlp/DownloadServiceListener

That is a definite sign that the plugin2 is
not available for that JRE/browser combo.

There are two approaches you might take.

1) Do like I did in the GIFanim, applet.
<http://pscode.org/gifanim/#applet>
It uses the JNLP services to access the local
file system, it also offers a free-floating
JNLP launch, and it cannot function without
the JNLP services. So in the applet form, I
(hot-link) to Sun's own 'need to upgrade'
applet (CompatibilityApplet.jar), and reference
the applet JNLP via the jnlp_href param. At the
moment on Ubuntu using FF 3.0.13, and Java
1.6.0_10 (32 bit), I see the CompatibilityApplet,
and indeed, have not yet been able to check
the applet form of my GIF animater.

2) With using *just* lazy downloads, it is potentially
easier to supply the applet to both types of
user. Instead of putting the CompatibilityApplet
in the applet element, use the 'standard' form
of the applet that downloads aggressively, but
provide the jnlp form for those with more modern
'plugin2' JREs.

As an aside, why exactly are you using the DS,
or what are you downloading with it? For classes,
I could not see it as being necessary short of
using things like the SPI.

(I still intend finishing that post I was making
to thread 1, I must get back to it sometime..)

It would be nice if Sun provided more information on
which versions of what Java under which OS the 'plugin2'
functionality is supposed to work. At the moment it
is very hit and miss.
 
Q

Qu0ll

Hi Andrew,
That is a definite sign that the plugin2 is
not available for that JRE/browser combo.

Yes, that's what it seems.
There are two approaches you might take.

1) Do like I did in the GIFanim, applet.
<http://pscode.org/gifanim/#applet>
It uses the JNLP services to access the local
file system, it also offers a free-floating
JNLP launch, and it cannot function without
the JNLP services. So in the applet form, I
(hot-link) to Sun's own 'need to upgrade'
applet (CompatibilityApplet.jar), and reference
the applet JNLP via the jnlp_href param. At the
moment on Ubuntu using FF 3.0.13, and Java
1.6.0_10 (32 bit), I see the CompatibilityApplet,
and indeed, have not yet been able to check
the applet form of my GIF animater.
Right.

2) With using *just* lazy downloads, it is potentially
easier to supply the applet to both types of
user. Instead of putting the CompatibilityApplet
in the applet element, use the 'standard' form
of the applet that downloads aggressively, but
provide the jnlp form for those with more modern
'plugin2' JREs.

My applet needs Plugin2 for a number of reasons including use of a few
different JNLP services (not just DownloadService).
As an aside, why exactly are you using the DS,
or what are you downloading with it? For classes,
I could not see it as being necessary short of
using things like the SPI.

At the moment I am downloading JOGL lazily as not every user of the applet
will interact with it in such a way that JOGL will be required. I also
prefer to have downloading of all applet JARs under my control instead of
the default Java logo with progress bar. I use my own branded animated GIF
to start with as the first (tiny) applet JAR is loaded and then present my
own branded progress bar screen while the other JARs load.
It would be nice if Sun provided more information on
which versions of what Java under which OS the 'plugin2'
functionality is supposed to work. At the moment it
is very hit and miss.

I agree. In fact I really need to get to the bottom of this as, as I said,
my applet definitely requires Plugin2.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
R

Roedy Green

I agree. In fact I really need to get to the bottom of this as, as I said,
my applet definitely requires Plugin2.

Use Wassup to dump the System properties.
http://mindprod.com/applet/wassup.html

Any dll you need must live on:

java.library.path = F:\Program Files\Opera 10
Beta;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;E:\Program
Files\jet6.5-pro\bin;E:\Program
Files\Java\jdk1.6.0_16\bin;E:\env;E:\sys\;F:\Program
Files\jpsoft\tcmd10;F:\Program Files\vslick\win;F:\Program
Files\apache-ant-1.7.1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;E:\com\mindprod\reorg;F:\Program
Files\TortoiseSVN\bin;F:\program files\asm;F:\Program Files\Microsoft
Visual Studio 9.0\VC\bin;C:\Program
Files\QuickTime\QTSystem\;F:\Program Files\SlikSvn\bin\;F:\Program
Files\Vslick\win
--
Roedy Green Canadian Mind Products
http://mindprod.com

"If you think it’s expensive to hire a professional to do the job, wait until you hire an amateur."
~ Red Adair (born: 1915-06-18 died: 2004-08-07 at age: 89)
 
S

Steve Sobol

In all cases where the applet is failing, the exception I am getting is
this:


Check the Java control panel and make sure you're using the right JVM.
At least on Windows, you can select which JVM is used for applets and
which JVM is used for Web Start, if you have more than one JVM
installed.
 
Q

Qu0ll

Steve Sobol said:
Check the Java control panel and make sure you're using the right JVM.
At least on Windows, you can select which JVM is used for applets and
which JVM is used for Web Start, if you have more than one JVM
installed.

Unfortunately there's only one JVM/JRE installed on all the machines in
question.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
(e-mail address removed)
[Replace the "SixFour" with numbers to email me]
 
R

Roedy Green

Check the Java control panel and make sure you're using the right JVM.
At least on Windows, you can select which JVM is used for applets and
which JVM is used for Web Start, if you have more than one JVM
installed.

on top of this, you can list your preferred JVMS is order in the JNLP.

You might want to dump out some system properties to the console to
help track what you ended up with.

see http://mindprod.com/applet/wassup.html
 
R

Roedy Green

Unfortunately there's only one JVM/JRE installed on all the machines in
question.

Actually, that is good fortune. Multiple JVMs greatly add to the
confusion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top