Bom dia,
Resolvi começar a estudar sobre o VRaptor, vi muita gente falando bem dele.
Então, ja pesquisei bastante na net, e aqui no forum tb, estou com 1 problema, nao to conseguindo fazer o deploy da minha aplicacao, esta dando erro, segue abaixo o erro e os arquivos:
10:59:33,475 ERROR [stderr] (MSC service thread 1-4) log4j:WARN No appenders could be found for logger (br.com.caelum.vraptor.config.BasicConfiguration).
10:59:33,475 ERROR [stderr] (MSC service thread 1-4) log4j:WARN Please initialize the log4j system properly.
10:59:33,475 ERROR [stderr] (MSC service thread 1-4) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
10:59:33,723 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/vraptor]] (MSC service thread 1-4) Exception starting filter vraptor: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryCreator': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named default
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1413) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [org.springframework.context-3.0.5.RELEASE.jar:]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [org.springframework.context-3.0.5.RELEASE.jar:]
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.start(SpringBasedContainer.java:106) [vraptor-3.4.1.jar:]
at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:87) [vraptor-3.4.1.jar:]
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:108) [vraptor-3.4.1.jar:]
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:102) [vraptor-3.4.1.jar:]
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:447) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3245) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3836) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.7.0_03]
at java.lang.Thread.run(Unknown Source) [:1.7.0_03]
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named default
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) [hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.Final]
at br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator.create(EntityManagerFactoryCreator.java:41) [vraptor-3.4.1.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_03]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.7.0_03]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.7.0_03]
at java.lang.reflect.Method.invoke(Unknown Source) [:1.7.0_03]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:340) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:293) [org.springframework.beans-3.0.5.RELEASE.jar:]
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130) [org.springframework.beans-3.0.5.RELEASE.jar:]
... 24 more
10:59:33,726 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Error filterStart
10:59:33,726 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-4) Context [/vraptor] startup failed due to previous errors
10:59:33,738 INFO [org.jboss.web] (MSC service thread 1-4) registering web context: /vraptor
10:59:33,765 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "vraptor.war"
10:59:34,322 WARN [org.jboss.as.protocol] (pool-2-thread-2) JBAS012100: Got error closing channel JBREM00206: Channel is not open
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="vraptor">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>br.com.k2studio.vraptor.entity.Grupo</class>
<class>br.com.k2studio.vraptor.entity.Usuario</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/teste" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
<property name="hibernate.connection.username" value="postgres" />
<property name="hibernate.connection.password" value="p001389" />
</properties>
</persistence-unit>
</persistence>
orm.xml
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">
<named-query name="selectGrupos">
<query>SELECT obj FROM Grupo obj ORDER BY obj.nmGrupo</query>
</named-query>
<named-query name="selectUsuarios">
<query>SELECT obj FROM Usuario obj ORDER BY obj.nmUsuario</query>
</named-query>
</entity-mappings>
E onde crio o entityManagerFactory
JPAFactory
public class JPAFactory {
private static EntityManagerFactory factory;
public JPAFactory() {}
public static EntityManager getEntityManager() {
if (factory == null) {
factory = Persistence.createEntityManagerFactory("vraptor");
}
return factory.createEntityManager();
}
}
Detalhe, os arquivos orm.xml e persistence.xml estao na pasta src/META-INF, so fiz criar nela esses arquivos.
Ja agradeço pela ajuda =D