Openemm 2013 scriptaction issues

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

Openemm 2013 scriptaction issues

Postby vladi286 » Tue Feb 19, 2013 3:52 pm

Hi all,

I installed OpenEMM 2013 on a Gentoo 64 bits Linux machine. I compiled everything from scratch, following the installation pdf. Everything is working fine except scriptaction.

It looks like it is ignoring the #set ($scriptResult="1"). I setup a form with "$scriptResult true" for true and ""$scriptResult false" for false. Made an action just with #set ($scriptResult="1") and added it as a start action for the form. Setting $scriptResult to any value throw the form in the error state, even for 1.
After reading again the docs, searching in forum, etc, I deleted everything and started again from scratch, with the same result.
Next, keeping the database, I installed the old version OpenEMM 2011 which worked as expected out of the box!

Anyone any idea if it is a glitch of my 64 bit operating system or a bug? Running tomcat-6.0.36:6 and java sun jdk 1.6.0_31-b04.


Thanks in advance,
Vladi
vladi286
 
Posts: 3
Joined: Tue Feb 19, 2013 3:29 pm

Re: Openemm 2013 scriptaction issues

Postby maschoff » Tue Feb 19, 2013 5:37 pm

Hm, script actions are based on Velocity (JAR file "velocity-1.5.jar"), but we are not aware of 64 bit problems, in fact we use the software on 64 bit servers ourselves. Are you absolutely sure you have no typo in your code and did you check the logs for any Velocity related output?
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2140
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Openemm 2013 scriptaction issues

Postby vladi286 » Wed Feb 20, 2013 12:56 am

Hi,
below the logs for velocity:
OpenEMM 2011 with scriptaction working:
2013-02-20 01:43:27,871 - Velocimacro : initialization starting.
2013-02-20 01:43:27,871 - Velocimacro : adding VMs from VM library template : VM_global_library.vm
2013-02-20 01:43:27,874 - ResourceManager : unable to find resource 'VM_global_library.vm' in any resource loader.
2013-02-20 01:43:27,874 - Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
2013-02-20 01:43:27,874 - Velocimacro : VM library template macro registration complete.
2013-02-20 01:43:27,874 - Velocimacro : allowInline = true : VMs can be defined inline in templates
2013-02-20 01:43:27,874 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
2013-02-20 01:43:27,874 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
2013-02-20 01:43:27,874 - Velocimacro : messages on : VM system will output logging messages
2013-02-20 01:43:27,874 - Velocimacro : autoload off : VM system will not automatically reload global library macros
2013-02-20 01:43:27,874 - Velocimacro : initialization complete.
2013-02-20 01:43:27,874 - Velocity successfully started.


And OpenEMM-2013, not working:
2013-02-19 19:55:31,020 - Velocimacro : initialization starting.
2013-02-19 19:55:31,020 - Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
2013-02-19 19:55:31,021 - Velocimacro : Default library not found.
2013-02-19 19:55:31,021 - Velocimacro : allowInline = true : VMs can be defined inline in templates
2013-02-19 19:55:31,021 - Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
2013-02-19 19:55:31,021 - Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
2013-02-19 19:55:31,021 - Velocimacro : autoload off : VM system will not automatically reload global library macros
2013-02-19 19:55:31,021 - Velocimacro : Velocimacro : initialization complete.
2013-02-19 19:55:31,021 - RuntimeInstance successfully initialized.

In red is what I found as a significative difference.

Vladi
vladi286
 
Posts: 3
Joined: Tue Feb 19, 2013 3:29 pm

Re: Openemm 2013 scriptaction issues

Postby vladi286 » Wed Feb 20, 2013 10:53 am

Hi again,

I looked in 2011 and 2013 versions of ExecuteScript.class and I took out the extra check of parameter error, recompiled and it works now.
However I think the check was there with a purpose ...

So the line 112
if(params.get("scriptResult").equals("1") && params.get("errors") == null) {
becomes:
if(params.get("scriptResult").equals("1")){

Now I did not know what kind of variable is "error", but I suppose is an array of strings, and I think that it is not null but empty.
Comparing it with "{}", works ( I do not know enough Java to find a more elegant test).
if(params.get("scriptResult").equals("1") && params.get("errors") == "{}") {

I also think that in the end the velocity logs contains only harmless warnings unrelated to this issue.

Should I leave the if clause like original or not?
Vladi
vladi286
 
Posts: 3
Joined: Tue Feb 19, 2013 3:29 pm

Re: Openemm 2013 scriptaction issues

Postby maschoff » Wed Feb 20, 2013 11:34 am

Part 1 of my answer:

OpenEMM 2011 used velocity-1.4.jar, OpenEMM 2011 uses velocity-1.5.jar - maybe the JAR update is the reason for the changed behaviour?

That Velocity does not find default library "VM_global_library.vm" is just for information, but not a problem. We get this message, too, and the file is not needed. See here for more info:

http://stackoverflow.com/questions/5313 ... library-vm
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2140
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Openemm 2013 scriptaction issues

Postby maschoff » Tue Feb 26, 2013 8:18 am

Part 2 of my answer:

We looked into this issue: The code line has changed from OpenEMM 2011 to 2013 when we introduced Velocity logging and your change changed this line back to the 2011 version. But it looks like the logging was not implemented correctly leading to parameter "errors" beeing false all the time. So, your change is correct for now, but we may have to provide a bugfix to fix the logging. Thanks for diving into the source code and for pointing out this problem!
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2140
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Openemm 2013 scriptaction issues

Postby maschoff » Tue Feb 26, 2013 10:11 am

OK, this would be the bugfix:
Code: Select all
if(params.get("scriptResult").equals("1") && ((ActionErrors) params.get("errors")).isEmpty() ) {

Could you please try if this line works for you?
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2140
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Openemm 2013 scriptaction issues

Postby pixus » Mon Mar 11, 2013 11:20 am

I updated ExecuteScript.class with the one in your bugfixes (file modified 2013-03-07) but the problem still exists:
An action with simply:
Code: Select all
#set($scriptResult="1")


produce Error Form
pixus
 
Posts: 10
Joined: Tue Dec 04, 2012 4:53 pm

Re: Openemm 2013 scriptaction issues

Postby maschoff » Thu Mar 14, 2013 5:53 pm

I tried the bugfix myself. Before the fix I could reproduce your problem, after applying the fix I could not. Did you restart OpenEMM after replacing the class file?
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2140
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Openemm 2013 scriptaction issues

Postby pixus » Mon Jun 03, 2013 9:18 am

Sorry, it was my fault, your bugfix was sufficient to solve the problem.
Thanks (even if I'm a little late :) )
pixus
 
Posts: 10
Joined: Tue Dec 04, 2012 4:53 pm

Re: Openemm 2013 scriptaction issues

Postby maschoff » Mon Jun 03, 2013 9:23 am

Fine, thanks for your feedback!
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2140
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany


Return to Using OpenEMM

Who is online

Users browsing this forum: No registered users and 2 guests

cron