This discussion is archived
6 Replies Latest reply: Jun 14, 2012 12:48 PM by 943740 RSS

JWS jar ordering

943740 Newbie
Currently Being Moderated
Since JDK 6, java web start does not preserve anymore the jar ordering in the JNLP file (as listed here http://bugs.sun.com/view_bug.do;jsessionid=a82d2bf7ba9c5acfcb8a6630c8?bug_id=6561417)

I would like to understand how the JWS loads/reads the jnlp file?

Can anyone explain or point to some direction?

Thanks
Julio
  • 1. Re: JWS jar ordering
    817264 Journeyer
    Currently Being Moderated
    JNLP does not provide you a way to define class path. It provides you a way to define what will be available to your application.

    Fact that application jars are added to the class path is implementation detail.
    E.g. in JDK8 application will be modularized and there will be no explicit class path notion unless it is compatibility mode.

    If your web application depends on overloading resources provided by other jar it is fragile design.

    As for loading generally speaking following is happened:
    a) set of resources needed to run application is built from JNLP files
    b) these resources are partitioned into groups based on priority - progress jars, regular eager jars, lazy jars
    c) progress jars are loaded concurrently
    d) regular jars are loaded concurrently (up to 5 jars at the same time i believe)
    e) all jars are added to classpath. Current rule is to add progress jars first, then regular jars, then lazy jars (and this is current implementation details too).
    The idea is that jars that are needed earlier should go in front to avoid pause in application trying to load class that is available
    (as classpath lookups are sequential attempt to lookup in the not yet loaded class will block until jar is loaded)

    In reality it is a bit more complicated as signed and unsigned resources are loaded by different class loaders and this also has impact of effective jar lookup order.
  • 2. Re: JWS jar ordering
    943740 Newbie
    Currently Being Moderated
    Igor, assuming all my jars are signed, whats the impact on jar lookup order?

    Also, if you allow me to ask :) How does you know about this? is there a doc?

    Thanks
    Julio
  • 3. Re: JWS jar ordering
    817264 Journeyer
    Currently Being Moderated
    Igor, assuming all my jars are signed, whats the impact on jar lookup order?
    Best will be do not make assumptions about order.
    JNLP specification does not define it and it is up to implementors.

    Why order is important to you?
  • 4. Re: JWS jar ordering
    943740 Newbie
    Currently Being Moderated
    The application I have is a Swing Application deployed via JWS.

    I need to guarantee that a library is loaded first than the others library. Thats it.

    Thanks
    Julio
  • 5. Re: JWS jar ordering
    817264 Journeyer
    Currently Being Moderated
    I need to guarantee that a library is loaded first than the others library. Thats it.
    Could you clarify what do yo mean here?
    Do you have class or resource with same name defined in two jar files?

    If there is no overlap in resource names then how jar lookup order impacts loading order?
  • 6. Re: JWS jar ordering
    943740 Newbie
    Currently Being Moderated
    igor wrote:
    Do you have class or resource with same name defined in two jar files?
    Exactly.

    Julio

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points