R – Model-Glue and Railo Application.cfc

application.cfccoldfusionmodel-gluerailo

I am trying to launch a test MG app on Railo and am hitting a snag.
When I visit the MG app I get:

Railo 3.1.0.012 Error (Java.lang.classformaterror)
Message         Invalid index 16 in LocalVariableTable in class file
application_cfc$cf
Java Stacktrace

Invalid index 16 in LocalVariableTable in class file application_cfc
$cf
        at java.lang.ClassLoader.defineClass1(Native Method):-2
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621):621
        at java.lang.ClassLoader.defineClass(ClassLoader.java:401):401
        at railo.commons.lang.PhysicalClassLoader.loadClass
(PhysicalClassLoader.java:116):116
        at railo.runtime.PageSourceImpl.compile(PageSourceImpl.java:225):225
        at railo.runtime.PageSourceImpl.loadPhysical(PageSourceImpl.java:167):
167
        at railo.runtime.PageSourceImpl.loadPage(PageSourceImpl.java:102):102

I have done a bit of testing and found that when the following in
Application.cfc happens:

<cfloop from="1" to="#arrayLen(mgInstances)#" index="i">
    <cfset mgInstances[i].executeEvent(arguments.eventName, values) />
</cfloop>

I get the error. If I remove this part I start getting:

Message         Application context not loaded!
Error Code
org.coldspringframework.webApplicationContextProxy.cantLoadApplicationContext

So, I'm guessing that in Application.cfc, the line:

<cfset var mgInstances = createObject
    ("component","ModelGlue.Util.ModelGlueFrameworkLocator").findInScope
    (appScope) />

Is failing.

Is anyone else having issues with this? Any solutions? Thanks!!!

Best Solution

One big thing to consider: through the history of the CFML language it has always been the standard behavior to pass arrays by value, not by reference. This has been something that has been in place since the earliest days of the language, contrary to the behavior of many other programming languages, but since when has CF had any problem defying convention? (arrays beginning their numbering with 1 instead of 0, for instance).

Railo, on the other hand, passes arrays by reference, not by value, as its default behavior. You can see how this could cause issues with other frameworks. In order to fix this compatibility issue, Railo allows you to use the 'passby' attribute of the cfargument tag to designate any param as by value or reference. Like so:

<cfargument name="myArray" type="array" required="true" passby="value" />

Of course, this means that some frameworks are going to have to be rewritten for Railo, since this breaks full compatibility with Adobe ColdFusion.

Transfer ORM is completely broken on Railo right now as well as a result of this particular issue, as well as other glitches in behavior between Railo and CF8. It is not unlikely that Model Glue and other existing CF frameworks will suffer similar glitches.

Related Question