[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-04-23 Thread Swapnil M Mane (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15255245#comment-15255245
 ] 

Swapnil M Mane commented on OFBIZ-6808:
---

Thanks [~jacques.le.roux]! :)
 

> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
>Assignee: Jacques Le Roux
> Fix For: 14.12.01, 15.12.01, 13.07.04
>
> Attachments: OFBIZ-6808.patch
>
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> {code}
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:763) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:210) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:89) 
> [ofbiz-webapp.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) 
> [servlet-api-3.0.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 
> [servlet-api-3.0.jar:?]
>  [java]   at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App

[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-04-21 Thread Swapnil M Mane (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15251695#comment-15251695
 ] 

Swapnil M Mane commented on OFBIZ-6808:
---

Thanks so much [~jacopoc] and [~jacques.le.roux] for sharing your thoughts! :)

> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
> Attachments: OFBIZ-6808.patch
>
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> {code}
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:763) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:210) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:89) 
> [ofbiz-webapp.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) 
> [servlet-api-3.0.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 
> [servlet-api-3.0.jar:?]
>  [java]   at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>  [tomcat-7.0.6

[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-04-21 Thread Jacques Le Roux (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15251686#comment-15251686
 ] 

Jacques Le Roux commented on OFBIZ-6808:


+1!

> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
> Attachments: OFBIZ-6808.patch
>
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> ---
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:763) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:210) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:89) 
> [ofbiz-webapp.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) 
> [servlet-api-3.0.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 
> [servlet-api-3.0.jar:?]
>  [java]   at 
> org.apache.catalina.core.ApplicationFi

[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-04-21 Thread Jacopo Cappellato (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15251659#comment-15251659
 ] 

Jacopo Cappellato commented on OFBIZ-6808:
--

[~swapnilmmane] thanks for the patch that looks good to me.
As regards the last 4 handlers, they are essentially not used by ootb code and 
I would probably postpone any effort of them.


> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
> Attachments: OFBIZ-6808.patch
>
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> ---
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:763) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:210) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:89) 
> [ofbiz-webapp.jar:?]
>  [java]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) 
> [ser

[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-04-16 Thread Swapnil M Mane (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244115#comment-15244115
 ] 

Swapnil M Mane commented on OFBIZ-6808:
---

Dear Jacopo and Jacques, thanks so much for such a detailed discussion :-) 

As per the suggestion above, 
We have created the patch for starting the transaction and committing it for 
the following handlers.

1.) GroovyEventHandler
2.) JavaEventHandler
3.) SimpleEventHandler

For the following handlers, there is already the support of transaction

1.) ServiceEventHandle
2.) ServiceMultiEventHandler
3.) ServiceStreamHandler


For the following handler, we need your thoughts, should we also provide 
transaction support for these handlers as well

1.) SOAPEventHandler
2.) XmlRpcEventHandler
3.) RomeEventHandler
4.) ScriptEventHandler

We request you to kindly review the patch and let us know your kind feedback.

> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
> Attachments: OFBIZ-6808.patch
>
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> ---
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.weba

[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-02-22 Thread Jacques Le Roux (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15156792#comment-15156792
 ] 

Jacques Le Roux commented on OFBIZ-6808:


Even if I wonder why this was not done in 1st place, I see no reasons not to do 
so. I guess initially events were not intended to change things hence no need 
for transactions. But indeed, at least, a find should be allowed.

I just note here that we should then slightly change the last point at 
https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-DifferenceBetweenEventAndService

> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> ---
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:763) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:210) 
> [ofbiz

[jira] [Commented] (OFBIZ-6808) Calling Groovy as Event generates error when delegator.find used

2016-02-22 Thread Jacopo Cappellato (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-6808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15156735#comment-15156735
 ] 

Jacopo Cappellato commented on OFBIZ-6808:
--

The behavior reported in this ticket by [~swapnilmmane] is not limited to the 
implementation of the GroovyEventHandler but it is instead consistent with all 
the implementation of *EventHandlers in OFBiz: by default, no transaction is 
started by the framework when an event is executed.
The solution proposed in this ticket is a valid one, but if we implement this 
we should implement the same in the other EventHandler implementations 
currently used (JavaEventHandler, SimpleEventHandler...)

I would love to hear others' feedback before proceeding in this direction.



> Calling Groovy as Event generates error when delegator.find used
> 
>
> Key: OFBIZ-6808
> URL: https://issues.apache.org/jira/browse/OFBIZ-6808
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Upcoming Branch
>Reporter: Swapnil M Mane
>
> We are using Groovy as event in the controller request, everything works fine 
> for us but as we used delegator.find()
> it generates the following error
> ---
> ERROR: Cannot do a find that returns an EntityListIterator with no 
> transaction in place. Wrap this call in a transaction.
>  [java] java.lang.Exception: Stack Trace
>  [java]   at 
> org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) 
> [ofbiz-entity.jar:?]
>  [java]   at org.ofbiz.entity.Delegator$find.call(Unknown Source) 
> [ofbiz-entity.jar:?]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
>  [java]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_60]
>  [java]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_60]
>  [java]   at java.lang.reflect.Method.invoke(Method.java:497) 
> ~[?:1.8.0_60]
>  [java]   at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:423) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at groovy.lang.Closure.call(Closure.java:439) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1324)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1296)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at org.codehaus.groovy.runtime.dgm$147.invoke(Unknown Source) 
> [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>  [groovy-all-2.2.1.jar:2.2.1]
>  [java]   at ProductInventory.run(ProductInventory.groovy:11) [script:?]
>  [java]   at 
> org.ofbiz.webapp.event.GroovyEventHandler.invoke(GroovyEventHandler.java:107) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:763) 
> [ofbiz-webapp.jar:?]
>  [java]   at 
> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:476)