Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4301064

Name Resolution problem with Java PlugIn

XMLWordPrintable

    • 005
    • generic, x86
    • generic, windows_nt
    • Verified

        This problem occurs when constructing a URL and/or when passing the URL to
        the showDocument method of AppletContext, when there is no DNS or WINS
        available in the network.

        Here's how to reproduce this bug:

        This bug requires that you have two web servers. Let's call them ONE and
        TWO. The idea is to use ONE as the primary server and TWO as the secondary
        server. There are two applets involved. One is named showDocBugApplet and
        should be available on server ONE. The other is named showDocBugSubApplet
        and should be available on server TWO. The first applet uses showDocument
        to invoke the second applet from server TWO. You will need to modify the
        source showDocBugApplet.java to put the IP Address of server TWO into the
        URL construction code (in place of 192.168.68.55). You must use the IP addr
        -- not the name. Then recompile.

        Next rebuild the Jar files. The HTML files assume there are two JAR files,
        one for showDocBugApplet.jar and another for showDocBugSubApplet.jar. Then
        install these two JAR files plus the two HTML files. [You can just put all
        four files on both servers :-) ]

        Now here's how you run these. From IE or Netscape on a PC ( I did not check
        if the bug exists on Solaris clents), launch the top-level applet from
        server ONE, as follows:

              http://one/showDocBugApplet.html <-- depending where
        you put the HTML file, etc.

        You should see a simple JApplet with a button. Click the button, and it
        will do the work to show the subapplet from server TWO.

        If you have normal DNS/WINS/etc. setup, it should launch the new applet just
        fine. Now exit.

        Next, change your network so that the two servers and a pc client are not
        able to communicate with the DNS server or WINS server. Simulate a broken network by putting your pc and the two servers in a single IP network (or subnet). You don't need a router. Then exit the any browser windows (to give the Java PlugIn VM afresh start). Then launch IE (or Netscape) on the client PC. Then enterthe URL mentioned above. It should launch fine.

        Then click the button. The browser/plugin/applet will take on the order of
        minutes (about 60 TIMES) as long as it did before, to launch the subApplet.
        You'll probably think it is not working at all. During this time the PC
        appears to have problems doing a reverse lookup of the IP address for the
        second server. When convinced that there is a problem, kill the IE windows.

        Pull out a sniffer or use snoop to look at the traffic and you'll see "NS"
        packets for name resolution, which repeat over and over for a "long" time,
        getting TIMEOUTs but continuing to try.

        Source code for the test case is below. You'll also find a copy of the source
        files in /home/nrodin/cases/brocade/722335, as well as sniffer output from our
        testing. The file cap40secs.txt showed the network packets when there were no dns or wins entries configured. The applet launch took 40 seconds, compared to about 5 seconds normally.

        The second capture, cap10mins.txt, was from a situation where we also put in ipaddresses fora primary and secondary DNS server, as well as a primary and secondary WINSserver, and (probably without impact) a domain name of "sun.com". Those addresses for DNS and WINS were NOT present in the network. The delay
        increased from 40 (vs. 5) seconds to a total of ten minutes!

        --------------------------------------------------------------------------------
        <HTML>
        <HEAD>
        <TITLE>ShowDocBugApplet</TITLE>
        </HEAD>

        <BODY BGCOLOR=#000000 TEXT="#ffffff">
        <center>
        <!--"CONVERTED_APPLET"-->
        <!-- CONVERTER VERSION 1.0 -->

        <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        WIDTH = 550 HEIGHT = 250 codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
        <PARAM NAME = CODE VALUE = showDocBugApplet >
        <PARAM NAME = ARCHIVE VALUE = "showDocBugApplet.jar" >

        <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
        <COMMENT>
        <EMBED type="application/x-java-applet;version=1.2.2" java_CODE = showDocBugApplet java_ARCHIVE = "showDocBugApplet.jar" WIDTH = 550 HEIGHT = 250 simulatenot = "yes" pluginspage="http://java.sun.com/products/plugin/1.2.2/plugin-install.html"><NOEMBED></COMMENT>
        alt="Java applet support is not working. Verify installation/configuration of Java PlugIn, version 1.2.2. You may download the plugin from <a href=http://java.sun.com/products/plugin/1.2.2/plugin-install.html&gt;http://java.sun.com/products/plugin/1.2.2/plugin-install.html&lt;/a>"
        </NOEMBED></EMBED>
        </OBJECT>

        <!--
        <APPLET CODE = showDocBugApplet ARCHIVE = "showDocBugApplet.jar" WIDTH = 550 HEIGHT = 250
        alt="Java applet support is not working. Verify that your browser supports Java version 1.1.5 or higher">
        </APPLET>
        -->
        <!--"END_CONVERTED_APPLET"-->
        <br>
        </center>
        </BODY>
        </HTML>
        --------------------------------------------------------------------------------
        import java.awt.*;
        import javax.swing.*;
        import java.net.URL;

        /**
         * A basic extension of the javax.swing.JApplet class
         */
        public class showDocBugApplet extends JApplet
        {
        javax.swing.JButton showDocButton = new javax.swing.JButton();

        public void init()
        {
        // This line prevents the "Swing: checked access to system event queue" message
        // seen in some browsers.
        getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

        getContentPane().setLayout(null);
        setSize(426,266);
        showDocButton.setText("Invoke showDocBugSubApplet");
        getContentPane().add(showDocButton);
        showDocButton.setBounds(36,36,333,127);

        SymAction lSymAction = new SymAction();
        showDocButton.addActionListener(lSymAction);
        }

        class SymAction implements java.awt.event.ActionListener
        {
        public void actionPerformed(java.awt.event.ActionEvent event)
        {
        Object object = event.getSource();
        if (object == showDocButton)
        showDocButton_actionPerformed(event);
        }
        }

        void showDocButton_actionPerformed(java.awt.event.ActionEvent event)
        {
        try {
        URL url;
        System.err.println("starting showDocument button actionPerformed");
        System.err.println("constructing url to other device");
        url = new URL(getDocumentBase(), "http://129.144.238.3/showDocBugSubApplet.html");
        System.err.println("constructed url to other device"+url.toString());
        String browserTitle = "showDocBugSubApplet";
        System.err.println("invoking showDocument to that url");
        getAppletContext().showDocument(url, browserTitle);
        System.err.println("invoked showDocument to that url");
        System.err.println("finished showDocument button actionPerformed");
        } catch (Exception ex) {
        System.err.println("Exception: "+ex);
        }
        }
        }

        --------------------------------------------------------------------------------
        <HTML>
        <HEAD>
        <TITLE>ShowDocBugSubApplet</TITLE>
        </HEAD>

        <BODY BGCOLOR=#000000 TEXT="#ffffff">
        <center>
        <!--"CONVERTED_APPLET"-->
        <!-- CONVERTER VERSION 1.0 -->

        <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        WIDTH = 550 HEIGHT = 250 codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
        <PARAM NAME = CODE VALUE = showDocBugSubApplet >
        <PARAM NAME = ARCHIVE VALUE = "showDocBugSubApplet.jar" >

        <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
        <COMMENT>
        <EMBED type="application/x-java-applet;version=1.2.2" java_CODE = showDocBugSubApplet java_ARCHIVE = "showDocBugSubApplet.jar" WIDTH = 550 HEIGHT = 250 simulatenot = "yes" pluginspage="http://java.sun.com/products/plugin/1.2.2/plugin-install.html"><NOEMBED></COMMENT>
        alt="Java applet support is not working. Verify installation/configuration of Java PlugIn, version 1.2.2. You may download the plugin from <a href=http://java.sun.com/products/plugin/1.2.2/plugin-install.html&gt;http://java.sun.com/products/plugin/1.2.2/plugin-install.html&lt;/a>"
        </NOEMBED></EMBED>
        </OBJECT>

        <!--
        <APPLET CODE = showDocBugSubApplet ARCHIVE = "showDocBugSubApplet.jar" WIDTH = 550 HEIGHT = 250
        alt="Java applet support is not working. Verify that your browser supports Java version 1.1.5 or higher">
        </APPLET>
        -->
        <!--"END_CONVERTED_APPLET"-->
        <br>
        </center>
        </BODY>
        </HTML>
        --------------------------------------------------------------------------------

        import java.awt.*;
        import javax.swing.*;
        import java.net.URL;

        /**
         * A basic extension of the javax.swing.JApplet class
         */
        public class showDocBugSubApplet extends JApplet
        {
        javax.swing.JButton showDocSubButton = new javax.swing.JButton();

        public void init()
        {
        // This line prevents the "Swing: checked access to system event queue" message
        // seen in some browsers.
        getRootPane().putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

        getContentPane().setLayout(null);
        setSize(426,266);
        showDocSubButton.setText("We made it here");
        getContentPane().add(showDocSubButton);
        showDocSubButton.setBounds(36,36,333,127);

        SymAction lSymAction = new SymAction();
        showDocSubButton.addActionListener(lSymAction);
        }

        class SymAction implements java.awt.event.ActionListener
        {
        public void actionPerformed(java.awt.event.ActionEvent event)
        {
        Object object = event.getSource();
        if (object == showDocSubButton)
        showDocSubButton_actionPerformed(event);
        }
        }

        void showDocSubButton_actionPerformed(java.awt.event.ActionEvent event)
        {
        System.err.println("Did SubApplet's NOOP actionPerformed");
        }
        }


              gellisonsunw Gary Ellison (Inactive)
              nrodinsunw Nick Rodin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: