Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JWS lazy download - loading classes dynamically must be done twice

 
el duente
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We're doing small JWS lazy download tests and we're facing a "strange" behaviour.
Our test project contains the following two main jars:
"main.jar" contains the main application. This dumb app only tries to dynamically load and instantiate the org.incontinences.test.jws.lazydld.dldedApplication.HelloWorldJwsLazyDld class:

Class dldedClass = Class.forName("org.incontinences.test.jws.lazydld.dldedApplication.HelloWorldJwsLazyDld"); Object helloWorldPanel = dldedClass.newInstance();

This org.incontinences.test.jws.lazydld.dldedApplication.HelloWorldJwsLazyDld class is contained in a second jar (lazyResources.jar - marked as to be lazily downloaded and associated to the "org.incontinences.test.jws.dldedApplication" package and subpackages).
There are also two empty jars to test the downloading order: "lazyResources2.jar" and "lazyResources3.jar". Don't bother.
Here is an extract of the associated .jnlp file:
<resources>
<j2se version="1.4+"/>
<!-- The main application -->
<jar href="main/main.jar" main="true"/>
<!-- Empty crap - for dld order test purpose -->
<jar href="lazylib2/lazyResources3.jar" part="status3" download="lazy"/>
<!-- Here is the jar containing the class to be loaded dynamically -->
<jar href="lazylib/lazyResources.jar" part="status" download="lazy">
<package name="org.incontinences.test.jws.dldedApplication.*" recursive="true" part="status"/>
</jar>
<!-- Empty crap - for dld order test purpose -->
<jar href="lazylib2/lazyResources2.jar" part="status2" download="lazy"/>
</resources>
The first time the "lazy" class is attempted to be dynamically loaded, a ClassNotFoundException is thrown. No jar is downloaded.
The second time, the jar contaning that class (and only this one - great! ) is downloaded and everything works fine.
Is this "ask twice" behaviour "normal"?
Have we made a mistake somewhere?
Btw, we use version 1.2 of JWS and 1.4.1 of the JRE under win2000.
regards, vinsil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic