4 Replies Latest reply: May 7, 2012 7:48 PM by EJP RSS

    Applet deployment issues...

      Hi all,

      I'm deploying an applet and having trouble doing so... The applet runs straight off the file system when opening the html file containing it with a browser (IE, and others: Firefox, Chrome, Safari).

      The deployment server is a Windows 2003 R2 server with JDK 1.5 running Apache 2.0.63 and Tomcat 5.5. We setup SSL on Apache with a self signed certificate because we are also issuing certificates for clients to install in their browsers when accessing our app (website).

      So I started with Oracle's recommendation:

           <script src="http://www.java.com/js/deployJava.js"></script>
                var attributes = { id:'wireFrame3DApplet',
                     code:'WireFrame3D.class', width:1000, height:1000} ;
                var parameters = {jnlp_href: 'WireFrame3D-applet.jnlp'} ;
                var version = '1.4' ;
                deployJava.runApplet(attributes, parameters, version);

      with the jnlp file:

           <?xml version="1.0" encoding="UTF-8"?>
           <!-- href attribute contains relative path;
           codebase attribute not specified -->
           <jnlp href="WireFrame3D-applet.jnlp">
                     <vendor>Tramontane, Inc.</vendor>
                     <!-- Application Resources -->
                     <j2se version="1.4+" />
                     <jar href="./wireframe3d.jar" main="true" />
                     <param name="model" value="getDataString()"/>
                     <param name="scale" value="1.0"/>
                     <param name="alwaysOnGroupCsv" value="Background,BoundingCube,NorthArrow,MaximumDepth,ScaleRuler,ScaleUnit"/>
                     <param name="defaultOffGroupCsv" value="Label_Ages,Label_API"/>
                     <param name="quoteChar" value="'"/>
                     <!-- cannot contain parenthesis in callback name -->
                     <param name="jsAppletItemStateChangedCallback" value="appletMenuSelectionCallback"/>
                     <param name="jsAppletReadyCallback" value="appletReadyCallback"/>
                <update check="background"/>

      This works great, cross browsers and all, only when I access the Tomcat (8080) directly within the firewall. When I access it outside the firewall (apache port 443), the browser Java plugin complains about cannot find and load the class.

      Next, I've looked at thread <applet> tag vs. <object> tag which essentially say we have to have different tags (applet, embed, object) for different browsers. So I modified the code and now I have:

                <script language="Javascript">

                var _app = navigator.appName;
                var _agent = navigator.userAgent;

                if (_app == 'Microsoft Internet Explorer') {
                     // works!
                     '<applet code="WireFrame3D.class" name="wireFrame3DApplet" width="1000" height="1000" align="center"> \
                          <param name="model" value="getDataString()"> \
                          <param name="scale" value="1.0"> \
                } else {
                     // works when connected with VPN (accessing thru port 8080)
                     '<embed code="WireFrame3D.class" type="application/x-java-applet;version=1.4" name="wireFrame3DApplet" width="1000" height="1000" align="center" \
                          model="getDataString()" \
                          scale="1.0" \
                     '<object type="application/x-java-applet" id="wireFrame3DApplet" width="1000" height="1000" align="center"> \
                          <param name="code" value="WireFrame3D.class" /> \
                          <param name="scriptable" value="true" /> \
                          <param name="mayscript" value="true" /> \
                          <param name="model" value="getDataString()" /> \
                          <param name="scale" value="1.0" /> \


      Long story short, the only thing that works both inside/outside the firewall is the APPLET tag with IE8/9 (ironic...). Other browsers just won't work with all APPLET/EMBED/OBJECT tags. Strangely all the tags works within the firewall directly through port 8080 but when accessing through Apache port 443, they all complained about can't find the applet class.

      Does anyone has any ideas?

        • 1. Re: Applet deployment issues...
          I do not see how using different html tags may impact this.

          Start with making sure java is set to use same proxy as your browser in the Java Control Panel.
          Then enable full trace details for additional clues (http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html#gcexdf)
          and use Wireshark to intercept network traffic and see if it does through proxy.

          Also check your firewall allow connections with java user agent string.

          Please post traces/logs/config info here if above does not help.
          • 2. Re: Applet deployment issues...

            Thanks for your tips... I've been debugging the entire day now... I think it has something to do with the client authentication causing java not being able to load the class from https. I've imported all of the certificates into the java plugin (3 certs inserted, did not ask for any password) and checked off the option to use the browser certificate store (because I don't want to mess around with JSS for now)... Upon connection, the java plugin popup a dialog asking for "Enter a password to access your personal keystore:", hit ENTER, OK, Cancel, X (close the dialog), all won't work (results in not finding the applet class).

            After digging all over the web, it was asking the password for the keystore file:

            "C:\Documents and Settings\ekyu\Application Data\Sun\Java\Deployment\security\trusted.clientcerts"

            Using the following command:

            C:\Program Files\Java\jre6\bin>keytool.exe -list -keystore "C:\Documents and Settings\ekyu\Application Data\Sun\Java\Deployment\security\trusted.clientcerts"

            It did not ask for any password and I can see the certificate I have inserted. The problem is this keystore does not have a password but the plugin dialog insists on getting a password. So what do I do to satisfy the password dialog and continue so that I can proceed to select the client certificate to make connection to get the applet class?

            • 3. Re: Applet deployment issues...
              After messing around for a while, I've updated to the latest JRE but the problem still persists with the password dialog... So, I've another laptop that allows me to copy the trusted keystores and replace it on the problematic laptop and everything works!

              • 4. Re: Applet deployment issues...
                You don't need a password when opening a truststore.

                You need a password when opening a keystore.

                You can specify it via -Djavax.net.ssl.keyStorePassword.