title: How to create multiple persistence unit Names in JBoss7.1.1.Final
body: <p>I am upgrading jboss server 4.1.2 to jboss 7.1.1 so getting exception is </p>
  
  <pre><code>15:51:24,655 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."mobeeadmin.war".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.unit."mobeeadmin.war".DEPENDENCIES: Failed to process phase DEPENDENCIES of deployment "mobeeadmin.war"
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37]
      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]
  Caused by: java.lang.IllegalArgumentException: JBAS011470: Persistence unitName was not specified and there are 3 persistence unit definitions in application deployment "mobeeadmin.war".  Either change the application to have only one persistence unit definition or specify the unitName for each reference to a persistence unit.
      at org.jboss.as.jpa.container.PersistenceUnitSearch.resolvePersistenceUnitSupplier(PersistenceUnitSearch.java:69)
      at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.getPersistenceUnit(JPAAnnotationParseProcessor.java:284)
      at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.getBindingSource(JPAAnnotationParseProcessor.java:220)
      at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.processField(JPAAnnotationParseProcessor.java:151)
      at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.processPersistenceAnnotations(JPAAnnotationParseProcessor.java:118)
      at org.jboss.as.jpa.processor.JPAAnnotationParseProcessor.deploy(JPAAnnotationParseProcessor.java:90)
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
      ... 5 more
  </code></pre>
  
  <p>application environment is seam2.1.2 integrate with jpa ,richfaces and jsf.
  how can i declare multiple persistence units in jboss 7.1.1.</p>
  
  <p>my components.xml</p>
  
  <pre><code>&lt;core:init debug="false" jndi-pattern="@jndiPattern@" transaction-management-   enabled="true"/&gt;
  &lt;core:manager concurrent-request-timeout="2000"
      conversation-id-parameter="cid" conversation-timeout="120000"
  
  &lt;web:hot-deploy-filter url-pattern="/*.mobee" /&gt;
  
  
  &lt;persistence:entity-manager-factory
      installed="@seamBootstrapsPu@" name="entityManagerFactory"
      persistence-unit-name="pu1" /&gt;
  &lt;persistence:managed-persistence-context 
      auto-create="true" entity-manager-factory="@seamEmfRef@" name="entityManager"
      persistence-unit-jndi-name="@puJndiName@" /&gt;
  
   &lt;persistence:entity-manager-factory name="empEntityManagerFactory" 
                    persistence-unit-name="pu2"/&gt;
  
      &lt;persistence:managed-persistence-context name="empEntityManager"
      auto-create="true" entity-manager-factory="#{empEntityManagerFactory}"
      persistence-unit-jndi-name="java:/pu2Database"/&gt;
  
  
  
  
  &lt;async:quartz-dispatcher /&gt;
  
  
  &lt;security:identity authenticate-method="#{authenticator.authenticate}" /&gt;
  
  
  &lt;web:rewrite-filter view-mapping="*.mobee" /&gt;
  
  &lt;event type="org.jboss.seam.security.notLoggedIn"&gt;
      &lt;action execute="#{redirect.captureCurrentView}" /&gt;
  &lt;/event&gt;
  
  &lt;event type="org.jboss.seam.security.loginSuccessful"&gt;
      &lt;action execute="#{redirect.returnToCapturedView}" /&gt;
  &lt;/event&gt;
  &lt;mail:mail-session host="localhost" port="25" /&gt;
  </code></pre>
  
  <p>persistence.xml</p>
  
  <pre><code>&lt;persistence-unit name="pu1" transaction-type="JTA"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;jta-data-source&gt;java:/sample1&lt;/jta-data-source&gt;
  
          &lt;mapping-file&gt;META-INF/orm.xml&lt;/mapping-file&gt;
  
  
          &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
          &lt;properties&gt;
  
  
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
              &lt;property name="hibernate.jdbc.batch_size" value="20" /&gt;
              &lt;property name="hibernate.cache.use_second_level_cache"
                  value="false" /&gt;
              &lt;property name="hibernate.show_sql" value="false" /&gt;
  
  
              &lt;property name="hibernate.transaction.manager_lookup_class"
                  value="@transactionManagerLookupClass@" /&gt;
  
            &lt;property name="jboss.entity.manager.factory.jndi.name" value="@puJndiName@ "/&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  
      &lt;persistence-unit name="pu2" transaction-type="JTA"&gt;
          &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
          &lt;jta-data-source&gt;java:/sample2&lt;/jta-data-source&gt;
  
          &lt;mapping-file&gt;META-INF/emp2Orm.xml&lt;/mapping-file&gt;
  
  
          &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
          &lt;properties&gt;
  
  
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt;
              &lt;property name="hibernate.jdbc.batch_size" value="20" /&gt;
              &lt;property name="hibernate.cache.use_second_level_cache"
                  value="false" /&gt;
              &lt;property name="hibernate.show_sql" value="false" /&gt;
  
  
                  &lt;property name="hibernate.transaction.manager_lookup_class"
                  value="org.hibernate.transaction.JBossTransactionManagerLookup" /&gt;
  
  
                 &lt;property name="jboss.entity.manager.factory.jndi.name" value="java:/pu2Database" /&gt;
  
  
  
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  </code></pre>