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 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.