Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 42419 invoked from network); 22 Dec 2007 02:54:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Dec 2007 02:54:09 -0000 Received: (qmail 25214 invoked by uid 500); 22 Dec 2007 02:53:57 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 25140 invoked by uid 500); 22 Dec 2007 02:53:57 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 25131 invoked by uid 99); 22 Dec 2007 02:53:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Dec 2007 18:53:57 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Dec 2007 02:53:52 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 044B871403F for ; Fri, 21 Dec 2007 18:53:43 -0800 (PST) Message-ID: <17349071.1198292023007.JavaMail.jira@brutus> Date: Fri, 21 Dec 2007 18:53:43 -0800 (PST) From: "eliot clingman (JIRA)" To: issues@commons.apache.org Subject: [jira] Created: (JXPATH-110) When JXPathContext.newContext(object) holds a collection of Hibernate proxy entities, and search performed, LazyInitializationException illegal access to loading collection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org When JXPathContext.newContext(object) holds a collection of Hibernate proxy entities, and search performed, LazyInitializationException illegal access to loading collection ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Key: JXPATH-110 URL: https://issues.apache.org/jira/browse/JXPATH-110 Project: Commons JXPath Issue Type: Bug Affects Versions: 1.2 Final Environment: Windows XP Professional, Java 5, Tomcat 5.5.20, hibernate-annotations 3.3.0.ga, hibernate core 3.2.2.ga, springframework 2.0.7 Reporter: eliot clingman In the O/R model The entity WirelessDevice has all its properties with fetch = FetchType.LAZY First, using annotation style Hibernate, I find all wirelessDevices (proxies) with a named query, with some but not all of the collection properties fetched. What this means is that a property xyz must be accessed from the wirelessDevice proxy as follows getXyz(), NOT by invoking xyz directly. Because accessing the latter way will result in the exception "LazyInitializationException: illegal access to loading collection." However, when getXyz() is invoked, the proxy will return the correct value (because it is attached to a live Hibernate session). FYI, here is the named Hibernate query: "select d from WirelessDevice d left join fetch d.marketData marketData left join fetch d.wirelessTechnologyTypes left join fetch d.anatomy anatomy left join fetch anatomy.geometry". Any way when I do the following in JxPath , a LazyInitializationException occurs presumable because properties are not being accessed via getters, but rather directly: JXPathContext context = JXPathContext.newContext(blah blah); Iterator i = context.iterate("/wirelessDevices[marketData/operators/address/countryType/regionType/id='8']"); HEre is the exact stack trace: org.hibernate.LazyInitializationException 2007-12-21 18:52:07,915 -- ERROR -- illegal access to loading collection org.hibernate.LazyInitializationException: illegal access to loading collection at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341) at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109) at org.hibernate.collection.PersistentBag.size(PersistentBag.java:225) at org.apache.commons.jxpath.util.ValueUtils.getLength(ValueUtils.java:141) at org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer.getLength(BeanPropertyPointer.java:196) at org.apache.commons.jxpath.ri.model.beans.PropertyIterator.getLength(PropertyIterator.java:295) at org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPositionIndividualProperty(PropertyIterator.java:148) at org.apache.commons.jxpath.ri.model.beans.PropertyIterator.setPosition(PropertyIterator.java:127) at org.apache.commons.jxpath.ri.axes.ChildContext.setPosition(ChildContext.java:106) at org.apache.commons.jxpath.ri.axes.ChildContext.nextNode(ChildContext.java:89) at org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:322) at org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:321) at org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:321) at org.apache.commons.jxpath.ri.EvalContext.nextSet(EvalContext.java:321) at org.apache.commons.jxpath.ri.EvalContext.performIteratorStep(EvalContext.java:159) at org.apache.commons.jxpath.ri.EvalContext.hasNext(EvalContext.java:118) at org.apache.commons.jxpath.ri.compiler.CoreOperationCompare.contains(CoreOperationCompare.java:86) at org.apache.commons.jxpath.ri.compiler.CoreOperationCompare.equal(CoreOperationCompare.java:73) at org.apache.commons.jxpath.ri.compiler.CoreOperationEqual.computeValue(CoreOperationEqual.java:33) at org.apache.commons.jxpath.ri.axes.PredicateContext.nextNode(PredicateContext.java:81) at org.apache.commons.jxpath.ri.EvalContext.performIteratorStep(EvalContext.java:155) at org.apache.commons.jxpath.ri.EvalContext.hasNext(EvalContext.java:118) at org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator.hasNext(Expression.java:128) at com.qualcomm.crowd.dao.InMemoryQueryEngine.findInMemoryEntitysByCriteria(InMemoryQueryEngine.java:50) at com.qualcomm.crowd.service.WirelessDeviceManagerImpl.findInMemoryWirelessDevicesByCriteria(WirelessDeviceManagerImpl.java:99) at com.qualcomm.crowd.service.WirelessDeviceManagerImpl.findOperatorAliasesByRegionType(WirelessDeviceManagerImpl.java:140) 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy40.findOperatorAliasesByRegionType(Unknown Source) at com.qualcomm.crowd.controller.WirelessDeviceController.findOperatorAliasesByRegionType(WirelessDeviceController.java:298) 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.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:446) at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:384) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy42.handleRequest(Unknown Source) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107) at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Unknown Source) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.