Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues

Bug 291

Summary: Client confused when connecting to server with same POA name
Product: JacORB Reporter: David Nedde <dnedde>
Component: POAAssignee: Reimo Tiedemann <tie>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 1.4.1   
Hardware: All   
OS: Windows NT   

Description David Nedde 2002-11-07 21:36:09 UTC
If the JacORB server has a POA name that matches the JacORB client's POA name, 
and the client calls _is_existent on the server object, the client thinks the 
server's POA is it's local POA, with NullPointerException resulting.

Workaround: make sure server and client use different names for their POA.

Below is the code I used to create the POA, in case this is specific to the 
policy I am using.

/** 
 * Create and return a POA configured with the desired policies. 
 * @return null if failure to create the poa.
 */
static public POA createPoa( ORB orb )
{
    POA serverPoa = null;

    try
    {
        // Resolve Root POA
        POA rootPoa = 
            POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

        // Create policies for our serverPOA
        org.omg.CORBA.Policy [] policies = {
            // PERSISTENT POA creates CORBA objects where the object ids of
            // created objects outlive the process in which they are
            // created.
            rootPoa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT),
        };

        // Create our serverPOA with the right policies.  
        // The lifespan policy of Root POA is TRANSIENT and we want
        // PERSISTENT.
        serverPoa = rootPoa.create_POA( "Poa", 
                                        rootPoa.the_POAManager(), policies);

        // Activate all POAs managed by the POA manager, i.e., allow them
        // to listen for requests.
        rootPoa.the_POAManager().activate();
    }
    catch ( org.omg.CORBA.ORBPackage.InvalidName e )
    {
        System.out.println("Exception resolving RootPOA" );
        e.printStackTrace();
    }
    catch ( org.omg.PortableServer.POAPackage.AdapterAlreadyExists e )
    {
        System.out.println("Exception creating serverPoa" );
        e.printStackTrace();
    }
    catch ( org.omg.PortableServer.POAPackage.InvalidPolicy e )
    {
        System.out.println("Exception creating serverPoa" );
        e.printStackTrace();
    }
    catch ( org.omg.PortableServer.POAManagerPackage.AdapterInactive e )
    {
        System.out.println("Exception activating POA manager" );
        e.printStackTrace();
    }

    return serverPoa;
}
Comment 1 Nick Cross 2003-06-09 16:11:47 UTC

*** This bug has been marked as a duplicate of 313 ***