Colegas,
desde já muito obrigado por tentar me ajudar.
Ainda não deu certo, no entanto, irei dar alguns detalhes da minha situação que talvez possa lhe ajudar a visualizar meu problema.
Estou usando o EJB 3, JBoss 7.1.1, Mysql 5 no eclipse.
Esta classe é onde esta o EntityManager como o nome do persistenceUnit
@Postei apenas a parte da classe
package br.com.devmedia.jma.service;
import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceUnit;
import javax.persistence.Query;
abstract class AbstractRepository {
@PersistenceUnit(unitName = "Ecommerce-ejb")
private final EntityManager em;
public AbstractRepository(EntityManager em) {
this.em = em;
}
protected EntityManager getEntityManager() {
return em;
}
}
Aqui o persistence.xml configurado para JTA
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="Ecommerce-ejb">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/EcommerceApp</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
</properties>
</persistence-unit>
</persistence>
Aqui o enorme stack trace do eclipe.
19:50:54,712 Informações [org.jboss.modules] JBoss Modules version 1.1.1.GA
19:50:55,290 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
19:50:55,383 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
19:50:57,037 INFO [org.xnio] XNIO Version 3.0.3.GA
19:50:57,037 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
19:50:57,053 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
19:50:57,069 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
19:50:57,100 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
19:50:57,100 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
19:50:57,132 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
19:50:57,132 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
19:50:57,147 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
19:50:57,163 INFO [org.jboss.as.security] (MSC service thread 1-8) JBAS013100: Current PicketBox version=4.0.7.Final
19:50:57,178 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
19:50:57,241 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
19:50:57,241 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
19:50:57,319 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
19:50:57,319 INFO [org.jboss.as.connector] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
19:50:57,381 INFO [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
19:50:57,381 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
19:50:57,428 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.2.GA
19:50:58,021 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-5) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
19:50:58,021 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory D:\IDE\server\jboss-as-7.1.1.Final\standalone\deployments
19:50:58,036 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015014: Re-attempting failed deployment Ecommerce-EAR.ear
19:50:58,052 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found Ecommerce-EAR.ear in deployment directory. To trigger deployment create a file called Ecommerce-EAR.ear.dodeploy
19:50:58,052 INFO [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on localhost/127.0.0.1:9999
19:50:58,068 INFO [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on localhost/127.0.0.1:4447
19:50:58,225 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
19:50:58,225 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/EcommerceApp]
19:50:58,318 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "Ecommerce-EAR.ear"
19:50:58,755 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "Ecommerce-ejb.jar"
19:50:58,771 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "Ecommerce-war.war"
19:50:59,020 INFO [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for Ecommerce-ejb
19:50:59,036 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for Ecommerce-ejb
19:50:59,051 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-ejb.jar".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-ejb.jar".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment "Ecommerce-ejb.jar" of deployment "Ecommerce-EAR.ear"
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.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.IllegalArgumentException: JBAS011470: Persistence unitName was not specified and there are 2 persistence unit definitions in application deployment "Ecommerce-EAR.ear". 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
19:50:59,051 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-war.war".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-war.war".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment "Ecommerce-war.war" of deployment "Ecommerce-EAR.ear"
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.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.IllegalArgumentException: JBAS011470: Persistence unitName was not specified and there are 2 persistence unit definitions in application deployment "Ecommerce-EAR.ear". 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
19:50:59,115 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015951: Admin console listening on http://127.0.0.1:9990
19:50:59,115 ERROR [org.jboss.as] (MSC service thread 1-6) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 5324ms - Started 151 of 230 services (3 services failed or missing dependencies, 74 services are passive or on-demand)
19:50:59,333 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "Ecommerce-EAR.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-war.war\".DEPENDENCIES" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-war.war\".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment \"Ecommerce-war.war\" of deployment \"Ecommerce-EAR.ear\"","jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-ejb.jar\".DEPENDENCIES" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-ejb.jar\".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment \"Ecommerce-ejb.jar\" of deployment \"Ecommerce-EAR.ear\""}}
19:50:59,333 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment Ecommerce-ejb.jar in 9ms
19:50:59,349 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment Ecommerce-war.war in 12ms
19:50:59,349 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment Ecommerce-EAR.ear in 15ms
19:50:59,349 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-war.war".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-war.war".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment "Ecommerce-war.war" of deployment "Ecommerce-EAR.ear"
service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-ejb.jar".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Ecommerce-EAR.ear"."Ecommerce-ejb.jar".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment "Ecommerce-ejb.jar" of deployment "Ecommerce-EAR.ear"
19:50:59,349 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-war.war\".DEPENDENCIES" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-war.war\".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment \"Ecommerce-war.war\" of deployment \"Ecommerce-EAR.ear\"","jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-ejb.jar\".DEPENDENCIES" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Ecommerce-EAR.ear\".\"Ecommerce-ejb.jar\".DEPENDENCIES: Failed to process phase DEPENDENCIES of subdeployment \"Ecommerce-ejb.jar\" of deployment \"Ecommerce-EAR.ear\""}}}}