Ola Pessoal, eu sou novo no mundo Java, e estou utilizando a apostila FJ28 da caelum para aprender mais sobre o vraptor.
Só que esta acontecendo um problema no uso do VRAPTOR. Estou utilzando o Netbeans.
Eu estou fazendo um projeot utilizando o projeto lojavirtual da caelum como modelo
“[code]”
@Component(“admin”)
@InterceptedBy(DaoInterceptor.class)
public class AdminLogic {
private final DaoFactory daoFactory;
private Usuario usuario;
public AdminLogic(DaoFactory daoFactory) {
this.daoFactory = daoFactory;
}
public void login() {
}
public String efetuaLogin(Usuario usuario) {
UsuarioDao dao = this.daoFactory.getUsuarioDao();
this.usuario = dao.existeUnico(usuario);
if (this.usuario != null) {
return "ok";
} else {
return "invalid";
}
}
public void logout() {
this.usuario = null;
}
@Out(scope = ScopeType.SESSION)
public Usuario getUsuario() {
return usuario;
}
}
“[/code]”
Tenho o jsp para fazer o login, só que ao dar ok aparece a seguinte mensagem
“[code]”
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unable to instantiate using public br.com.projeto.loja.DaoInterceptor()
org.vraptor.http.DefaultDispatcher.dispatch(DefaultDispatcher.java:55)
org.vraptor.VRaptorServlet.service(VRaptorServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
org.vraptor.interceptor.InterceptorInstantiationException: Unable to instantiate using public br.com.projeto.loja.DaoInterceptor()
org.vraptor.interceptor.InterceptorDealer.poll(InterceptorDealer.java:68)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:58)
org.vraptor.interceptor.FlashScopeInterceptor.intercept(FlashScopeInterceptor.java:22)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.interceptor.RegisterAttributesInteceptor.intercept(RegisterAttributesInteceptor.java:47)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.core.VRaptorExecution.execute(VRaptorExecution.java:97)
org.vraptor.core.DefaultController.execute(DefaultController.java:46)
org.vraptor.http.DefaultDispatcher.dispatch(DefaultDispatcher.java:44)
org.vraptor.VRaptorServlet.service(VRaptorServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
org.vraptor.component.ComponentInstantiationException: Unable to instantiate using public br.com.projeto.loja.DaoInterceptor()
org.vraptor.component.ComponentConstructor.newInstance(ComponentConstructor.java:45)
org.vraptor.interceptor.InterceptorType.newInstance(InterceptorType.java:66)
org.vraptor.interceptor.InterceptorDealer.poll(InterceptorDealer.java:62)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:58)
org.vraptor.interceptor.FlashScopeInterceptor.intercept(FlashScopeInterceptor.java:22)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.interceptor.RegisterAttributesInteceptor.intercept(RegisterAttributesInteceptor.java:47)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.core.VRaptorExecution.execute(VRaptorExecution.java:97)
org.vraptor.core.DefaultController.execute(DefaultController.java:46)
org.vraptor.http.DefaultDispatcher.dispatch(DefaultDispatcher.java:44)
org.vraptor.VRaptorServlet.service(VRaptorServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
java.lang.reflect.InvocationTargetException
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
org.vraptor.component.ComponentConstructor.newInstance(ComponentConstructor.java:43)
org.vraptor.interceptor.InterceptorType.newInstance(InterceptorType.java:66)
org.vraptor.interceptor.InterceptorDealer.poll(InterceptorDealer.java:62)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:58)
org.vraptor.interceptor.FlashScopeInterceptor.intercept(FlashScopeInterceptor.java:22)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.interceptor.RegisterAttributesInteceptor.intercept(RegisterAttributesInteceptor.java:47)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.core.VRaptorExecution.execute(VRaptorExecution.java:97)
org.vraptor.core.DefaultController.execute(DefaultController.java:46)
org.vraptor.http.DefaultDispatcher.dispatch(DefaultDispatcher.java:44)
org.vraptor.VRaptorServlet.service(VRaptorServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
java.lang.NoClassDefFoundError: Could not initialize class br.com.projeto.util.HibernateUtil
br.com.projeto.modelo.dao.DaoFactory.(DaoFactory.java:26)
br.com.projeto.loja.DaoInterceptor.(DaoInterceptor.java:20)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
org.vraptor.component.ComponentConstructor.newInstance(ComponentConstructor.java:43)
org.vraptor.interceptor.InterceptorType.newInstance(InterceptorType.java:66)
org.vraptor.interceptor.InterceptorDealer.poll(InterceptorDealer.java:62)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:58)
org.vraptor.interceptor.FlashScopeInterceptor.intercept(FlashScopeInterceptor.java:22)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.interceptor.RegisterAttributesInteceptor.intercept(RegisterAttributesInteceptor.java:47)
org.vraptor.core.InterceptorsLogicFlow.execute(InterceptorsLogicFlow.java:72)
org.vraptor.core.VRaptorExecution.execute(VRaptorExecution.java:97)
org.vraptor.core.DefaultController.execute(DefaultController.java:46)
org.vraptor.http.DefaultDispatcher.dispatch(DefaultDispatcher.java:44)
org.vraptor.VRaptorServlet.service(VRaptorServlet.java:48)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
“[/code]”
O QUE EU ESTOU FAZENDO DE ERRADO … ME AJUDEM POR FAVOR !!!