Topper Harley
Topper Harley

Reputation: 12374

Java WS won't start the application until other running javaws dead instances are killed

I'm developing applications using Java and deploying them using Java Web Start. I'm developing with Mac OS and testing under Windows XP and 7.
I'm getting a strange issue, only on 7 as it seems.

The javaws.exe process somehow fails, and I cannot start the application again. Every time I click on the desktop icon my JNLP has created, it spawns another javaws.exe process but nothing happens, my code won't run, not even the first line of the public static void main program entry point.

I tried to launch it from command-line, but I don't get any log or any error message that could help me fix this.
I tried to launch another JNLP, it worked like a charm!

Killing all the javaws.exe running instances fixes the issue, but I can not expect my customers to do that.

So it means that somehow I am having an issue with my application which makes java fail.
I just ran into this: the app was launched, I clicked the red cross to close it, and opened it again (I changed the server side jars and jnlp files). It didn't open and I couldn't open it again until I killed all javaws.exe instances.

Here's some details:

Here's the Java console contents, which popped up when I ran the JNLP mentioned above:

Java Web Start 10.9.2.05
Using JRE version 1.7.0_09-b05 Java HotSpot(TM) Client VM
User home directory = C:\Users\Bicou
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
m:   print memory usage
o:   trigger logging
p:   reload proxy configuration
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
0-5: set trace level to <n>
----------------------------------------------------
    Match: beginTraversal
Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
    platform is: 1.7
    product is: 1.7.0_09
    location is: http://java.sun.com/products/autodl/j2se
    path is: C:\Program Files (x86)\Java\jre7\bin\javaw.exe
    args is: null
    native platform is: Windows, x86 [ x86, 32bit ]
    JavaFX runtime is: JavaFX 2.2.3 found at C:\Program Files (x86)\Java\jre7\
    enabled is: true
    registered is: true
    system is: true

    Match: ignoring maxHeap: -1
    Match: ignoring InitHeap: -1
    Match: digesting vmargs: null
    Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
    Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
    Match: digest LaunchDesc: http://docs.oracle.com/javase/tutorialJWS/deployment/webstart/ex6/webstart_ComponentArch_DynamicTreeDemo/dynamictree-webstart.jnlp
    Match: digest properties: []
    Match: JVM args: [JVMParameters: isSecure: true, args: ]
    Match: endTraversal ..
    Match: JVM args final: 
    Match: Running JREInfo Version    match: 1.7.0.09 == 1.7.0.09
     Match: Running JVM args match: have:<>  satisfy want:<>

My JNLP:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
    codebase="http://my.url/"
    href="UpCab.jnlp">
    <information>
        <title>UpCab</title>
        <vendor>Benoit Duffez</vendor>
        <homepage href="http://my.url/" />
        <description>Logiciel de gestion de cabinet</description>
        <icon href="icon.png" kind="shortcut" />
        <icon href="splash.png" kind="splash" />
        <offline-allowed />
        <shortcut online="true" install="true">
            <desktop />
        </shortcut>
    </information>

    <security>
        <all-permissions />
    </security>

    <resources>
        <jar href="opencsv-2.3.jar" />
        <jar href="iText-2.1.7.jar" />
        <jar href="iTextRTF.jar" />
        <jar href="sqlite-jdbc-3.7.2.jar" />
        <jar href="commons-logging-1.1.1.jar" />
        <jar href="httpclient-4.2.jar" />
        <jar href="upcab.jar" />
        <jar href="httpcore-4.2.jar" />
        <jar href="jna.jar" />
        <jar href="platform.jar" />
    </resources>

    <resources os="Windows" arch="x86">
        <j2se version="1.6+" />
        <jar href="swt-win32-x86.jar" />
    </resources>

    <resources os="Windows" arch="x86_64">
        <j2se version="1.6+" />
        <jar href="swt-win32-x86_64.jar" />
    </resources>

    <resources os="Windows" arch="amd64">
        <j2se version="1.6+" />
        <jar href="swt-win32-x86_64.jar" />
    </resources>

    <resources os="Mac" arch="x86_64">
        <j2se version="1.6+" java-vm-args="-XstartOnFirstThread" />
        <nativelib href="swt-mac-x86_64.jar" />
    </resources>

    <application-desc main-class="my.full.pkg.Main" />
</jnlp>

Upvotes: 3

Views: 3672

Answers (1)

Aksel Willgert
Aksel Willgert

Reputation: 11537

A crashed JavaWebStart application that has started the SingleInstanceService might leave the SingleInstanceService running, that will keep picking up any subsequent attempts to launch the same application again. Adding a log-message to the Listener is recomended. Note, the log-message would show in the console of the first application, and not the one just being launched.

private class SingleInstance implements SingleInstanceListener {
    @Override
    public void newActivation(final String[] params) {
        logger.info("newActivation params=" + params);

        ... activation code here ...

    }
}

Make sure to stop all running threads and remove registered SingleInstanceListeners if the application crashes.

SingleInstanceService sis = (SingleInstanceService) ServiceManager.lookup("javax.jnlp.SingleInstanceService");
sis.removeSingleInstanceListener(mySingleInstanceListener);

Upvotes: 2

Related Questions