Can a persistence unit packaged inside of an EJB jar be accessible by other jars in EAP 6?

Solution Verified - Updated -

Issue

The persistence.xml is packaged inside of one jar xxx.jar.
When other jar tries to access the persistence unit using

@PersistenceContext (unitName="xxx.jar#MY_Persistence-Unit")

the following errors occur:

java.lang.IllegalArgumentException: JBAS011441: Can't find a persistence unit named xxx.jar#MY_Persistence-Unit at deployment yyy.jar

Environment

  • Red Hat JBoss Enterprise Application Platform(EAP)
    • 6.x
  • JPA

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.