Enabling runtime bytecode enhancement breaks resolution of datasource alias in JBoss EAP

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • Hibernate 5

Issue

  • Defined datasource alias in application.xml

    	...
    	<resource-ref>
    		<res-ref-name>testDS</res-ref-name>
    		<lookup-name>java:jboss/datasources/ExampleDS</lookup-name>
    	</resource-ref>
    	...
    
  • Enabled bytecode enhancement in persistence.xml

    			<property name="hibernate.enhancer.enableLazyInitialization" value="true" />
    			<property name="hibernate.enhancer.enableAssociationManagement" value="true" />
    
  • Deployment fails with

    ... ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "jboss.eap-1.0-SNAPSHOT.ear")]) - failure description: {
        "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.app.ejb-application.env.testDS"],
        "WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"jboss.eap-1.0-SNAPSHOT.ear/ejb.jar#jboss-eap-hibernate\".__FIRST_PHASE__ is missing [jboss.naming.context.java.app.ejb-application.env.testDS]"]
    }
    

Resolution

This issue1 is resolved in This content is not included.EAP 7.3 cumulative patch (CP) 3 and later releases. Production systems should use the latest available cumulative patch.

Root Cause

This is a known defect (This content is not included.WFLY-13159).

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.