Galera depois de muito correr atrás estou conseguindo fazer o meu formulario efetuar uma consulta no banco, porém apareceu este erro logo a baixo colocarei o codigo
ERRO
javax.servlet.ServletException: java.lang.reflect.InvocationTargetException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
org.apache.commons.beanutils.BeanUtils.copyProperty(BeanUtils.java:450)
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:264)
usuario.action.UsuarioAction.buscar(UsuarioAction.java:85)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:150)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
root cause
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
usuario.bean.Usuario$$EnhancerByCGLIB$$ac39aa29.setIdusuario(<generated>)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
org.apache.commons.beanutils.BeanUtils.copyProperty(BeanUtils.java:450)
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:264)
usuario.action.UsuarioAction.buscar(UsuarioAction.java:85)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:150)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
DAO
public Object buscar(Class clazz, Long pk) throws Exception
{
sessao = HibernateFactory.getSession();
transacao = sessao.beginTransaction();
Usuario objt = (Usuario) sessao.load(clazz,pk);
transacao.commit();
sessao.flush();
sessao.close();
return objt;
}
Action
[code]
public ActionForward buscar(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession();
UsuarioForm usuarioForm = (UsuarioForm) form;
Usuario usuario = new Usuario();
PersistenciaDAO persistencia = new PersistenciaDAO();
usuario = (Usuario) persistencia.buscar(Usuario.class, usuarioForm.getIdusuario());
BeanUtils.copyProperties(usuario, usuarioForm);
return mapping.findForward(SUCCESS);
}
[/code]
JSP
<html:form action="usuario" focus="idusuario">
Id:<html:text property="idusuario"/>
Nome:<html:text property="nome"/>
Senha:<html:password property="senha"/>
<html:submit property="method" ><bean:message key="button.salvar" /></html:submit>
<html:submit property="method" ><bean:message key="button.deletar" /></html:submit>
<html:submit property="method" ><bean:message key="button.buscar" /></html:submit>
</html:form>
Onde estou errando?