浏览 8516 次
锁定老帖子 主题:dwr的这种问题怎么解决啊!急!
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2006-12-28
public class UserModel extends Model { private String userId;// 编号 private String userName;// 登录名称 private String userPassword;// 密码 被加密 private UserPowerTeamModel userPowerTeamId; } 小弟用DWR加Hibernate时出问这样的问题!用DWR调用一个方法反回一个List对象时 如果里面有另一个对象如上图UserModel 中有一个‘private UserPowerTeamModel userPowerTeamId;’这个对象的时候如果userPowerTeamId有值dwr报错如果userPowerTeamId为null就是好的,不知道这个问题大家是怎么解决的!晕了急死,项目作到一半卡住了!!! 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2006-12-28
2006-12-28 22:26:02,796 [org.hibernate.LazyInitializationException]-[ERROR] could not initialize proxy - the owning Session was closed org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:56) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158) at com.clan.model.user.UserPowerTeamModel$$EnhancerByCGLIB$$d6c877f1.getUserPowerTeamName(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.directwebremoting.impl.PropertyDescriptorProperty.getValue(PropertyDescriptorProperty.java:62) at org.directwebremoting.convert.BasicObjectConverter.convertOutbound(BasicObjectConverter.java:188) at org.directwebremoting.dwrp.DefaultConverterManager.convertOutbound(DefaultConverterManager.java:192) at org.directwebremoting.convert.BasicObjectConverter.convertOutbound(BasicObjectConverter.java:189) at org.directwebremoting.dwrp.DefaultConverterManager.convertOutbound(DefaultConverterManager.java:192) at org.directwebremoting.convert.CollectionConverter.convertOutbound(CollectionConverter.java:206) at org.directwebremoting.dwrp.DefaultConverterManager.convertOutbound(DefaultConverterManager.java:192) at org.directwebremoting.extend.ScriptBufferUtil.createOutput(ScriptBufferUtil.java:56) at org.directwebremoting.dwrp.BaseCallMarshaller$CallScriptConduit.addScript(BaseCallMarshaller.java:501) at org.directwebremoting.extend.EnginePrivate.remoteHandleCallback(EnginePrivate.java:56) at org.directwebremoting.dwrp.BaseCallMarshaller.marshallOutbound(BaseCallMarshaller.java:328) at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:53) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) 2006-12-28 22:26:02,796 [org.directwebremoting.convert.CollectionConverter]-[WARN] Failed to convert array member 1. Conversion error for type: java.util.ArrayList org.directwebremoting.extend.MarshallException: Error marshalling com.clan.model.user.UserPowerTeamModel$$EnhancerByCGLIB$$d6c877f1: could not initialize proxy - the owning Session was closed. See the logs for more details. at org.directwebremoting.impl.PropertyDescriptorProperty.getValue(PropertyDescriptorProperty.java:66) at org.directwebremoting.convert.BasicObjectConverter.convertOutbound(BasicObjectConverter.java:188) at org.directwebremoting.dwrp.DefaultConverterManager.convertOutbound(DefaultConverterManager.java:192) at org.directwebremoting.convert.BasicObjectConverter.convertOutbound(BasicObjectConverter.java:189) at org.directwebremoting.dwrp.DefaultConverterManager.convertOutbound(DefaultConverterManager.java:192) at org.directwebremoting.convert.CollectionConverter.convertOutbound(CollectionConverter.java:206) at org.directwebremoting.dwrp.DefaultConverterManager.convertOutbound(DefaultConverterManager.java:192) at org.directwebremoting.extend.ScriptBufferUtil.createOutput(ScriptBufferUtil.java:56) at org.directwebremoting.dwrp.BaseCallMarshaller$CallScriptConduit.addScript(BaseCallMarshaller.java:501) at org.directwebremoting.extend.EnginePrivate.remoteHandleCallback(EnginePrivate.java:56) at org.directwebremoting.dwrp.BaseCallMarshaller.marshallOutbound(BaseCallMarshaller.java:328) at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:53) at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101) at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Caused by: org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:56) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158) at com.clan.model.user.UserPowerTeamModel$$EnhancerByCGLIB$$d6c877f1.getUserPowerTeamName(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.directwebremoting.impl.PropertyDescriptorProperty.getValue(PropertyDescriptorProperty.java:62) ... 29 more |
|
返回顶楼 | |
发表时间:2006-12-28
open session in view
|
|
返回顶楼 | |
发表时间:2006-12-28
有人碰到过同样的问题吗?我用的dwr2.0
|
|
返回顶楼 | |
发表时间:2006-12-28
我发到DWR里的帖子怎么跑到入门来了!
|
|
返回顶楼 | |
发表时间:2006-12-30
在映射文件里设置 lazy=fasle,,默认为true的
|
|
返回顶楼 | |
发表时间:2006-12-30
主要问题是open session in view的问题,用dwr请求返回的时候并没有session打开在表现层(因为打开session的filter并没有被调用,这是使用xmlhttprequest导致的),所以要不你就用设置fetchmode来一次性把需要的UserPowerTeamModel拿出来,要不就把lazy设置成false(但是不推荐这样做,因为改hbm配置文件会影响全局),还有就是写hsql,用left join fetch来得到UserPowerTeamModel
|
|
返回顶楼 | |
发表时间:2007-01-04
问题解决了,但感觉这样作不太好!
|
|
返回顶楼 | |