Both Netscape and IE (with plugin 1.2.2) hang when I try to reload a page 
with for example a simple hello applet (based on the hello application from 
the orion-primer: see code bellow). IE even completely hangs my Win98 
system.

The first time I connect to the page it loads the plugin nicely and comes 
up with the right results:no problem yet. At this moment I can run a second 
page connecting to a different application on the server (still no 
problem), but when I connect for the second time to either the hello applet 
or the second application it hangs up, Netscape or Win98.

The first idea (because Win98 hangs) that it has to do with networking 
stuff is confirmed by the fact that reloading Swing applets without jndi 
calls don't give any problems at all.

Any suggestions?
Frank Eggink


The applet code is:

======================================================
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.io.IOException;
import java.util.Date;
import java.util.Properties;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import hello.ejb.Hello;
import hello.ejb.HelloHome;


// Simple version of the Hello applet

public class HelloApplet extends JApplet
{
        public void init()
        {
                JTextArea textArea= new JTextArea();
                textArea.setLineWrap(true);             // In case of long lines
                textArea.append("Init applet ...");
                setContentPane(textArea);
                
                Context jndiContext;
                try
                {
                        jndiContext = new InitialContext();
                }
                catch (NamingException exception)
                {
                        textArea.append("\nUnable to get initial context: " + 
exception.toString());
                        textArea.append("\nSetting context to null");
                        jndiContext=null;
                }
                if (jndiContext != null)
                {
                        textArea.append("\nWe've got an initial context");
                }
                else
                {
                        textArea.append("\nContext is null");
                }
        
                
                // Get a reference to the Hello home interface
                HelloHome helloHome;
                try
                {
                        Object boundObject = 
jndiContext.lookup("java:comp/env/ejb/HelloHome");
                        helloHome = (HelloHome) 
PortableRemoteObject.narrow(boundObject, 
HelloHome.class);
                }
                catch (Throwable exception)
                {
                        System.out.println("Unable to get home interface: " + 
exception.toString());
                        helloHome=null;
                }
                if (helloHome != null)
                {
                        textArea.append("\nI've got a reference to HelloHome.");
                }
                else
                {
                        textArea.append("\nhelloHome is null");
                }
                
                // Get a reference to a Hello instance
                Hello hello;
                try {
                    hello = helloHome.create();
                }
                catch (Throwable exception) {
                    System.out.println ("Unable to create a new Hello instance: " + 
exception.toString());
                        hello = null;           
                }
                if (hello != null)
                {
                        textArea.append("\nI should have a reference to a legal Hello 
object by 
now.");
                }
                else
                {
                        textArea.append("\nhello is null");
                }
                
                try
                {
                        textArea.append("\n\nAt " + new Date().toString() + " Your 
Server said: 
-- " + hello.sayHello() + " --\n");
                }
                catch(Throwable exception)
                {
                        textArea.append("\nServer didn't say hello ...");
                        System.out.println("Unable to receive an answer from the 
server:\n" + 
exception.toString());
                }
                textArea.append("\nExit cleanly");
        }
}

======================================================

The html files are:

================ Internet Explorer ========================
<HTML>
<HEAD>
<TITLE>The hello applet contacting a Session Bean [Internet 
Explorer]</TITLE>
</HEAD>
<BODY>
<OBJECT CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        CODEBASE="http://java.sun.com/products/plugin/1.1
            /jinstall-11-win32.cab#Version=1,1,0,0"
        WIDTH=426
        HEIGHT=266>
        <PARAM NAME="TYPE" VALUE="application/x-java-applet;
                version=1.1">
        <PARAM NAME="CODE" VALUE="HelloApplet.class">
        <PARAM NAME="CODEBASE" VALUE="applet">
        <PARAM NAME="ARCHIVE" 
VALUE=".,hello.jar,jndi.properties,orion-primer-client.jar,orion.jar,jnd  
i.jar">
</OBJECT>
</BODY>
</HTML>

================= Netscape ======================

<html>

<title>The hello applet contacting a Session Bean [Netscape]</title>
<body bgcolor="white">
<h3> Your server says : </h3>


<EMBED type="application/x-java-applet;version=1.2" width="800" 
height="600" code="HelloApplet.class" codebase="applet" 
archive=".,hello.jar,jndi.properties,orion-primer-client.jar,jndi.jar,or  
ion.jar" 
pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html">
        <NOEMBED>
        Plugin tag OBJECT or EMBED not supported by browser.
        </NOEMBED>
</EMBED>

<p>
<h4>
<font color=red>
The above applet is loaded using the Java Plugin from a jsp page using the
plugin tag.
</font>
</h4>
</body>
</html>

Reply via email to