Tutorial :Model-Glue and Railo Application.cfc


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 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!!!


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.


In Railo 3.1 final (or one of the following patches) we will have a compatibility tab in the Railo admin which allows you to set passby value as the default behavior in Railo. You can then enable this setting and therefore get Transfer and ModelGlue III to run nicely. Just a sidenote here is that the passby attribute does not break existing CF code. It just gets treated as CFARGUMENT metadata.

We honestly see this as a bug in Coldfusion but due to the compatibility requirements we will adapt this behavior and make it optional in the Railo Administrator.

Gert Franz Railo Open Source


I would log this as a bug in the railo bug tracker. They are usually pretty good at getting these bugs resolved so that popular coldfusion frameworks work on their platform.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »