สอบถามเรื่อง grails กับ plugin flex ที่ใช้ spring BlazeDS จะำำำ error ถ้าใช้ lazy ครับ.

15 views
Skip to first unread message

tue2551

unread,
Mar 7, 2010, 9:13:05 PM3/7/10
to กลุ่มผู้ใช้เกรลส์ในไทย
สอบถามเรื่อง grails กับ plugin flex ที่ใช้ spring BlazeDS ทำงานฝั่ง
server ให้กับ flex...
...จะำำำ error ถ้าใช้ lazy กับ domain class ที่มีการเชื่อมกัน
...ตอนแรกผมนึกว่าเป็นเฉพาะที่เชื่อมแบบ hasMany แต่พอลองดูอีกทีเกิด
error หมดเลย
...ถ้ามีการเชื่อมไปหา domain class อื่น ครับ.
และผมต้องไป set ใน domain class ที่เชื่อมไป class อื่นให้ static
mapping = {classname lazy:false} ไว้ถึงจะไม่ error...
...เลยสงสัยว่าสาเหตุเกิดจาก ข้อจำักัดของ Sping BlazeDS หรือ hibernate
หรืออะไรจึงเกิด error นี้ครับ
...หรือพอจะมีแนวทางแก้ไขได้หรือเปล่าครับ.
ขอบคุณมากครับ

รายการ error ที่ขึ้นมาครับ.
-------------------------------------------
2553-03-08 08:54:33,612 [http-8080-3] ERROR
hibernate.LazyInitializationException - could not initialize proxy -
no Session
org.hibernate.LazyInitializationException: could not initialize proxy
- no Session
at
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:
86)
at
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:
140)
at
org.codehaus.groovy.grails.orm.hibernate.proxy.GroovyAwareJavassistLazyInitializer.invoke(GroovyAwareJavassistLazyInitializer.java:
211)
at prgww.department.DepartmentHead_$
$_javassist_53.getDepartmentSubs(DepartmentHead_$$_javassist_53.java)
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:597)
at flex.messaging.io.BeanProxy$BeanProperty.get(BeanProxy.java:
865)
at flex.messaging.io.BeanProxy.getBeanValue(BeanProxy.java:
217)
at flex.messaging.io.BeanProxy.getValue(BeanProxy.java:188)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:
572)
at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:
525)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:200)
at
flex.messaging.io.amf.Java15Amf3Output.writeObject(Java15Amf3Output.java:
58)
at
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:
250)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:
573)
at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:
525)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:200)
at
flex.messaging.io.amf.Java15Amf3Output.writeObject(Java15Amf3Output.java:
58)
at
flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:
250)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:
573)
at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:
525)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:200)
at
flex.messaging.io.amf.Java15Amf3Output.writeObject(Java15Amf3Output.java:
58)
at
flex.messaging.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:825)
at
flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:438)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:186)
at
flex.messaging.io.amf.Java15Amf3Output.writeObject(Java15Amf3Output.java:
58)
at
flex.messaging.io.ArrayCollection.writeExternal(ArrayCollection.java:
97)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:
563)
at
flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:
469)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:182)
at
flex.messaging.io.amf.Java15Amf3Output.writeObject(Java15Amf3Output.java:
58)
at
flex.messaging.messages.AbstractMessage.writeExternal(AbstractMessage.java:
353)
at
flex.messaging.messages.AsyncMessage.writeExternal(AsyncMessage.java:
140)
at
flex.messaging.messages.AcknowledgeMessage.writeExternal(AcknowledgeMessage.java:
93)
at
flex.messaging.messages.AcknowledgeMessageExt.writeExternal(AcknowledgeMessageExt.java:
55)
at
flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:
563)
at
flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:
525)
at
flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:112)
at
flex.messaging.io.amf.Java15Amf3Output.writeObject(Java15Amf3Output.java:
58)
at
flex.messaging.io.amf.Amf0Output.writeObject(Amf0Output.java:198)
at
flex.messaging.io.amf.Java15Amf0Output.writeObject(Java15Amf0Output.java:
69)
at
flex.messaging.io.amf.AmfMessageSerializer.writeObject(AmfMessageSerializer.java:
196)
at
flex.messaging.io.amf.AmfMessageSerializer.writeBody(AmfMessageSerializer.java:
186)
at
flex.messaging.io.amf.AmfMessageSerializer.writeMessage(AmfMessageSerializer.java:
142)
at
flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:
179)
at
flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:
278)
at
flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:
322)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:
820)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.processFilterChain(UrlMappingsFilter.java:
282)
at
org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:
211)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.obtainContent(GrailsPageFilter.java:
249)
at
org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:
140)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.doFilterInternal(GrailsReloadServletFilter.java:
101)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:
65)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:
63)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:
88)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:
76)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:
237)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:
167)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
849)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint
$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)

tue2551

unread,
Mar 31, 2010, 12:40:59 AM3/31/10
to กลุ่มผู้ใช้เกรลส์ในไทย
พอจะทราบวิธีแก้ไขว่า...
...ให้ไปใช้ dpHibernate แต่ไงผมคงใช้แบบเดิมไปก่อน
http://code.google.com/p/dphibernate/wiki/GettingStarted
...ไว้มีเวลาจะทดลองใช้ตัวนี้ดูอีกที
...ตอนนี้ยังต้องเรียนรู้เพิ่มอีกเยอะเลยครับ.
ขอบคุณครับ
Reply all
Reply to author
Forward
0 new messages