If I understand your problem, I am surprised that this code works on Railo. I do not think it should be.
The problem with this code is:
var func = variables.testObj[ arguments.missingMethodName ]; return func( argumentCollection = arguments.missingMethodArguments );
Here you pull the getX() function from variables.testObj and run it in the context of your TestHelper instance. And this object does not have `variables.x. Hence the error.
You need to put the func link in variables.testObj , and not get getX out of it. So like this:
var variables.testObj.func = variables.testObj[ arguments.missingMethodName ]; return variables.testObj.func( argumentCollection = arguments.missingMethodArguments );
So you are using func() (your proxy for getX() ) in the correct context, so it will see variabales.x.
Given this situation, this method should not work on Railo (based on the information you provided us with all the necessary information, one way or another).
source share