Buggy code:
public abstract class CascadeDeleteStrategy { public static final class NoneCascadeDeleteStrategy extends CascadeDeleteStrategy { public NoneCascadeDeleteStrategy ( JDBCCMRFieldBridge cmrField ) { } public void removedIds ( CmpEntityBeanContext ctx , Object [ ] oldRelationRefs , List ids ) { } public void cascadeDelete ( CmpEntityBeanContext ctx , List oldValues ) throws RemoteException , RemoveException { } } public static final class DefaultCascadeDeleteStrategy extends CascadeDeleteStrategy { public DefaultCascadeDeleteStrategy ( JDBCCMRFieldBridge cmrField ) { } public void removedIds ( CmpEntityBeanContext ctx , Object [ ] oldRelationRef , List ids ) { } public void cascadeDelete ( CmpEntityBeanContext ctx , List oldValues ) throws RemoteException , RemoveException { } } public static final class BatchCascadeDeleteStrategy extends CascadeDeleteStrategy { private final String batchCascadeDeleteSql ; public BatchCascadeDeleteStrategy ( JDBCCMRFieldBridge cmrField ) { } public void removedIds ( CmpEntityBeanContext ctx , Object [ ] oldRelationRefs , List ids ) { } public void cascadeDelete ( CmpEntityBeanContext ctx , List oldValues ) throws RemoteException , RemoveException { } } public static CascadeDeleteStrategy getCascadeDeleteStrategy ( JDBCCMRFieldBridge cmrField ) { } protected final JDBCCMRFieldBridge cmrField ; protected final JDBCEntityBridge entity ; protected final JDBCStoreManager relatedManager ; protected final Logger log ; public CascadeDeleteStrategy ( JDBCCMRFieldBridge cmrField ) { } public abstract void removedIds ( CmpEntityBeanContext ctx , Object [ ] oldRelationRefs , List ids ) { } public abstract void cascadeDelete ( CmpEntityBeanContext ctx , List oldValues ) throws RemoteException , RemoveException { } protected void scheduleCascadeDelete ( Object [ ] oldRelationsRef , List values ) { } protected void executeDeleteSQL ( String sql , Object key ) throws RemoveException { } public void invokeRemoveRelated ( Object relatedId ) throws RemoteException , RemoveException { CmpEntityBeanComponent component = relatedManager . getComponent ( ) ; if ( ( component . getLocalClass ( ) ) != null ) { <START_BUG> final EJBLocalObject ejbObject = component . getEjbLocalObject ( relatedId ) ; <END_BUG> ejbObject . remove ( ) ; } else { final EJBObject ejbObject = component . getEJBObject ( relatedId ) ; ejbObject . remove ( ) ; } } interface SecurityActions { class UTIL { static CascadeDeleteStrategy . SecurityActions getSecurityActions ( ) { } } CascadeDeleteStrategy . SecurityActions NON_PRIVILEGED = new CascadeDeleteStrategy . SecurityActions ( ) { public Principal getPrincipal ( ) { } public Object getCredential ( ) { } } ; CascadeDeleteStrategy . SecurityActions PRIVILEGED = new CascadeDeleteStrategy . SecurityActions ( ) { private final PrivilegedAction getPrincipalAction = new PrivilegedAction ( ) { public Object run ( ) { } } ; private final PrivilegedAction getCredentialAction = new PrivilegedAction ( ) { public Object run ( ) { } } ; public Principal getPrincipal ( ) { } public Object getCredential ( ) { } } ; Principal getPrincipal ( ) { } Object getCredential ( ) { } } }

Fix:
final EJBLocalObject ejbObject = component . getEJBLocalObject ( relatedId ) ;