Unable to debug groovy script called by screen widget

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to debug groovy script called by screen widget

Leon-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacques Le Roux
Administrator
I have any solutions, but I'm curious to know which plugin you are using...

Jacques

From: "Leon" <[hidden email]>

> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
> called internally via <script> tag in screen widget. But if I call this
> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
> paused at that point as expected.
>
> Is this the side effect of script refactoring? I remeber it worked very well
> some days ago.
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Leon-2
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacques Le Roux
Administrator
Thanks,

I had removed the Groovy plugin from my environment because it was giving me more pain than help. Since then I have updated Eclipse
from 3.6.2 to 3.7.2 and tried it again. I must say most of the time I simply use println for Groovy debugging (no IDE need). But in
some case the debugger can help indeed.

For your question I guess you are right. It's certainly a side effect of the refactoring. At least I can't see anything else...
There is currently a mini-language overhaul effort. The screen actions and minilanguage should have the same behaviour in future,
notably the set action. So hopefully then you should not have  to use GroovyUtil.runScriptAtLocation

Jacques

From: "Leon" <[hidden email]>
> hi, Jacqies.
>
> I'm using latest groovy plugin which version is 2.6.1, groovy runtime plugin
> 1.7.10 and 1.8.6.
>
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4536704.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacopo Cappellato-4
In reply to this post by Leon-2
Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able to commit a fix probably today).
For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to fix, otherwise I think we should switch back to a Groovy specific invoker.

Jacopo

On Apr 5, 2012, at 6:18 AM, Leon wrote:

> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
> called internally via <script> tag in screen widget. But if I call this
> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
> paused at that point as expected.
>
> Is this the side effect of script refactoring? I remeber it worked very well
> some days ago.
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacques Le Roux
Administrator
From: "Jacopo Cappellato" <[hidden email]>
> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able to
> commit a fix probably today).
> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to fix,
> otherwise I think we should switch back to a Groovy specific invoker.

Yes we could still have JSR 223 but have this Groovy specific invoker: every one would be happy :o)

Jacques

> Jacopo
>
> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>
>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>> called internally via <script> tag in screen widget. But if I call this
>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>> paused at that point as expected.
>>
>> Is this the side effect of script refactoring? I remeber it worked very well
>> some days ago.
>>
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacopo Cappellato-4
In reply to this post by Jacopo Cappellato-4
You can now use a debugger for Groovy services and events; for details see rev.  1325253.
This is not available for data preparation scripts (screens).

Jacopo

On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:

> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able to commit a fix probably today).
> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to fix, otherwise I think we should switch back to a Groovy specific invoker.
>
> Jacopo
>
> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>
>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>> called internally via <script> tag in screen widget. But if I call this
>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>> paused at that point as expected.
>>
>> Is this the side effect of script refactoring? I remeber it worked very well
>> some days ago.
>>
>> --
>> View this message in context: http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacopo Cappellato-4
Leon, all,

until we find a good solution I can share the following patch/tweak for data preparation scripts (screen, forms etc...):

