NullPointerException loading an EJB 2 CMP Relation in JBoss EAP?

Solution Verified - Updated -


  • JBoss Enterprise Application Platform (EAP) 5.x


  • Migrating an application from OAS to EAP 5.1.1 and have hit a problem with CMP Entity Bean relationships getting this exception:

    ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.util.Collection com.jboss.examples.ejb2.entity.ExampleLocal.getExampleAttribute(), causedBy:
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.execute(
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadRelation(
    at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(
    at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceValue(
    at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(
    at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler$FieldGetInvoker.invoke(
    at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(


Implement the hashCode on your pk classes.  The hashCode and equals should be consistent.

  public int hashCode()
    // Add custom hashCode() impl here
    return super.hashCode();

Root Cause

Missing hashCode implementation

Diagnostic Steps

Review the server.log, ejb-jar.xml, and jbosscmp-jdbc.xml.

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.