Estou tentando usar o vraptor com hibernate só que estou dando esse error.
Ago 12, 2013 3:55:49 PM org.apache.catalina.core.AprLifecycleListener init
Informações: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\Arquivos de programas\Java\jre7\bin;F:\WINDOWS\Sun\Java\bin;F:\WINDOWS\system32;F:\WINDOWS;F:/Arquivos de programas/Java/jre7/bin/client;F:/Arquivos de programas/Java/jre7/bin;F:/Arquivos de programas/Java/jre7/lib/i386;F:\Perl\site\bin;F:\Perl\bin;F:\WINDOWS\system32;F:\WINDOWS;F:\WINDOWS\System32\Wbem;F:\Arquivos de programas\Microsoft SQL Server\100\Tools\Binn\;F:\Arquivos de programas\Microsoft SQL Server\100\DTS\Binn\;F:\Arquivos de programas\MySQL\MySQL Server 5.1\bin;C:\hsqldb\lib\hsqldb;F:\Arquivos de programas\Arquivos comuns\Ahead\Lib\;F:\Documents and Settings\Informatica\Desktop;;.
Ago 12, 2013 3:55:49 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Advertência: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:sbacem-web' did not find a matching property.
Ago 12, 2013 3:55:50 PM org.apache.coyote.http11.Http11Protocol init
Informações: Initializing Coyote HTTP/1.1 on http-8080
Ago 12, 2013 3:55:50 PM org.apache.catalina.startup.Catalina load
Informações: Initialization processed in 606 ms
Ago 12, 2013 3:55:50 PM org.apache.catalina.core.StandardService start
Informações: Starting service Catalina
Ago 12, 2013 3:55:50 PM org.apache.catalina.core.StandardEngine start
Informações: Starting Servlet Engine: Apache Tomcat/6.0.24
Ago 12, 2013 3:55:50 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
Informações: validateJarFile(C:\Documents and Settings\Administrador\Meus documentos\TesteVraptor\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sbacem-web\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Ago 12, 2013 3:55:50 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
Informações: validateJarFile(C:\Documents and Settings\Administrador\Meus documentos\TesteVraptor\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sbacem-web\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
15:55:50,828 INFO [BasicConfiguration ] Using class br.com.caelum.vraptor.ioc.guice.GuiceProvider as Container Provider
15:55:52,109 INFO [BasicConfiguration ] br.com.caelum.vraptor.scanning = null
15:55:52,109 INFO [WebAppBootstrapFactory] Dynamic WebAppBootstrap found.
15:55:52,234 ERROR [ScannotationComponentScanner] There's no occurence of package br.com.caelum.vraptor.util.hibernate in classpath
15:55:52,546 WARN [DefaultEnvironment ] Could not find the file /development.properties to load. If you ask for any property, null will be returned
15:55:52,593 INFO [Version ] Hibernate Annotations 3.3.0.GA
15:55:52,625 INFO [Environment ] Hibernate 3.2.1
15:55:52,625 INFO [Environment ] hibernate.properties not found
15:55:52,625 INFO [Environment ] Bytecode provider name : cglib
15:55:52,640 INFO [Environment ] using JDK 1.4 java.sql.Timestamp handling
15:55:52,968 INFO [DefaultConverters ] Registering bundled converters
15:55:52,968 INFO [LinkToHandler ] Registering linkTo component
Ago 12, 2013 3:55:53 PM org.apache.catalina.core.StandardContext filterStart
Grave: Exception starting filter vraptor
com.google.inject.CreationException: Guice creation errors:
1) Error notifying InjectionListener br.com.caelum.vraptor.ioc.guice.ScopeLifecycleListener$LifecycleExecutor@c5954b of persistence.SessionFactoryCreator.
Reason: net.vidageek.mirror.exception.ReflectionProviderException: Could not invoke method create
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.bindToConstructor(GuiceComponentRegistry.java:151)
while locating persistence.SessionFactoryCreator
Caused by: net.vidageek.mirror.exception.ReflectionProviderException: Could not invoke method create
at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:45)
at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)
at net.vidageek.mirror.invoke.MethodHandlerByMethod.withoutArgs(MethodHandlerByMethod.java:58)
at br.com.caelum.vraptor.ioc.guice.ScopeLifecycleListener$LifecycleExecutor.afterInjection(ScopeLifecycleListener.java:89)
at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:97)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:95)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:83)
at br.com.caelum.vraptor.ioc.guice.GuiceProvider.start(GuiceProvider.java:97)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:108)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:102)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at br.com.caelum.vraptor.ioc.guice.GuiceProvider$GuiceContainer.instanceFor(GuiceProvider.java:62)
at persistence.SessionFactoryCreator.getHibernateCfgLocation(SessionFactoryCreator.java:70)
at persistence.SessionFactoryCreator.create(SessionFactoryCreator.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)
... 40 more
2) Error notifying InjectionListener br.com.caelum.vraptor.ioc.guice.ScopeLifecycleListener$LifecycleExecutor@c5954b of persistence.SessionFactoryCreator.
Reason: net.vidageek.mirror.exception.ReflectionProviderException: Could not invoke method create
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.bindToConstructor(GuiceComponentRegistry.java:151)
while locating persistence.SessionFactoryCreator
while locating br.com.caelum.vraptor.ioc.ComponentFactory<org.hibernate.SessionFactory>
Caused by: net.vidageek.mirror.exception.ReflectionProviderException: Could not invoke method create
at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:45)
at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)
at net.vidageek.mirror.invoke.MethodHandlerByMethod.withoutArgs(MethodHandlerByMethod.java:58)
at br.com.caelum.vraptor.ioc.guice.ScopeLifecycleListener$LifecycleExecutor.afterInjection(ScopeLifecycleListener.java:89)
at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:97)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:95)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:83)
at br.com.caelum.vraptor.ioc.guice.GuiceProvider.start(GuiceProvider.java:97)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:108)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:102)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at br.com.caelum.vraptor.ioc.guice.GuiceProvider$GuiceContainer.instanceFor(GuiceProvider.java:62)
at persistence.SessionFactoryCreator.getHibernateCfgLocation(SessionFactoryCreator.java:70)
at persistence.SessionFactoryCreator.create(SessionFactoryCreator.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)
... 41 more
3) Error notifying InjectionListener br.com.caelum.vraptor.ioc.guice.ScopeLifecycleListener$LifecycleExecutor@c5954b of persistence.SessionFactoryCreator.
Reason: net.vidageek.mirror.exception.ReflectionProviderException: Could not invoke method create
at br.com.caelum.vraptor.ioc.guice.GuiceComponentRegistry.bindToConstructor(GuiceComponentRegistry.java:151)
while locating persistence.SessionFactoryCreator
while locating br.com.caelum.vraptor.ioc.ComponentFactory
Caused by: net.vidageek.mirror.exception.ReflectionProviderException: Could not invoke method create
at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:45)
at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)
at net.vidageek.mirror.invoke.MethodHandlerByMethod.withoutArgs(MethodHandlerByMethod.java:58)
at br.com.caelum.vraptor.ioc.guice.ScopeLifecycleListener$LifecycleExecutor.afterInjection(ScopeLifecycleListener.java:89)
at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:97)
at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:95)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:83)
at br.com.caelum.vraptor.ioc.guice.GuiceProvider.start(GuiceProvider.java:97)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:108)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:102)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
at br.com.caelum.vraptor.ioc.guice.GuiceProvider$GuiceContainer.instanceFor(GuiceProvider.java:62)
at persistence.SessionFactoryCreator.getHibernateCfgLocation(SessionFactoryCreator.java:70)
at persistence.SessionFactoryCreator.create(SessionFactoryCreator.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)
... 41 more
3 errors
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:183)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:83)
at br.com.caelum.vraptor.ioc.guice.GuiceProvider.start(GuiceProvider.java:97)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:108)
at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:102)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Ago 12, 2013 3:55:53 PM org.apache.catalina.core.StandardContext start
Grave: Error filterStart
Ago 12, 2013 3:55:53 PM org.apache.catalina.core.StandardContext start
Grave: Context [/sbacem-web] startup failed due to previous errors
Ago 12, 2013 3:55:53 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Grave: A web application appears to have started a thread named [com.google.inject.internal.util.$Finalizer] but has failed to stop it. This is very likely to create a memory leak.
Ago 12, 2013 3:55:53 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
Grave: A web application created a ThreadLocal with key of type [null] (value [com.google.inject.internal.InjectorImpl$1@2f743b]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@17801e6]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
meu web xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>sbacem-web</display-name>
<filter>
<filter-name>vraptor</filter-name>
<filter-class>br.com.caelum.vraptor.VRaptor</filter-class>
</filter>
<filter-mapping>
<filter-name>vraptor</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<context-param>
<param-name>br.com.caelum.vraptor.packages</param-name>
<param-value>br.com.caelum.vraptor.util.hibernate</param-value>
</context-param>
</web-app>
SessionFactoryCreator
@Component
@ApplicationScoped
public class SessionFactoryCreator implements ComponentFactory<SessionFactory> {
private SessionFactory factory;
private final Container container;
public SessionFactoryCreator(Container container) {
this.container = container;
}
@PostConstruct
public void create() {
Configuration configuration = new AnnotationConfiguration();
configuration = configuration.configure(getHibernateCfgLocation());
factory = configuration.buildSessionFactory();
}
public SessionFactory getInstance() {
return factory;
}
@PreDestroy
public void destroy() {
factory.close();
}
private URL getHibernateCfgLocation() {
if (isEnvironmentAvailable()) {
Environment env = container.instanceFor(Environment.class);
return env.getResource(getHibernateCfgName());
}
return getClass().getResource(getHibernateCfgName());
}
protected String getHibernateCfgName() {
return "config/mysql_hibernate.cfg.xml";
}
private boolean isEnvironmentAvailable() {
try {
Class.forName("br.com.caelum.vraptor.environment.Environment");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}
Alguém sabe o que pode ser. Ainda não estou conseguindo entender como se trabalho com vraptor e hibernate
e enquanto não entender sei que sempre vou ter problemas com esses erros.