• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Instantiating CFC as application variable

Contributor ,
Oct 17, 2007 Oct 17, 2007

Copy link to clipboard

Copied

I have a CFC (obviously) that works fine if I instantiate it during onRequest. But since everyone uses it a lot, I thought it would be better to have it as an APPLICATION.CFC instead.

However now I get the error
Element USER is undefined in a Java object of type class [Ljava.lang.String; referenced as

This happens with this code :
TOPICS
Advanced techniques

Views

376

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Oct 18, 2007 Oct 18, 2007
If you have added the object instantiation to OnApplicationStart() to an already running application then it will not exist in the application scope until the application is restarted. You can call OnApplicationStart() programatically from within your Application.cfc or you can just restart coldfusion.

Votes

Translate

Translate
Engaged ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

If you have added the object instantiation to OnApplicationStart() to an already running application then it will not exist in the application scope until the application is restarted. You can call OnApplicationStart() programatically from within your Application.cfc or you can just restart coldfusion.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

> However now I get the error
> Element USER is undefined in a Java object of type class [Ljava.lang.String;
> referenced as

> application.user.authenticate(email='#form.email#',password='#form.password#');

Can you post the code that creates application.user?

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

LATEST
Thanx Stressed. You hit me with a "DOH!" moment. lol
I have a "reinit" in my application.cfc file which does exactly what you said about calling the onApplicationStart(). BUT I decided to check it again and make sure it was okay and what to my amazement should I find? Some evil code demon had put it INSIDE the onApplicationStart function.

So, moving it outside of the function where it should be, it now works fine.

*banging head against wall*

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation