[omniORB] OmniORB server and JavaIDL applet

Allan Li allanli@research.att.com
Wed, 24 Feb 1999 16:49:52 -0500


Hi Gary,

I'm running the OmniORB Echo demo program as the server on a IRIX machine
(machine name is bilbo.research.att.com, port # 1234). At first I wrote a
Echo client in JavaIDL and run it on an NT machine, it works. Then I
modified the client program to an applet:


import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import java.awt.Graphics;

public class HelloApplet extends java.applet.Applet
{
    public void init() {
        try {
            // create and initialize the ORB
            ORB orb = ORB.init(this, null);

            // get the root naming context
            org.omg.CORBA.Object objRef =
                orb.resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);

            NameComponent nc0 = new NameComponent("test", "my_context");
            NameComponent nc1 = new NameComponent("Echo", "Object");
            NameComponent path[] = {nc0, nc1};
            Echo helloRef = EchoHelper.narrow(ncRef.resolve(path));

            // call the Hello server object and print results
            message = helloRef.echoString("Hello from JavaIDL!!!");
           // message = helloRef.sayHello();

        } catch (Exception e) {
            message = "HelloApplet exception: " + e.getMessage();
            e.printStackTrace(System.out);
        }
    }

    public void paint(Graphics g) 
    {
    	g.drawString("Hello, World!!
		-- the following greetings are from corba", 25, 30);
        g.drawString(message, 25, 50);
    }
 
    String message = "";
}

The corresponding html file:
<body>
<html>
<APPLET CODE=HelloApplet.class        WIDTH=500         HEIGHT=300>
<PARAM name="org.omg.CORBA.ORBInitialHost" value=bilbo.research.att.com>
<PARAM name="org.omg.CORBA.ORBInitialPort" value=1234>
</APPLET>
</body>
</body>

I got a null exception. Actually you can try it at
http://infolab.research.att.com/allan/javaIDL/Tutorial.html

Any of your suggestions to the problem will be greatly appreciated.

Allan 

On Wed, 24 Feb 1999, Gary D. Duzan wrote:

> 
>    It would help if you posted a description of what you have tried and
> what the results were.
> 
> 					Gary Duzan
> 					GTE Laboratories
> 
> 
> In Message <Pine.SGI.4.03.9902241606340.48299759-100000@bilbo.research.att.com> ,
>    Allan Li <allanli@research.att.com> wrote:
> 
> =>Hi,
> =>
> =>I'm trying to connect a JavaIDL client applet to an OmniORB C++ server
> =>without luck. Could anyone give me some ideas about this?
> =>
> =>Thanks!
> =>
> =>Allan
> =>
> =>
> =>
>