JBAS011470: Persistence unitName was not specified and there are 2 persistence unit definitions in application deployment, when using Spring on EAP.

Solution Verified - Updated -

Issue

My persistence.xml file has 2 persistence units and spring xml file referencing them by name. Application runs fine on Tomcat server, but can not be deployed to JBoss. Why?

Example of persistence Name from Spring mnp-servlet.xml file:

    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="userPU"/>
    </bean>

    <bean id="otherEmf" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
        <property name="persistenceUnitName" value="otherPU"/>
    </bean>

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content