Buggy code:
public class PersistenceUnitParseProcessor implements DeploymentUnitProcessor { private static final String WEB_PERSISTENCE_XML = "WEB-INF//classes//META-INF//persistence.xml" ; private static final String META_INF_PERSISTENCE_XML = "META-INF//persistence.xml" ; private static final String JAR_FILE_EXTENSION = ".jar" ; private static final String LIB_FOLDER = "lib" ; private static final Logger log = Logger . getLogger ( "org.jboss.jpa" ) ; @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } @ Override public void undeploy ( DeploymentUnit context ) { } private void handleJarDeployment ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void handleWarDeployment ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void handleEarDeployment ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( PersistenceUnitParseProcessor . isEarDeployment ( deploymentUnit ) ) { List < PersistenceUnitMetadataHolder > listPUHolders = new ArrayList < PersistenceUnitMetadataHolder > ( 1 ) ; final ResourceRoot deploymentRoot = deploymentUnit . getAttachment ( DEPLOYMENT_ROOT ) ; VirtualFile persistence_xml = deploymentRoot . getRoot ( ) . getChild ( PersistenceUnitParseProcessor . META_INF_PERSISTENCE_XML ) ; parse ( persistence_xml , listPUHolders , deploymentUnit , deploymentRoot ) ; PersistenceUnitMetadataHolder holder = normalize ( listPUHolders ) ; deploymentRoot . putAttachment ( PERSISTENCE_UNITS , holder ) ; markDU ( holder , deploymentUnit ) ; <START_BUG> List < ResourceRoot > resourceRoots = deploymentUnit . getAttachment ( RESOURCE_ROOTS ) ; <END_BUG> assert resourceRoots != null ; for ( ResourceRoot resourceRoot : resourceRoots ) { if ( ( ( ! ( SubDeploymentMarker . isSubDeployment ( resourceRoot ) ) ) && ( resourceRoot . getRoot ( ) . getLowerCaseName ( ) . endsWith ( PersistenceUnitParseProcessor . JAR_FILE_EXTENSION ) ) ) && ( resourceRoot . getRoot ( ) . getParent ( ) . getName ( ) . equals ( PersistenceUnitParseProcessor . LIB_FOLDER ) ) ) { listPUHolders = new ArrayList < PersistenceUnitMetadataHolder > ( 1 ) ; persistence_xml = resourceRoot . getRoot ( ) . getChild ( PersistenceUnitParseProcessor . META_INF_PERSISTENCE_XML ) ; parse ( persistence_xml , listPUHolders , deploymentUnit , resourceRoot ) ; holder = normalize ( listPUHolders ) ; resourceRoot . putAttachment ( PERSISTENCE_UNITS , holder ) ; markDU ( holder , deploymentUnit ) ; } } PersistenceUnitParseProcessor . log . trace ( ( "parsed<seq2seq4repair_space>persistence<seq2seq4repair_space>unit<seq2seq4repair_space>definitions<seq2seq4repair_space>for<seq2seq4repair_space>ear<seq2seq4repair_space>" + ( deploymentRoot . getRootName ( ) ) ) ) ; } } private void parse ( final VirtualFile persistence_xml , final List < PersistenceUnitMetadataHolder > listPUHolders , final DeploymentUnit deploymentUnit , final ResourceRoot deploymentRoot ) throws DeploymentUnitProcessingException { } private void postParseSteps ( final VirtualFile persistence_xml , final PersistenceUnitMetadataHolder puHolder , final DeploymentUnit deploymentUnit , final ResourceRoot resourceRoot ) { } private static URL getRelativeURL ( VirtualFile persistence_xml , String jar ) { } protected URL getPersistenceUnitURL ( VirtualFile persistence_xml ) { } private PersistenceUnitMetadataHolder normalize ( List < PersistenceUnitMetadataHolder > listPUHolders ) { } static boolean isEarDeployment ( final DeploymentUnit context ) { } static boolean isWarDeployment ( final DeploymentUnit context ) { } private static String getScopedDeploymentUnitPath ( DeploymentUnit deploymentUnit ) { } public static String createBeanName ( DeploymentUnit deploymentUnit , String persistenceUnitName ) { } private void markDU ( PersistenceUnitMetadataHolder holder , DeploymentUnit deploymentUnit ) { } }

Fix:
List < ResourceRoot > resourceRoots = deploymentUnit . getAttachmentList ( RESOURCE_ROOTS ) ;