Reputation: 11
My project runs in production on JBOSS EAP 6. This XX.war is deployed in Jboss EAP6 but now we are upgrading to EAP7. I'm getting this error when i deploy war file in Jboss EAP7 local.
project structure would be 1.XX.jar 2.YY.war
XX.jar gets deployed first since YY.war has dependency on XX.jar but for some reason on JBOSS 7, YY.war deployment is failing and getting below error.
"{\"WFLYCTL0080: Failed services\" => {\"jboss.deployment.unit.\"YY.war\".WeldStartService\" => \"Failed to start service Caused by: java.lang.IllegalArgumentException: WFLYWELD0037: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named '' in deployment YY.war for injection point protected javax.persistence.EntityManager wbr.investments.XX.dao.DaoRoot.emOptions\"}}"
Upvotes: 0
Views: 143
Reputation: 843
There were quite some changes regarding CDI. In EAP 7, CDI is version 1.2, in EAP 6 it was 1.0.
The error message indicates that you are trying to access a persistence unit with an empty name. I guess this might result from using something like this:
public class DaoRoot {
@Inject
private EntityManager emOptions;
}
CDI will most likely produce an uninitialized EntityManager and fail with the error message you found in the log.
Try injecting your entity manager using
@PersistenceContext(unitName = "...")
private EntityManager emOptions
If you want to use plain @Inject
, you will have to write a producer method.
public class EnitityManagerFactory {
@PersistenceContext(unitName = "...")
private EntityManager em;
@Produces
public EntityManger createEntityManager() {
return em;
}
}
EAP 6 seemed to be more forgiving in these cases, while EAP 7 is following the specs very strictly.
Upvotes: 1