Index: framework/base/src/org/ofbiz/base/util/ScriptUtil.java
===================================================================
--- framework/base/src/org/ofbiz/base/util/ScriptUtil.java (revision 1325649)
+++ framework/base/src/org/ofbiz/base/util/ScriptUtil.java (working copy)
@@ -336,6 +336,9 @@
      */
     public static Object executeScript(String filePath, String functionName, Map<String, Object> context, Object[] args) {
         try {
+            if (filePath.endsWith(".groovy")) {
+                return GroovyUtil.runScriptAtLocation(filePath, context);
+            }
             return executeScript(filePath, functionName, createScriptContext(context), args);
         } catch (Exception e) {
             String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();


This will enable the ability to debug the code because it will execute groovy data preparation scripts using GroovyUtil rather than JSR223

Adrian, any idea on how we could improve this in a nicer way to address the issue?

Jacopo


On Apr 12, 2012, at 3:47 PM, Jacopo Cappellato wrote:

> You can now use a debugger for Groovy services and events; for details see rev.  1325253.
> This is not available for data preparation scripts (screens).
>
> Jacopo
>
> On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:
>
>> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
>> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able to commit a fix probably today).
>> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to fix, otherwise I think we should switch back to a Groovy specific invoker.
>>
>> Jacopo
>>
>> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>>
>>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>>> called internally via <script> tag in screen widget. But if I call this
>>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>>> paused at that point as expected.
>>>
>>> Is this the side effect of script refactoring? I remeber it worked very well
>>> some days ago.
>>>
>>> --
>>> View this message in context: http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Adrian Crum-3
That looks fine to me. We can leave it that way until the problem is
solved in Groovy.

-Adrian

On 4/13/2012 10:40 AM, Jacopo Cappellato wrote:

> Leon, all,
>
> until we find a good solution I can share the following patch/tweak for data preparation scripts (screen, forms etc...):
>
> Index: framework/base/src/org/ofbiz/base/util/ScriptUtil.java
> ===================================================================
> --- framework/base/src/org/ofbiz/base/util/ScriptUtil.java (revision 1325649)
> +++ framework/base/src/org/ofbiz/base/util/ScriptUtil.java (working copy)
> @@ -336,6 +336,9 @@
>        */
>       public static Object executeScript(String filePath, String functionName, Map<String, Object>  context, Object[] args) {
>           try {
> +            if (filePath.endsWith(".groovy")) {
> +                return GroovyUtil.runScriptAtLocation(filePath, context);
> +            }
>               return executeScript(filePath, functionName, createScriptContext(context), args);
>           } catch (Exception e) {
>               String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();
>
>
> This will enable the ability to debug the code because it will execute groovy data preparation scripts using GroovyUtil rather than JSR223
>
> Adrian, any idea on how we could improve this in a nicer way to address the issue?
>
> Jacopo
>
>
> On Apr 12, 2012, at 3:47 PM, Jacopo Cappellato wrote:
>
>> You can now use a debugger for Groovy services and events; for details see rev.  1325253.
>> This is not available for data preparation scripts (screens).
>>
>> Jacopo
>>
>> On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:
>>
>>> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
>>> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able to commit a fix probably today).
>>> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to fix, otherwise I think we should switch back to a Groovy specific invoker.
>>>
>>> Jacopo
>>>
>>> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>>>
>>>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>>>> called internally via<script>  tag in screen widget. But if I call this
>>>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>>>> paused at that point as expected.
>>>>
>>>> Is this the side effect of script refactoring? I remeber it worked very well
>>>> some days ago.
>>>>
>>>> --
>>>> View this message in context: http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacques Le Roux
Administrator
+1

Jacques

From: "Adrian Crum" <[hidden email]>

> That looks fine to me. We can leave it that way until the problem is solved in Groovy.
>
> -Adrian
>
> On 4/13/2012 10:40 AM, Jacopo Cappellato wrote:
>> Leon, all,
>>
>> until we find a good solution I can share the following patch/tweak for data preparation scripts (screen, forms etc...):
>>
>> Index: framework/base/src/org/ofbiz/base/util/ScriptUtil.java
>> ===================================================================
>> --- framework/base/src/org/ofbiz/base/util/ScriptUtil.java (revision 1325649)
>> +++ framework/base/src/org/ofbiz/base/util/ScriptUtil.java (working copy)
>> @@ -336,6 +336,9 @@
>>        */
>>       public static Object executeScript(String filePath, String functionName, Map<String, Object>  context, Object[] args) {
>>           try {
>> +            if (filePath.endsWith(".groovy")) {
>> +                return GroovyUtil.runScriptAtLocation(filePath, context);
>> +            }
>>               return executeScript(filePath, functionName, createScriptContext(context), args);
>>           } catch (Exception e) {
>>               String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();
>>
>>
>> This will enable the ability to debug the code because it will execute groovy data preparation scripts using GroovyUtil rather
>> than JSR223
>>
>> Adrian, any idea on how we could improve this in a nicer way to address the issue?
>>
>> Jacopo
>>
>>
>> On Apr 12, 2012, at 3:47 PM, Jacopo Cappellato wrote:
>>
>>> You can now use a debugger for Groovy services and events; for details see rev.  1325253.
>>> This is not available for data preparation scripts (screens).
>>>
>>> Jacopo
>>>
>>> On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:
>>>
>>>> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
>>>> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able
>>>> to commit a fix probably today).
>>>> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to
>>>> fix, otherwise I think we should switch back to a Groovy specific invoker.
>>>>
>>>> Jacopo
>>>>
>>>> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>>>>
>>>>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>>>>> called internally via<script>  tag in screen widget. But if I call this
>>>>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>>>>> paused at that point as expected.
>>>>>
>>>>> Is this the side effect of script refactoring? I remeber it worked very well
>>>>> some days ago.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacques Le Roux
Administrator
I tried the trick today. I was able to put breakpoints in groovy but was not able to see variables in debug mode. Is there a way to
do that?

Thanks

Jacques

From: "Jacques Le Roux" <[hidden email]>

> +1
>
> Jacques
>
> From: "Adrian Crum" <[hidden email]>
>> That looks fine to me. We can leave it that way until the problem is solved in Groovy.
>>
>> -Adrian
>>
>> On 4/13/2012 10:40 AM, Jacopo Cappellato wrote:
>>> Leon, all,
>>>
>>> until we find a good solution I can share the following patch/tweak for data preparation scripts (screen, forms etc...):
>>>
>>> Index: framework/base/src/org/ofbiz/base/util/ScriptUtil.java
>>> ===================================================================
>>> --- framework/base/src/org/ofbiz/base/util/ScriptUtil.java (revision 1325649)
>>> +++ framework/base/src/org/ofbiz/base/util/ScriptUtil.java (working copy)
>>> @@ -336,6 +336,9 @@
>>>        */
>>>       public static Object executeScript(String filePath, String functionName, Map<String, Object>  context, Object[] args) {
>>>           try {
>>> +            if (filePath.endsWith(".groovy")) {
>>> +                return GroovyUtil.runScriptAtLocation(filePath, context);
>>> +            }
>>>               return executeScript(filePath, functionName, createScriptContext(context), args);
>>>           } catch (Exception e) {
>>>               String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();
>>>
>>>
>>> This will enable the ability to debug the code because it will execute groovy data preparation scripts using GroovyUtil rather
>>> than JSR223
>>>
>>> Adrian, any idea on how we could improve this in a nicer way to address the issue?
>>>
>>> Jacopo
>>>
>>>
>>> On Apr 12, 2012, at 3:47 PM, Jacopo Cappellato wrote:
>>>
>>>> You can now use a debugger for Groovy services and events; for details see rev.  1325253.
>>>> This is not available for data preparation scripts (screens).
>>>>
>>>> Jacopo
>>>>
>>>> On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:
>>>>
>>>>> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
>>>>> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be
>>>>> able to commit a fix probably today).
>>>>> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to
>>>>> fix, otherwise I think we should switch back to a Groovy specific invoker.
>>>>>
>>>>> Jacopo
>>>>>
>>>>> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>>>>>
>>>>>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>>>>>> called internally via<script>  tag in screen widget. But if I call this
>>>>>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>>>>>> paused at that point as expected.
>>>>>>
>>>>>> Is this the side effect of script refactoring? I remeber it worked very well
>>>>>> some days ago.
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacopo Cappellato-4
Jacques,

please confirm that you applied the patch I shared in this thread.
Are you using Eclipse? I know that there are some config steps required before you can debug Groovy in Eclipse... I would suggest you search the web as they are not specific to OFBiz.

Let me know if you are able or not to resolve the issue.

Jacopo

On May 27, 2012, at 12:23 AM, Jacques Le Roux wrote:

> I tried the trick today. I was able to put breakpoints in groovy but was not able to see variables in debug mode. Is there a way to do that?
>
> Thanks
>
> Jacques
>
> From: "Jacques Le Roux" <[hidden email]>
>> +1
>>
>> Jacques
>>
>> From: "Adrian Crum" <[hidden email]>
>>> That looks fine to me. We can leave it that way until the problem is solved in Groovy.
>>>
>>> -Adrian
>>>
>>> On 4/13/2012 10:40 AM, Jacopo Cappellato wrote:
>>>> Leon, all,
>>>>
>>>> until we find a good solution I can share the following patch/tweak for data preparation scripts (screen, forms etc...):
>>>>
>>>> Index: framework/base/src/org/ofbiz/base/util/ScriptUtil.java
>>>> ===================================================================
>>>> --- framework/base/src/org/ofbiz/base/util/ScriptUtil.java (revision 1325649)
>>>> +++ framework/base/src/org/ofbiz/base/util/ScriptUtil.java (working copy)
>>>> @@ -336,6 +336,9 @@
>>>>       */
>>>>      public static Object executeScript(String filePath, String functionName, Map<String, Object>  context, Object[] args) {
>>>>          try {
>>>> +            if (filePath.endsWith(".groovy")) {
>>>> +                return GroovyUtil.runScriptAtLocation(filePath, context);
>>>> +            }
>>>>              return executeScript(filePath, functionName, createScriptContext(context), args);
>>>>          } catch (Exception e) {
>>>>              String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();
>>>>
>>>>
>>>> This will enable the ability to debug the code because it will execute groovy data preparation scripts using GroovyUtil rather than JSR223
>>>>
>>>> Adrian, any idea on how we could improve this in a nicer way to address the issue?
>>>>
>>>> Jacopo
>>>>
>>>>
>>>> On Apr 12, 2012, at 3:47 PM, Jacopo Cappellato wrote:
>>>>
>>>>> You can now use a debugger for Groovy services and events; for details see rev.  1325253.
>>>>> This is not available for data preparation scripts (screens).
>>>>>
>>>>> Jacopo
>>>>>
>>>>> On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:
>>>>>
>>>>>> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
>>>>>> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be able to commit a fix probably today).
>>>>>> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to fix, otherwise I think we should switch back to a Groovy specific invoker.
>>>>>>
>>>>>> Jacopo
>>>>>>
>>>>>> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>>>>>>
>>>>>>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>>>>>>> called internally via<script>  tag in screen widget. But if I call this
>>>>>>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>>>>>>> paused at that point as expected.
>>>>>>>
>>>>>>> Is this the side effect of script refactoring? I remeber it worked very well
>>>>>>> some days ago.
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context: http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacques Le Roux
Administrator
From: "Jacopo Cappellato" <[hidden email]>
> Jacques,
>
> please confirm that you applied the patch I shared in this thread.

Yes, that's what I called "tried the trick". I tried in standard and remote debug, it's the same.

I was able to stop on breakpoints and then step in code. I can't use "ctrl+shift+i" to evaluate expressions, nor use the Eclipse
Expressions tab. Also only a "this" variable is accessible in the Eclipse Variables tab. Its value is the name of the Groovy class.
It contains a pointer on the groovy file where the breakpoint is. From there I tried this morning to get to the variables (under
"this" there is a "variables" FastMap).You can see their content by looking down the variables Map. But it's tedious as you have
only key numbers for each entry and must open then one by one to find the variables and their values... println seems still the
best...

> Are you using Eclipse? I know that there are some config steps required before you can debug Groovy in Eclipse... I would suggest
> you search the web as they are not specific to OFBiz.
>
> Let me know if you are able or not to resolve the issue.

Yes Eclipse 3.7.2 (Indigo). I know IntelliJ is easier for Groovy. Actually, I already Googled for help, but did not find. I tried
again today, and found
http://groovy-eclipse-plugin.42567.n3.nabble.com/How-to-debug-embedding-groovy-with-Groovy-Eclipse-Plugin-td3258234.html . The
sentence "As you probably know, Groovy uses a metaobject protocol to dispatch all method invocations and field accesses."
corresponds to the issue. Then maybe STS is required, I will digg in later... if nobody beats me on it...

Thanks

Jacques

> Jacopo
>
> On May 27, 2012, at 12:23 AM, Jacques Le Roux wrote:
>
>> I tried the trick today. I was able to put breakpoints in groovy but was not able to see variables in debug mode. Is there a way
>> to do that?
>>
>> Thanks
>>
>> Jacques
>>
>> From: "Jacques Le Roux" <[hidden email]>
>>> +1
>>>
>>> Jacques
>>>
>>> From: "Adrian Crum" <[hidden email]>
>>>> That looks fine to me. We can leave it that way until the problem is solved in Groovy.
>>>>
>>>> -Adrian
>>>>
>>>> On 4/13/2012 10:40 AM, Jacopo Cappellato wrote:
>>>>> Leon, all,
>>>>>
>>>>> until we find a good solution I can share the following patch/tweak for data preparation scripts (screen, forms etc...):
>>>>>
>>>>> Index: framework/base/src/org/ofbiz/base/util/ScriptUtil.java
>>>>> ===================================================================
>>>>> --- framework/base/src/org/ofbiz/base/util/ScriptUtil.java (revision 1325649)
>>>>> +++ framework/base/src/org/ofbiz/base/util/ScriptUtil.java (working copy)
>>>>> @@ -336,6 +336,9 @@
>>>>>       */
>>>>>      public static Object executeScript(String filePath, String functionName, Map<String, Object>  context, Object[] args) {
>>>>>          try {
>>>>> +            if (filePath.endsWith(".groovy")) {
>>>>> +                return GroovyUtil.runScriptAtLocation(filePath, context);
>>>>> +            }
>>>>>              return executeScript(filePath, functionName, createScriptContext(context), args);
>>>>>          } catch (Exception e) {
>>>>>              String errMsg = "Error running script at location [" + filePath + "]: " + e.toString();
>>>>>
>>>>>
>>>>> This will enable the ability to debug the code because it will execute groovy data preparation scripts using GroovyUtil rather
>>>>> than JSR223
>>>>>
>>>>> Adrian, any idea on how we could improve this in a nicer way to address the issue?
>>>>>
>>>>> Jacopo
>>>>>
>>>>>
>>>>> On Apr 12, 2012, at 3:47 PM, Jacopo Cappellato wrote:
>>>>>
>>>>>> You can now use a debugger for Groovy services and events; for details see rev.  1325253.
>>>>>> This is not available for data preparation scripts (screens).
>>>>>>
>>>>>> Jacopo
>>>>>>
>>>>>> On Apr 12, 2012, at 10:11 AM, Jacopo Cappellato wrote:
>>>>>>
>>>>>>> Unfortunately yes, it is a very bad side effect of the switch to JSR 223.
>>>>>>> This also affects the events and services implemented in Groovy but for them I am working at a workaround now (I should be
>>>>>>> able to commit a fix probably today).
>>>>>>> For data preparation scripts... I didn't look at them deeply so I don't have a solution, but it is something we will have to
>>>>>>> fix, otherwise I think we should switch back to a Groovy specific invoker.
>>>>>>>
>>>>>>> Jacopo
>>>>>>>
>>>>>>> On Apr 5, 2012, at 6:18 AM, Leon wrote:
>>>>>>>
>>>>>>>> In eclipse, it doesn't work if I set breakpoint in the groovy script which is
>>>>>>>> called internally via<script>  tag in screen widget. But if I call this
>>>>>>>> script via "GroovyUtil.runScriptAtLocation" directly, then the execution is
>>>>>>>> paused at that point as expected.
>>>>>>>>
>>>>>>>> Is this the side effect of script refactoring? I remeber it worked very well
>>>>>>>> some days ago.
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://ofbiz.135035.n4.nabble.com/Unable-to-debug-groovy-script-called-by-screen-widget-tp4533949p4533949.html
>>>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Unable to debug groovy script called by screen widget

Jacopo Cappellato-4
On May 27, 2012, at 9:44 AM, Jacques Le Roux wrote:

> I was able to stop on breakpoints and then step in code.

well, if you were able to do this it means that the trick worked; I think that the limitations you are seeing are related to the eclipse plugin and I doubt there is anything we can do in Ofbiz.

Jacopo