Boa noite, pessoal.
Não estou conseguindo subir minha aplicação depois que alterei o meu persistence.xml
para usar JTA
.
Segue abaixo o meu arquivo persistence.xml
.
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="vendinha" transaction-type="JTA">
<!-- provider -->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/vendinhaDS</jta-data-source>
<properties>
<!-- propriedades do hibernate -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<!-- atualiza o banco, gera as tabelas se for preciso -->
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Agora, segue o erro que recebo. Pior que não encontro a solução em canto algum. Me ajudem!
Informações: HHH000204: Processing PersistenceUnitInfo [
name: vendinha
...]
Informações: HHH000412: Hibernate Core {5.2.2.Final}
Informações: HHH000206: hibernate.properties not found
Informações: HHH000021: Bytecode provider name : javassist
Informações: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Informações: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Grave: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
Grave: javax.persistence.PersistenceException: [PersistenceUnit: vendinha] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:951)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:881)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:151)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:207)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:114)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:926)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:435)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
PS: O pool de configuração, assim como o DS, estão configurados no servidor (e "pingando").
Abaixo, segue um exemplo de como estou chamando a PU.
package br.com.pdv.dao.impl;
import br.com.pdv.entities.Cliente;
import br.com.pdv.dao.iface.IClienteDao;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author w
*/
@Stateless
public class ClienteDao extends GenericDao<Cliente> implements IClienteDao {
@Override
@PersistenceContext(unitName = "vendinha")
public void setEntityManager(EntityManager entityManager) {
super.setEntityManager(entityManager);
}
}