Galera, é o seguinte… Estou precisando desenvolver um projeto com JPA + Hibernate + JSF 2 + JBoss AS 7.0.1, acontece que nunca trabalhei com o JBoss e estou apanhando pacas, já procurei na net a torto e a direito a minha dúvida aqui mas não consegui resolver meu problema. Estou tentando desenvolver minha aplicação web quase que da mesma forma como eu faria com o Tomcat 7, e talvez esse seja o meu erro.
Bem, meu problema é o seguinte… meu projeto não faz o deploy nem “cum nojo” no JBoss, o a mensagem de erro é a seguinte:
02:01:12,878 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."MeuProjeto.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."MeuProjeto.war".INSTALL: Failed to process phase INSTALL of deployment "MeuProjeto.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method) [:1.6.0_26]
at java.lang.Class.forName(Class.java:247) [:1.6.0_26]
at org.jboss.invocation.proxy.AbstractProxyFactory.afterClassLoad(AbstractProxyFactory.java:94)
at org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:166)
at org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:145)
at org.jboss.as.ejb3.component.stateless.StatelessComponentDescription$3.configure(StatelessComponentDescription.java:139)
at org.jboss.as.ee.component.ComponentDescription$DefaultFirstConfigurator.configure(ComponentDescription.java:872)
at org.jboss.as.ee.component.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:65)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named MeuPersistence
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at br.com.meuprojeto.util.JPAUtil.<clinit>(JPAUtil.java:14)
... 14 more
meu persistence.xml, vale lembrar que a configuração do data-source está feita corretamente:
<?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="MeuPersistence" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/UbiquaTracking</jta-data-source>
<class>classes</class>
(...)
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
</properties>
</persistence-unit>
</persistence>
JPAUtil
package br.com.meuprojeto.util;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class JPAUtil {
private static EntityManagerFactory entityManagerFactory;
static{
entityManagerFactory = Persistence.createEntityManagerFactory("MeuPersistence");
}
public EntityManager getEntityManager(){
return entityManagerFactory.createEntityManager();
}
}
meu controle
package br.com.meuprojeto.controle;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedBean;
import javax.persistence.EntityManager;
import br.com.meuprojeto.dao.RastTbContatoGatewaySmsDAO;
import br.com.meuprojeto.modelo.RastTbContatoGatewaySms;
import br.com.meuprojeto.util.JPAUtil;
@ManagedBean(name="rastTbContatoGatewaySmsControle")
@RequestScoped
public class RastTbContatoGatewaySmsControle {
private EntityManager em = new JPAUtil().getEntityManager();
private RastTbContatoGatewaySms rastTbContatoGatewaySms = new RastTbContatoGatewaySms();
private List<RastTbContatoGatewaySms> listaRastTbContatoGatewaySms = new ArrayList<RastTbContatoGatewaySms>();
private RastTbContatoGatewaySmsDAO rastTbContatoGatewaySmsDAO = new RastTbContatoGatewaySmsDAO(em);
public List<RastTbContatoGatewaySms> getListaRastTbContatoGatewaySms(){
listaRastTbContatoGatewaySms = rastTbContatoGatewaySmsDAO.listaCompleta();
return listaRastTbContatoGatewaySms;
}
}
Se alguém puder me ajudar, ficarei grato! 