ADC Home > Reference Library > Technical Q&As > Legacy Documents > Java >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Using the MRJ with IE 5


Q: I am running an applet with Internet Explorer 5 and MRJ 2.2, and when my code attempts to connect to our server using URLConnection, the applet crashes. After this crash, the next interaction with the browser crashes the browser, and JNI panic messages show up in the Java Message Log. The call to URL.openStream() is in the call stack in the JNI panic message. I've verified that the URL is valid and correct in all cases. What is going on here?

A: MRJ 2.2 uses a new feature in IE 5 which allows the MRJ to use Internet Explorer's networking stack for network communication. This allows IE to provide applet caching and cookie support to MRJ hosted Java applets.

Unfortunately, due to some interoperability problems with this new applet caching code, you may run into problems with applets that make network connections. At the time of this writing, these issues are scheduled to be resolved with the release of MRJ 2.2.3. In the meanwhile, you can work around these issues by using one of two methods.

Perhaps the easiest way to work around this problem is to change Internet Explorer's cache settings by choosing Preferences from the Edit menu and going to the Advanced page. Select the Update pages: Always radio button under the Cache section of the preference dialog and then click OK. (See image, below.)

preferences

Figure 1. Internet Explorer preferences

The following is a description of these cache settings:

Cache Once Per Session
Checks for updated content only if you return to a Web page you visited in a previous Internet Explorer session. If the page has changed, Internet Explorer displays the newer version of the page and stores a copy in the cache.

Never
Displays Web pages you previously visited by downloading their content from the Web.

Always
Checks for updated content each time you return to a Web page. If the page has changed, Internet Explorer displays the newer version of the page and stores a copy in the cache.

In our case, we use Always to prevent IE from caching the .jar file. This technique may be a little intrusive for the user, and it also has the side effect of turning off caching for web pages as well as applets. A second solution involves a code change to the applet, but does not require the user to modify these IE Preference settings:

Listing 1. Replacing IE's URLConnection handler with a generic socket mechanism

Instead of:

    URLConnection httpConn = myUrl.openConnection();
use this code:
    URLConnection httpConn =
        new sun.net.www.protocol.http.HttpURLConnection(
            url, url.getHost(), url.getPort());

If you choose to use this source code, for security purposes you will have to sign your applet. Instructions for applet signing can be found in Technote 1175: Applet Signing with MRJ and JavaKey.

Again, these workarounds are only to be used if you are having problems with reliability of your Applet under MRJ 2.2.x and IE 5.0. If it ain't broke, don't fix it. A future release of the MRJ will address these issues more completely.

[Aug 14 2000]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.