Issues with Wirebox and getting Application specific information

This is something that has been bothering me for nearly 4 years now, which to date has been no answer from here or even Adobe. This is specifically an issue that really needs to have a solution.

In the past I am seeing errors in my logs that look like this

datasource is not defined or null pointer errors.

I have tracked this back to ColdBox in the following location.

/**

  • Get the default application datasource
    */
    public string function getDefaultDatasource(){
    // get application metadata
    if( listFirst(server.coldfusion.productVersion,",") gte 10 ){
    var settings = getApplicationMetadata();
    }
    else{
    var settings = application.getApplicationSettings();
    }

// check orm settings first
if( structKeyExists( settings,“ormsettings”) AND structKeyExists(settings.ormsettings,“datasource”)){
return settings.ormsettings.datasource;
}
// else default to app datasource
return settings.datasource;
};

The actual error is coming from ColdFusion on the lines where it is setting the variable settings, so this is not a specific version of ColdFusion. But when you look deeper into the actual error, it appears to be an uncaught exception in the actual ColdFusion application itself.

If you read the Adobe ColdFusion documentation, it is supposed to return something always. So why it is returning NULL at times is really something that I am getting no love with from either Luis, Brad or any of the team from Ortis Solutions. Nor am I getting any love from Adobe when it comes to this error either.

Anyway, I have now reached another issue that seems to be totally related to this problem and WireBox itself. The actual error is this.

getLogoutUrl},RETURNTYPE={String},PARAMETERS={[Ljava.lang.Object;@42b4a8c1}}, {ACCESS={public},NAME={isEnabled},RETURNTYPE={Boolean},PARAMETERS={[Ljava.lang.Object;@62b3391d}}]},HINT={A library to build apps on Facebook.com and social websites with Facebook Connect},PATH={D:\home\somedomain\wwwroot\modules\cronus-facebook\model\sdk\FacebookApp.cfc},INHERITANCETRAIL={[modules.cronus-facebook.model.sdk.FacebookApp, modules.cronus-facebook.model.sdk.FacebookBase, WEB-INF.cftags.component]},TYPE={component}}},CONSTRUCTOR={init},METHOD={},ASPECT={false}}, Stacktrace: coldfusion.runtime.CustomException: Persistent scope is not available (by default session scope, so you must enable session management for this app) at coldfusion.tagext.lang.ThrowTag.doStartTag(ThrowTag.java:142) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2799) at

What makes this annoying is that this usually only appears when the Application has been reloaded, but there are times where the server has to be restarted for it to go. What is causing this is not known, at least not by me anyway.

This is a Facebook SDK, that is being setup like this.

binder.map(“facebookSDK@fbModule”).to("#moduleMapping#.model.sdk.FacebookApp")
.initWith( appId = variables.settings.facebook.APP_ID, secretKey = variables.settings.facebook.SECRET_KEY );

binder.map(“FacebookGraphAPI@fbModule”).to("#moduleMapping#.model.sdk.FacebookGraphAPI")

.initWith( appId = variables.settings.facebook.APP_ID );

Nothing looks out of the ordinary here, so lets look at the constructor for this model.

public Any function init(required String appId, required String secretKey) {
if (!isPersistentDataEnabled()) {
throw(message=“Persistent scope is not available (by default session scope, so you must enable session management for this app)”, type=“UnvailablePersistentScope”);
}
super.init(arguments.appId);
setAppId(arguments.appId);
setSecretKey(arguments.secretKey);
return this;
}

Ok that explains the error message as it is catching the throw, but why is it being thrown and the following code gives the answer.

public Boolean function isPersistentDataEnabled() {
if (ListFirst(server.coldfusion.productversion,",") GTE 10) {
return getApplicationMetaData().sessionManagement; // CF10 compatible
} else {
return application.getApplicationSettings().sessionManagement;
}
}

Wow again it seems like this method is not 100% reliable, now the question is why is this the case?

So here is the question, I doubt this is an issue with the way it is being done, but something that ColdFusion itself is handling wrong. Is there anyone else out there who knows what is causing this and how to get around it, but more importantly is there a way we can get this to reliably happen 100% (I am able to get it about 10% of the time on a single user system, but 80% on a production system) that can get Adobe to look at this as a matter of urgency.

But the one thing that is common, all errors come from something being done in WireBox that is used as a property being Injected. I can’t find the original bug that was raised with Adobe, rest assured it has been in there hands since ColdFusion 10 was released.

Any help, suggestions would be appreciated.

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/113032480415921517411

So it has been 3 days now and there has been no answer from Luis or Brad or Ortis Solutions on this, really!!

Well, Luis is on vacation and I haven’t answered because I have no answer for you. It’s clearly a bug internally in CF so I can’t do anything about it. You’ll have to wait for Adobe to fix it.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Well how do you think I feel when it is only able to be duplicated inside a ColdBox / WireBox application, Adobe haven’t taken it serious enough to stop so many more sites move away from ColdFusion. But that’s their loss.

And would it hurt anyone at Ortis Solutions to say lets take a look and confirm if this is indeed a ColdFusion issue and not some issue that WireBox has! So that maybe Ortis Solutions can then go to Adobe and say we are having serious issues with our framework and this error, that is hindering keeping any ColdFusion sites?

yeah I am angry Brad, because I am tired of getting a solution that stops this and because it appears no-one else is reporting this makes it a low priority issue. But an issue that is causing most of my clients customers loosing data, they are loosing customers left right and centre and so much pressure to have it fixed that I can’t give them any answer.

This not only looks bad for ColdBox, but looks even worse when you have websites running on ColdFusion that is looking bad for Adobe.

Am I wrong in that this should be given more priority than Adobe has given the bug? ANd would it actually hurt Luis or Ortis to get behind getting a resolution to this issue, I would like to see the logs on every ContentBox website out there running under ColdFusion 9/10/11 and see if this appears in their logs. Oh wait ColdFusion doesn’t log these and ContentBox logs them to the console, so getting more info from others is like harder because there are no logs by default.

I get this error all the time in my logs, on a high traffic site I had to comment out the offending line and force it to simply return a hardcoded DSN name.

I reported it in this group a while back but was told the same thing, that it’s a CF bug.

Here is the ticket Andrew put in September of last year. https://bugbase.adobe.com/index.cfm?event=bug&id=3634391

I would recommend voting it and commenting to help Adobe reproduce it.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

I just set up a simple test in JMeter was able to fairly easily reproduce the NPE and “Element DATASOURCE is undefined” error.

I created a folder with two files:

Application.cfc

component {
this.name=“test”;
this.ormEnabled=“true”;
this.datasource=“test123”;
}

index.cfm

I pointed 10 JMeter threads at it and within a minute had produced several errors.

Error Occurred While Processing Request

Element DATASOURCE is undefined in a CFML structure referenced as part of an expression.

and

java.lang.NullPointerException
	at coldfusion.runtime.AppHelper.getApplicationMetaData(AppHelper.java:1246)
	at coldfusion.runtime.CFPage.GetApplicationMetadata(CFPage.java:10402)
	at cfindex2ecfm1520861839.runPage(C:\Users\Brad.development\Documents\scribble.dev\newApp\index.cfm:1)

Looks like this should be pretty easy for Adobe to duplicate and it has nothing to do with threads or WireBox. I’ll add this information to the Adobe ticket.

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 Brad, that gives me extreme confidence that its not a Wirebox issue.

Just so people know, my hosting provider has been able to duplicate this with the tests Brad came up with and has also raised the issue with Adobe. Strange I pinged the ColdFusion Product Manager and asked why this hasn’t had a higher priority, have not had a reply as yet either.