[CB 4.0] [cbdebugger 1.1.0] [cbstorages] Having trouble getting modules to work correctly

Hello all,

I’ve stepped up to CB 4.0 and the transition has been relatively smooth. But I’m having trouble getting modules to work correctly – currently I am trying to get cbstorages and cbdebugger to work correctly. I’m working on a windows server 2012 machine, running Railo 4, with MySQL.

First, in all of the templates that come with Cb 4.0, there isn’t a “modules” folder to put anything in. So I simply made one, and that seems to work. But for us fools, it might be better to just put one in the Advanced / Adv Script templates with a “PutStuffHere.txt” file.

cbstorages

I dropped the cbstorages folder into the modules folder, and it appears to load (as it appears in getSetting(“Modules”) when I loop through it). It works absolutely fine in my handlers, whether I inject it via WireBox as a property or use getModel(“sessionStorage@cbstorages”). But, when I try to use it in an interceptor, injecting it fails. I try to do this:

`
component accessors=true output=false singleton extends=“coldbox.system.Interceptor” {

property name=“SecurityService” inject=“SecurityService_tag”; ← this is my own service, it works fine.
property name=“SS” inject=“sessionStorage@cbstorages”;

`

… and I get this error:

Railo 4.2.1.000 Error (Builder.DSLDependencyNotFoundException)
Message The DSL Definition {REF={null}, REQUIRED={true}, ARGNAME={}, DSL={id:sessionStorage@cbstorages}, JAVACAST={null}, NAME={SS}, TYPE={any}, VALUE={null}, SCOPE={variables}} did not produce any resulting dependency
Detail The target requesting the dependency is: ‘interceptor-SecurityInterceptor’

I’ve tried multiple namespace edits and nothing seems to work. But:

Interestingly, if I instead create a reference via
`
var SessionStorage=getModel(“SessionStorage@cbstorages”);

`

it works just fine. I’m trying to understand if this is “expected behavior” and has something to do with the timing of interceptor creation, or if I’m doing something wrong, or have some setting off. The interceptor otherwise behaves perfectly, and I’ve registered it in Coldbox.cfc.

cbdebugger

This has been more of a challenge, and I have yet to make it work. I dropped the whole folder into “modules” of my application, and it loads correctly per the getSetting(“modules”) loop in the template default view. When I reinit the framework, I first get this error:

Railo 4.2.1.000 Error (Controller.SettingNotFoundException)
Message The setting ApplicationHelper does not exist.
Detail FWSetting flag is false

Googling this, it appears (please correct me if I’m wrong) that somewhere in the CB 3.8 -> 4.0 transition, the UDFLibraryFile setting in Coldbox.cfc was deprecated for ApplicationHelper which is an array of UDF files to include. But there is no such setting in the ColdBox.cfc file that I can see. So, I added a setting to the ColdBox.cfc file like so:

`
ApplicationHelper = [“includes/helpers/ApplicationHelper.cfm”],

`

…and adding this made that error resolve. But no matter what I have tried next, I can’t get the debugger to work. I’ve tried (one at a time):

property name="debug" inject="debuggerService@cbdebugger";

and

var cbdebugger=getInstance("debuggerService@cbdebugger"); var cbdebugger=getModel("debuggerService@cbdebugger");

and tried not injecting it at all, and then tried multiple combinations of:

showDebugger(); cbdebugger.showDebugger();

and all of them throw errors that the function or property doesn’t exist. It seems that the mixins.cfm file that’s part of the cbdebugger module isn’t getting loaded correctly. I opened that and saw that the showDebugger() function just sets a variable in the prc, so I tried just doing that in my handler, and that gives me this error:

Oopsy! An Exception Was Encountered
Error Type: expression : 0
Error Messages: No matching function [ISDEBUGGERRENDERING] found
Tag Context:
ID: ??
LINE: 77
Template: /NIS2/modules/cbdebugger/interceptors/Debugger.cfc
ID: ??
LINE: 370
Template: /coldbox/system/web/context/InterceptorState.cfc
ID: ??
LINE: 260
Template: /coldbox/system/web/context/InterceptorState.cfc
ID: ??
LINE: 121
Template: /coldbox/system/web/context/InterceptorState.cfc
ID: ??
LINE: 139
Template: /coldbox/system/web/services/InterceptorService.cfc
ID: ??

I’ve run out of ideas, hoping I’m doing something really dumb that would be easy to fix. Crazy situation is that at present, the rest of my code works fine so I don’t need the debugger, but I expect it will come in handy in the near future. Thanks for any insight!

With the dependency, interceptors are loaded before modules are, so you can’t inject a model from a module directly into an interceptor. You can get around this by adding “provider:” to the beginning of the injection DSL.

property name=“SS” inject=“provider:sessionStorage@cbstorages”;

ApplicationHelper

Something in the code is trying to access a setting by that name. You’d have to look at the stack trace to see where the offending code is. Adding that setting in just masked the issue.

As for the last issue, are you just trying to turn on the debugger panel? Have you tried adding these settings to your /config/Coldbox.cfc?

debugger = {
// Activate debugger for everybody
debugMode = true,
// Setup a password for the panel
debugPassword = “”

}

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

SOLVED, thanks for the help. I redownloaded CB 4.0 and found that somehow, I must have still had some 3.8 pieces left. I threw everything away and replaced it with a new version. CB 4.0 Coldbox.cfc file has the ApplicationHelper setting (rather than the UDFHelperFile) and now it works just fine.

Thanks for the advice regarding the injector. Can you briefly explain exactly what a “provider” is? I hate using/doing something without at least some basic understanding of what’s happening behind the scenes.