users@glassfish.java.net

GF3.0.1: NPE when creating InitialContext from multiple threads

From: <glassfish_at_javadesktop.org>
Date: Fri, 23 Jul 2010 10:51:56 PDT

Hi,

I've come across a strange problem when using GF3.0.1. When opening a new InitialContext() from a program I have a about 80% chance of getting an NPE with the following stack trace:

java.lang.NullPointerException
        at com.sun.enterprise.connectors.ConnectorRuntime.checkAccessibility(ConnectorRuntime.java:1072)
        at com.sun.enterprise.resource.naming.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:105)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at testing.initialcontext.TestInitialContext$Clazz$Task.run(TestInitialContext.java:63)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
javax.naming.CommunicationException: Communication exception for SerialContext targetHost=localhost,targetPort=10037,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is java.lang.NullPointerException]
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:461)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at testing.initialcontext.TestInitialContext$Clazz$Task.run(TestInitialContext.java:63)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
        at com.sun.enterprise.connectors.ConnectorRuntime.checkAccessibility(ConnectorRuntime.java:1072)
        at com.sun.enterprise.resource.naming.AdministeredObjectFactory.getObjectInstance(AdministeredObjectFactory.java:105)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
        at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
        ... 8 more


NB: My Glassfish's ORB port is at 10037.

I have distilled a simple test case which is attached. It seems that the more threads are used, the more it is likely to get above NPE. In about 20% of the time, the test executes just fine.

My environment: Glassfish 3.0.1, JDK 1.6_20, Kubuntu 10.04

For the attached test case to work there needs to be the queue "queue/myTestQueue".

Any hints are appreciated. Thanks in advance,
Chris.
[Message sent by forum member 'chrjohn']

http://forums.java.net/jive/thread.jspa?messageID=478425