[1.5.4] Widget Page Error Solved

Hi Luis, Guys…

I need your opinion here…

Running: Railo 4.1.0.011 (Bleeding Edge)
Coldbox 3.6 Development Edge
ContentBox 1.5.4

Everytime I was trying to access my Widgets page from Admin / Look & Feel / Widgets I was geeting the error: No matching Method/Function for String.getPluginName() found

This morning I open the index.cfm inside widgets views in admin module and start dumping variables to see what do I get in return, all of them work, if I dumped “p” I could see the function “getPluginName” in there, but some how Railo (I guess) simply didn’t know how to access it or how to treat it… what ever, in return giving me some kind of a string error. So the way I solve this is to surround all of the “p.function()” in quotes, and they work now.

Before: #p.function()# / Returns errors
After: “#p.function()#” / Returns value

Thanks in advance.

Felipe Serrano

Yes there is a fix coming for this very soon, I have provided Luis the patch needed to fix that.

The problem is that you have either bad widgets, widgets that are not written correctly or in my case you have rename one of your widgets like this

widgetName.cfc1

One would think that this should not be included in the directoryList, but it is good to know that this is also happening on Railo as well as I have seen this on ColdFusion 10 as well.

Anyway if you want me to provide the same patch that I gave Luis, to see if it fixes your issue. Let me know.

O sh…t

I guess I post to soon… but maybe you guys can now enlight me…
Now it seems that CFOUTPUT is not taking any effect:

When I access my Widgets apge it displays all of the widgets, but instead the name and description it shows the name of the function, I guess this is because I surround it in quotes and convert into string each value.

Sorry to wast your time reading this stupid post…

I guess I was missing some caffeine.

I miss place the quotes: #"…"# instead of “##”, now I get back yo my original state: No matching Method/Function for String.getPluginName() found

Thank you Andrew…

I get a little confused with my recent posts, I’ll keep tuned to this.

Thank you for your time and attention

Felipe Serrano

Can you paste in that whole block of code? You didn’t tell us what file or line number you’re working with.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Brad, do you ever sleep? :slight_smile:

I did a few updates in Railo and Coldbox just to make sure is not a version-system related.

Railo and Coldbox Latest Bleeding edge
CBox 1.5.4

The file index.cfm in admin views widgets

I’m able to dump #p# and see the function “getPluginName” inthere, but starting in line 87
all the #p.function()# gives the following error:

Error Messages: No matching Method/Function for String.getPluginName() found

So Im going to dig a little more on this.

Thanks

Hi Brad, do you ever sleep? :slight_smile:

Occasionally :slight_smile:

The file index.cfm in admin views widgets

That code is inside of a loop over prc.widgets. When you dump and abort you’re only dumping out the first one, but the error is probably in a later iteration of the loop.
Try either dumping out the entire prc.widgets query or put a try/catch around the erroring line and dump out the specific record that is erroring.

If I were to guess, the plugin column of the result set is supposed to be the actual instance of the CFC. There’s probably an error causing one of the CFCs to not be instantiated.

Ahh yes, line 150 of WidgetService.cfc wraps a try.catch around the creation of the plugin. If it fails, it logs a message in your error log, but it doesn’t actually rethrow the error or remove that widget from the result set. I would say we should tighten that up a little. It’s not bad that we’re catching the error, but we might as well have not caught it in the first place since we’re simply returning a corrupted query object that is just going to cause an error in the view.

I’m tempted to say that we should just throw the error right then in the widget service. The only problem is that is renders the entire widget interface useless if you have one bad widget. Perhaps we can still catch the error, but modify the result in such a way that the view can still render successfully, but will have a notice on the screen that lets you know what widgets didn’t load correctly. I like that idea best. Luis?

If I recall, Luis ran into this issue during one our ColdBox Developer Week sessions when he had a syntax error in a widget and the screen was erroring. let me dig up the ticket he created to enhance the error reporting.

… Brad goes and searches JIRA…

Ahh yes, here we go:
https://ortussolutions.atlassian.net/browse/CONTENTBOX-233

From the looks of the diff, that’s just what Luis did:
https://github.com/Ortus-Solutions/ContentBox/commit/6142249722586a55af2842dacbb0edf211c759c4?w=1#diff-0

Ahh, our minds must think alike. Ok, well that basically nullifies (or confirms?) most of what I typed above. I think the takeaway is you’ve got one bad widget in the mix and the next version of ContentBox will make it a lot easier to debug the bad one :slight_smile: For now, check your error log for the actual error. (You may need to configure an appender if there isn’t one set up in the main ColdBox config)

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Nice review Brad,

I’m creating two Widgets and both of them seems to be wotking on the site side. When widgets seems to be working, is there some kind of setting that makes the admin crash?

I’ll start digging on your suggestions, thanks again.

Felipe Serrano

Felipe,

The changes Brad is talking about is the solution that I came up with to fix the problem, Luis just went a bit further and added logging to it.

But as stated before, which Brad has also ignored. Is that in my case, the loop Brad speaks about.was also including files that CF can’t process like myfilename.cfc1 in that directory.

In your case you may have a widget that is not extending the right component.

Apparently :slight_smile: What’s in the log file? Alternatively, you can put a rethrow in the try catch in the WidgetService to see the exact error that’s happening.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thank you Andrew, let me dig into that and see which widget might be creating a conflict. :wink:

Thank you too Brad, you guys rocks!.. I’ll post what ever I find about this :)…

I also, updated in the latest build, better debugging for this

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Ok guys,

If I dump the: “prc.widgets” at the last two places my two Widgets appear, but… the plugin column is empty in both cases. This is what Andrew mention about not being extended I think.
In both widgets components I have or try to extend them like this: component extends=“contentbox.model.ui.BaseWidget”{…}

Thanks again