Skip to content

NullPointerException in new InitialContext() if IIOP endpoints are unreachable #244

@tnagao7

Description

@tnagao7

Environment Details

  • ORB version: ORB 5.0.0 (included in GlassFish 7.0.25)
  • JDK version: OpenJDK 21.0.7
  • OS: Linux

Problem Description

Unexpected NullPointerException is thrown in new InitialContext() if the specified IIOP endpoints are unreachable.

# java --add-opens java.base/java.lang=ALL-UNNAMED -cp /opt/glassfish7/glassfish/lib/gf-client.jar:hello-ejb.jar SampleClient
Jul 16, 2025 2:11:23 PM com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl createClasspathElements
WARNING: The startup context property is not set: com.sun.aas.installRoot
Jul 16, 2025 2:11:24 PM org.glassfish.enterprise.iiop.impl.GlassFishORBManager getORB
INFO: ORB initialization succeeded: com.sun.corba.ee.impl.orb.ORBImpl@176996c3
Jul 16, 2025 2:12:27 PM org.glassfish.enterprise.iiop.impl.GroupInfoServiceObserverImpl doMembershipChange
SEVERE: Problem with membership change notification. Exception occurred.
java.lang.NullPointerException: Cannot invoke "java.util.Collection.toArray()" because "c" is null
        at java.base/java.util.ArrayList.<init>(ArrayList.java:181)
        at com.sun.corba.ee.impl.folb.GroupInfoServiceBase.getClusterInstanceInfo(GroupInfoServiceBase.java:78)
        at com.sun.corba.ee.impl.folb.ClientGroupManager.getClusterInstanceInfo(ClientGroupManager.java:551)
        at org.glassfish.enterprise.iiop.impl.GroupInfoServiceObserverImpl.doMembershipChange(GroupInfoServiceObserverImpl.java:66)
        at org.glassfish.enterprise.iiop.impl.GroupInfoServiceObserverImpl.forceMembershipChange(GroupInfoServiceObserverImpl.java:52)
        at org.glassfish.enterprise.iiop.impl.NamingClusterInfoImpl.initGroupInfoService(NamingClusterInfoImpl.java:83)
        at com.sun.enterprise.naming.impl.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:144)
        at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:46)
        at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:520)
        at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
        at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
        at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
        at SampleClient.main(SampleClient.java:9)

Steps to reproduce

The issue can be reproduced by running a standalone client app like below in GlassFish 7.0.25.

import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class SampleClient {
    public static void main(String[] args) throws NamingException {
        Properties properties = new Properties();
        properties.setProperty("com.sun.appserv.iiop.endpoints", "dummyhost:3700");
        InitialContext ic = new InitialContext(properties);
        // ...
    }
}

In the above app, the com.sun.appserv.iiop.endpoints property refers to an unreachable IIOP endpoint.

The standalone client app can be run as follows.

$ java --add-opens java.base/java.lang=ALL-UNNAMED -cp .:/path/to/glassfish/lib/gf-client.jar SampleClient

Then NullPointerException occurrs as in the log mentioned earlier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions