[omniORB] Java Applet problem with OmniORB Naming Service

Debasree Saha debasree at geosci.uchicago.edu
Tue Jul 6 15:59:55 BST 2004


On Jul 4, 2004, at 4:17 PM, Alex Tingle wrote:

> On Sat, 3 Jul 2004 09:20:27 -0500
> Debasree Saha <debasree at geosci.uchicago.edu> wrote:
>
>> I am having problems running Applets and connecting to the OmniORB
>> naming service. The code gives error at this line:
>>
>> org.omg.CORBA.Object objRef =
>> orb.resolve_initial_references("NameService");
>>
>> But I can run a simple java client and connect to the same name
>> server.
>
> Do you mean that the same client code works when built as an
> application? So it only fails when it's running as an applet?

Yes, the same client code works as an application but fails only when 
trying to run as an applet..
>> The applet does not work even when I run the server, client
>> and the name server on the same machine. Does anybody know if any
>> changes has to be made in the configuration file for the applets to
>> work? Any help will be greatly appreciated. Thanks
>
> You can work out whether the problem is at the naming service or in 
> your
> applet by running the naming service with the trace level turned up.
> `omniNames -ORBtraceLevel 5' should be enough for you to see when
> incoming connections are established. If the naming service never sees
> any incoming connections, then your applet has the problem, otherwise
> the problem probably lies with the naming service.
>

The problem seems to be with the applet since the name service does not 
see any incoming connection when using the client applet. I am not sure 
what I am doing wrong in the applet code. Here is the part of the code 
which tries to connect with the name server. It fails when it tries to  
initialize the naming service. Any help will be greatly appreciated.

   public void init()
         {
         try {
         System.out.println("Initializing the ORB");
         ORB orb = ORB.init(this,null);

         System.out.println("Initializing the Name Service...");
         org.omg.CORBA.Object objRef = 
orb.resolve_initial_references("NameService");
         System.out.println("Object" + objRef);
         if (objRef == null)
         {
                 System.out.println("Name Service Object is null");
                 return;
         }
         System.out.println("Get the root Naming Context...");
         NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
        if (ncRef == null)
         {
                 System.out.println("NameService is null");
                 return;
         }


> Here are two possibilities:
>
> 1. You need to start the naming service with option:
>   `-ORBsupportBootstrapAgent 1'
> Sun's Java ORB uses an old protocol to find the naming service - you
> need to activate support explicitly. (If your java clients work OK as
> applications, then you probably already know this.)
>
> 2. You have failed to escape from the applet's sandbox. This can happen
> even when everything is running on the same machine. Perhaps your
> browser thinks the web-server is on localhost (127.0.0.1) while Java's
> InitialHost is set to your machine's external IP address (e.g.
> 10.11.12.13).
>
> good luck,
>
> -Alex
>
> -- 
> :: alex tingle
> :: 58 kings way, harrow, mddx. uk. HA1 1XU
> :: alex.tingle AT firetree.net  +44-7901-552763
Thanks for all your help.
Debasree
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3309 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20040706/defaddcf/attachment.bin


More information about the omniORB-list mailing list