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

Callbacks to a Java Applet ( CORBA ) I.E. 4.0 sp1a

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: deploy
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      other

      Description

      DESCRIPTION
      ~~~~~~~~~~~

      The Java 1.2 plugin for I.E does not allow callbacks on CORBA objects created
      by the applet.

      When a client tries to invoke methods on the object an exception is raised.



      SYNOPSIS
      ~~~~~~~~

      The Java 1.2 plugin contains all the CORBA classes that allow client to create
      CORBA objects. The plugin allows the invocation of methods on objects created on
      other systems however it does not allow the others to invoke methods on objects
      created within the browser.


      HOW TO REPRODUCE
      ~~~ ~~ ~~~~~~~~~


      0) Take the simple test case from the files attached to this report:

              Makefile
              Hello.html
              Hello.idl
              HelloApplet.java
              HelloClient.java

      1) start the web server on the host machine.

      2) start the naming service on the host machine:
              tnameserv -ORBInitialPort 1025

      3) idltojava Hello.idl

      4) javac HelloApplet.java
         javac HelloClient.java

      5) make sure all class files are in the deployed applet's codebase

      6) deploy HTML file "Hello.html" in the codebase; modify to fit your
      machine

      7) Using a web browser, load the applet.

      8) Load the webpage with a Browser setup to use the 1.2 plugin.

      9) Run the HelloClient program wich will error with the comms failure.

      CODE
      ~~~~
      -----------------------------------------------
      Hello.idl

      module HelloApp {
        interface Hello
        {
          string sayHello();
        };
      };

      ------------------------------------------------

      /* HelloApplet.java */
      import HelloApp.*;
      import org.omg.CosNaming.*;
      import org.omg.CosNaming.NamingContextPackage.*;
      import org.omg.CORBA.*;
      import java.awt.Graphics;
      import java.applet.*;

      class HelloServant extends _HelloImplBase
      {
        HelloApplet applet;
        int count = 1;

        public HelloServant( HelloApplet a )
        {
          super();
          applet = a;
        }

        public String sayHello()
        {
          String msg = "Hello : " + count;
          applet.message = msg;
          count ++;

          return msg;
        }
      }

      public class HelloApplet extends java.applet.Applet
      {
        public String message = "Start up";

        public void init()
        {
          try {
            // Create an instance of an ORB.
            ORB orb = ORB.init( this, null );

            // Create the servant and register it.
            HelloServant helloRef = new HelloServant( this );
            orb.connect( helloRef );

            // Get a reference to the Naming service.
            org.omg.CORBA.Object objRef =
                                      orb.resolve_initial_references( "NameService");

            NamingContext ncRef = NamingContextHelper.narrow( objRef );

            // Bind the name to the name service.
            NameComponent nc = new NameComponent( "Hello", "" );
            NameComponent path[] = { nc };
            ncRef.rebind( path, helloRef );
          } catch( Exception e ) {
            System.err.println( "Oooops! " + e );
            e.printStackTrace( System.out );
          }
        }

        public void paint( Graphics g )
        {
          g.drawString( message, 25, 50 );
        }
      } <HTML>
      <!--Copyright 1997, Sun Microsystems, Inc. -->
      <HEAD>
         <TITLE>Java IDL Getting Started: Running HelloApplet</TITLE>
      <!-- Changed by: vlc, 7/30/97 -->
         <X-SAS-WINDOW TOP=42 BOTTOM=477 LEFT=4 RIGHT=534>
      </HEAD>
      <BODY BGCOLOR="#FFFFFF">


      <H1 ALIGN=CENTER>Running the Hello World Applet</H1>
      <HR>

      <P>If all goes well, the applet appears below:

      <P>

      <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
         width="200" height="200" align="baseline"
           codebase="http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Ver
      sion=1,2,0,0">
           <PARAM NAME="code" VALUE="HelloApplet.class">
           <PARAM NAME="codebase" VALUE=".">
           <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2">
           <PARAM name="org.omg.CORBA.ORBInitialHost" value=p4u-10c>
           <PARAM name="org.omg.CORBA.ORBInitialPort" value=1050>
               No JDK 1.2 support for APPLET!!
           </NOEMBED></EMBED>
       </OBJECT>

      <P><HR>
      <FONT
      SIZE="-2"><A HREF="http://www.sun.com/share/text/SMICopyright.html">Copyright
      &copy;</A></FONT><FONT SIZE="-2"> 1996, 1997 Sun Microsystems, Inc.,
      2550 Garcia Ave., Mtn. View, CA. 94043-1100 USA., All rights
      reserved.</FONT></P>

      </BODY>
      </HTML>
       

      ----------------------------------------------------------

      /* HelloClient.java */
      import HelloApp.*;
      import org.omg.CosNaming.*;
      import org.omg.CORBA.*;

      public class HelloClient {
        public static void main(String args[]) {
          try {
            System.out.println("before orb.init");
            ORB orb = ORB.init(args, null);
            System.out.println("before objref =");
            System.out.println(orb.resolve_initial_references("NameService"));
            org.omg.CORBA.Object objRef =
            orb.resolve_initial_references("NameService");
            System.out.println("before ncref =");
            NamingContext ncRef =
            NamingContextHelper.narrow(objRef);
            System.out.println("before nc =");
            NameComponent nc = new NameComponent("Hello", "");
            System.out.println("before path[]=");
            NameComponent path[] = {nc};
            System.out.println("before get helloref");
            Hello helloRef =
            HelloHelper.narrow(ncRef.resolve(path));
            System.out.println("before get hello");
            String hello = helloRef.sayHello();
            System.out.println("before print");
            System.out.println(hello);
          } catch(Exception e) {
            System.out.println("ERROR : "+ e);
            e.printStackTrace(System.out);
          }
        }
      }

      ------------------------------------
      Hello.html


      ---------------

      This problem is not reproducible using an appletviewer.

      patrick.ong@Eng 1999-02-23

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              duke J. Duke (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: