What's causing Element FW is undefined in a Java object of type class [Ljava.lang.String;

607 views
Skip to first unread message

John

unread,
Jul 1, 2011, 2:11:16 PM7/1/11
to framework-one
In Application.cfc I am trying to check security at the beginning of
the request:

<cffunction name="setupRequest">
<cfset request.context.startTime = getTickCount()>
<cfinvoke component="controllers.security" method="authorize">
</cffunction>

Here is my security.cfc:

<cfcomponent>
<cfscript>
function init( fw ) {
variables.fw = fw;
}
function session(rc) {
// set up the user's session
session.auth = {};
session.auth.isLoggedIn = false;
session.auth.fullname = 'Guest';
}
function authorize(rc) {
// check to make sure the user is logged on
if ( not session.auth.isLoggedIn and
not listfindnocase( 'login', variables.fw.getSection() ) and
not listfindnocase( 'main.error',
variables.fw.getFullyQualifiedAction() ) ) {
variables.fw.redirect('default');
}
}
</cfscript>
</cfcomponent>

(Straight from somefw/1 sample code)

When I try to browse to http://localhost/admin/default I get the
following error:

An error occurred!
Action: admin.default
Error: Element FW is undefined in a Java object of type class
[Ljava.lang.String;.
Type: Expression
Details:

Here is my admin.cfc:

<cfcomponent>
<cfscript>
function init(fw) {
variables.fw = fw;
}
</cfscript>
<cffunction name="default" access="public">
<cfscript>
variables.fw.service("admin.default", "data");
</cfscript>
</cffunction>
</cfcomponent>

Any help would be appreciated.

Sean Corfield

unread,
Jul 1, 2011, 2:16:04 PM7/1/11
to framew...@googlegroups.com
On Fri, Jul 1, 2011 at 11:11 AM, John <jmclo...@nookind.com> wrote:
> In Application.cfc I am trying to check security at the beginning of
> the request:
>
> <cffunction name="setupRequest">
>        <cfset request.context.startTime = getTickCount()>
>        <cfinvoke component="controllers.security" method="authorize">

Don't use invoke. That creates an instance, calls the method, and
throws it away - without calling init()!

The "correct" thing to do in FW/1 is call controller(
"security.authorize" ) so that FW/1 handles the lifecycle.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

John

unread,
Jul 1, 2011, 2:23:49 PM7/1/11
to framework-one
Thanks!

On Jul 1, 2:16 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Fri, Jul 1, 2011 at 11:11 AM, John <jmclough...@nookind.com> wrote:
> > In Application.cfc I am trying to check security at the beginning of
> > the request:
>
> > <cffunction name="setupRequest">
> >        <cfset request.context.startTime = getTickCount()>
> >        <cfinvoke component="controllers.security" method="authorize">
>
> Don't use invoke. That creates an instance, calls the method, and
> throws it away - without calling init()!
>
> The "correct" thing to do in FW/1 is call controller(
> "security.authorize" ) so that FW/1 handles the lifecycle.
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
> World Singles, LLC. --http://worldsingles.com/
> Railo Technologies, Inc. --http://www.getrailo.com/
Reply all
Reply to author
Forward
0 new messages