NullPointerException in org.jboss.naming.remote.protocol.v1.Protocol in JBoss EAP 6.x

Solution Unverified - Updated

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 6.3.2

Issue

  • Seeing a null pointer in remote naming in JBoss EAP 6:
Exception in thread "naming-client-message-receiver-44-thread-1"
(naming-client-message-receiver-44-thread-1) java.lang.NullPointerException
(naming-client-message-receiver-44-thread-1) at org.jboss.naming.remote.protocol.v1.BaseProtocolCommand.readResult(BaseProtocolCommand.java:67)
(naming-client-message-receiver-44-thread-1) at org.jboss.naming.remote.protocol.v1.Protocol$1.handleClientMessage(Protocol.java:149)
(naming-client-message-receiver-44-thread-2) Exception in thread "naming-client-message-receiver-44-thread-2"
(naming-client-message-receiver-44-thread-2) java.lang.NullPointerException
(naming-client-message-receiver-44-thread-2) at org.jboss.naming.remote.protocol.v1.Protocol$1$3.read(Protocol.java:155)

Also seeing writes closed:

Unable to negotiate connection.: org.jboss.remoting3.NotOpenException: Writes closed
  at org.jboss.remoting3.remote.RemoteConnectionChannel.openOutboundMessage(RemoteConnectionChannel.java:113)
  at org.jboss.remoting3.remote.RemoteConnectionChannel.writeMessage(RemoteConnectionChannel.java:302)
  at org.jboss.remotingjmx.VersionedConectionFactory$ClientVersionReceiver.sendVersionZeroHeader(VersionedConectionFactory.java:136)
  at org.jboss.remotingjmx.VersionedConectionFactory$ClientVersionReceiver.handleMessage(VersionedConectionFactory.java:203)
  at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:452)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)

Resolution

The remote naming InitialContext cannot be shared across threads.

The 'Writes closed' indicates a client connected and made a request, but then disappeared when the server tried to send the response. This could be the client & server are in the same JVM, where two threads are using the same remote naming InitialContext, both make a request, thread one completes removes the future object, thread two tries to access the future object which is null, throws a null pointer exception and then disconnects leaving the server left with no where to send the response.

Diagnostic Steps

Make sure the remote naming InitialContext is not being shared among multiple threads.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.