NullPointerException raised when calling isWrapperFor(...) on a closed connection in JBoss EAP

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • IronJacamar 1.4

Issue

  • Application called Connection.close() on a connection managed by the JBoss EAP pool

  • Subsequently, an attempt made to call isWrapperFor(...) on that connection results in an NPE

    ... java.lang.NullPointerException
            at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
            at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
            at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
            ...
    

Resolution

After closure of the connection reference do not attempt to call any methods on it.

The incorrect exception raised (should have been a "not associated" exception rather than an NPE) will be addressed in a future release1.

Root Cause

This is a known defect (Content from issues.jboss.org is not included.JBJCA-1389).

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.