DocBox can't find component


Today I was generating documentation for my app with DocBox and it came back with an error message.

Warning! The following script has errors: modelsUserService
invalid component definition, can't find component [modules.cbstorages.models.SessionStorage]
lucee.runtime.exp.ExpressionException: invalid component definition, can't find component [modules.cbstorages.models.SessionStorage]

So, I went to check what it was referencing. This was the bit of code that it didn’t like:

This code is valid and runs well. The model being constructed is called according to this folder structure:

My question here is, is there a way for docbox to not throw an error on reading this code, so that it makes the documentation correctly?

Howdy Jeff,

I would check out the “Using DocBox” series on CFCasts, specifically video 2 which talks about configuring mappings and such to avoid these sorts of issues:

The problem you are running into is a basic component mapping issue. You have a dependency on the modules.cbstorages... path, but that path either does not exist, or (much more likely) is relative.

I’d have to dig into the DocBox source to be certain, but I think that DocBox doesn’t actually instantiate the component… only runs a getComponentMeta() on it. So it’s possible this error would go away if you move that variables.cbSession = new modules.cbstorages...() line into the init() method.

(And, as an aside, can’t you inject SessionStorage@cbstorage? This would also fix the DocBox issue.)

Finally, if none of these options work you can add a mapping in the docbox configuration to point the modules namespace to the correct source directory. For the docbox cli, that would look like:

docbox generate mappings:modules=/path/to/my/app/modules strategy-outputTitle="My API Docs"...


  1. Use injection
  2. Or move instantiation to the init() constructor method
  3. Or create a docbox mapping for this namespace
1 Like

Hi Michael!

Thank you for your reply here.

I opted to just defining the that SessionStorage object within the init function. It’s a bit clunkier, but it does the job.

I’ve been working on this project for a while and SessionStorage@cbstorage is injected into some of the handlers, and I could probably work something out with using that injection instead of the manual object creation like I’m doing, but we’re pushing to production soon so I don’t want to start working on anything that I’m unsure of the outcome of haha.

Still, thank you for posts here. Always learns me a thing or two!

1 Like