Read only archive ; use https://github.com/JacORB/JacORB/issues for new issues
Bug 291 - Client confused when connecting to server with same POA name
Summary: Client confused when connecting to server with same POA name
Status: RESOLVED DUPLICATE of bug 313
Alias: None
Product: JacORB
Classification: Unclassified
Component: POA (show other bugs)
Version: 1.4.1
Hardware: All Windows NT
: P2 normal
Assignee: Reimo Tiedemann
URL:
Depends on:
Blocks:
 
Reported: 2002-11-07 21:36 UTC by David Nedde
Modified: 2003-06-09 16:11 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***