[omniORB] Java Applet problem with OmniORB Naming Service

Rene Jager renej_frog at users.sourceforge.net
Wed Jul 7 01:55:51 BST 2004


On Tue, 2004-07-06 at 21:59, Debasree Saha wrote:
> 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
>                 theOmniORB 
>                 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
> whentrying 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 inyour
>         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 doesnot
> see any incoming connection when using the client applet. I am notsure
> what I am doing wrong in the applet code. Here is the part of thecode
> which tries to connect with the name server. It fails when ittries to 
> initialize the naming service. Any help will be greatlyappreciated. 

probably has to doe with security. You can try with the appletviewer
that comes with the JDK and use the security property:

<quote>
The default security mode is to only allow connections to the
originating host. This behaviour can be modified however using either
the Applet->Properties Menu or by setting the property
appletviewer.security.mode=xxx in ~/.hotjava/properties directly, where
xxx is one of unrestricted for unrestricted access, host for the default
behaviour, or none to dissallow all network connections. Note: the above
Menu item actually sets this property for you.
</quote>

> 
>   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
> 
> 
> ______________________________________________________________________
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
-- 




More information about the omniORB-list mailing list