Missing dependency error with wirebox injection

Hello! This is similar to a previous question I’ve had, but I was unable to solve it with the previous solution that was given to me.

I am creating a ColdBox module and have been testing it for quite some time on a server. However, I made some edits one day and now I am unable to launch my server without getting the following error:

The dsl requested is “addressValidationClient@cbAddy”, so I removed the injection that was prompting the error and I printed the wirebox mappings to the screen, just to see if the module had not loaded correctly. This was the dump of the following code:

dump( wirebox.getBinder().getMappings().keyArray() )

As you can see, “addressValidationClient@cbAddy” is in the 6th index of the array, so it looks like the module loaded correctly, yet it says the dependency is missing :frowning:

Here’s the code from the ModuleConfig.cfc file:

Any help is appreciated :slight_smile:

image

Here’s what my injection looks like in my main handler which is producing the error.

Bump

I can confirm that the error is not independent to my server – I used this same package on another server and the same error was produced.

I also have tried changing all of the naming, removing all of the settings, getting rid of the custom mapping code, and forgetting all of my servers to start with a clean slate. Still the same error appears. Anyone have some ideas for how to fix this? I’m not giving up haha, but I’m a bit peeved for what might be causing this.

Is this module on ForgeBox where I can test it? I’m on my phone, but glancing at the code in your screenshots, everything looks correct.

1 Like

Thanks for the reply!

Yup. It’s called cbaddy on forgebox.

Got it. I’m about to board a plane, but I’ll try to take a look at this later. My first though is whether the handler is somehow getting created prior to the module loading.

1 Like

That’s an interesting thought. It’s the standard main handler created from the “coldbox create app” command in commandbox. There’s also a dependency module contained within my module that loads and can be injected correctly that I’ve tested, yet the main module is unable to be injected.

Thanks for being willing to help!

In order to tell, you need to look at the full stack trace of the error and start from the bootstrap and check out the line numbers to see “where” in the framework lifecycle it’s all happening. This, of course, requires a bit of familiarity with the internals of ColdBox. But the main thing is to make sure the framework isn’t still in the process of booting up when it’s creating and wiring the handler. For example, if the handler itself has a method registered as an app start event, perhaps that’s causing the handler to be created soon. Just a thought.

1 Like


Above is the full stack trace. I have been a ColdBox developer for about 6 months, so I’m not too experienced, but I’ll take a good look at it to see if anything catches my eye.

That’s not actually the “stacktrace”, that’s the CFML tag context, and it’s only about half of it :slight_smile: The stack trace is basically the java-level stack and it usually starts with Thread.run() at the bottom.

1 Like

Oh okay! Thanks for checking me on that. I’ll submit the stacktrace here:



Honestly, if you can just copy paste the text into a gist or a code block, that’s 100 times easier to work with :slight_smile: I can’t easily search for text inside of images, lol

1 Like

Haha, sorry about that!

Here you go:

lucee.runtime.exp.CustomTypeException: The target 'handlers.Main' requested a missing dependency with a Name of 'cbAddy' and DSL of 'cbaddy@avc'
  at lucee.runtime.tag.Throw._doStartTag(Throw.java:212)
  at lucee.runtime.tag.Throw.doStartTag(Throw.java:201)
  at throw_cfm$cf.udfCall(/throw.cfm:11)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
  at lucee.runtime.functions.system.CFFunction.call(CFFunction.java:109)
  at coldbox.system.ioc.builder_cfc$cf.udfCall2(/coldbox/system/ioc/Builder.cfc:621)
  at coldbox.system.ioc.builder_cfc$cf.udfCall(/coldbox/system/ioc/Builder.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:685)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1930)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866)
  at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766)
  at coldbox.system.ioc.injector_cfc$cf.udfCall4(/coldbox/system/ioc/Injector.cfc:1106)
  at coldbox.system.ioc.injector_cfc$cf.udfCall(/coldbox/system/ioc/Injector.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:785)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.ioc.injector_cfc$cf.udfCall2(/coldbox/system/ioc/Injector.cfc:848)
  at coldbox.system.ioc.injector_cfc$cf.udfCall(/coldbox/system/ioc/Injector.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:685)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1930)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866)
  at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766)
  at coldbox.system.ioc.scopes.noscope_cfc$cf.udfCall(/coldbox/system/ioc/scopes/NoScope.cfc:49)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1911)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.ioc.injector_cfc$cf.udfCall1(/coldbox/system/ioc/Injector.cfc:531)
  at coldbox.system.ioc.injector_cfc$cf.udfCall(/coldbox/system/ioc/Injector.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1911)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.web.services.handlerservice_cfc$cf.udfCall1(/coldbox/system/web/services/HandlerService.cfc:107)
  at coldbox.system.web.services.handlerservice_cfc$cf.udfCall(/coldbox/system/web/services/HandlerService.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:785)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.web.services.handlerservice_cfc$cf.udfCall1(/coldbox/system/web/services/HandlerService.cfc:144)
  at coldbox.system.web.services.handlerservice_cfc$cf.udfCall(/coldbox/system/web/services/HandlerService.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1911)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.web.controller_cfc$cf.udfCall3(/coldbox/system/web/Controller.cfc:768)
  at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:207)
  at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:802)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866)
  at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1766)
  at coldbox.system.web.controller_cfc$cf.udfCall3(/coldbox/system/web/Controller.cfc:667)
  at coldbox.system.web.controller_cfc$cf.udfCall(/coldbox/system/web/Controller.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1911)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.bootstrap_cfc$cf.udfCall2(/coldbox/system/Bootstrap.cfc:664)
  at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:785)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:122)
  at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1911)
  at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
  at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1747)
  at application_cfc$cf.udfCall(/Application.cfc:38)
  at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106)
  at lucee.runtime.type.UDFImpl._call(UDFImpl.java:344)
  at lucee.runtime.type.UDFImpl.call(UDFImpl.java:217)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:684)
  at lucee.runtime.ComponentImpl._call(ComponentImpl.java:572)
  at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1911)
  at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:437)
  at lucee.runtime.listener.ModernAppListener.onApplicationStart(ModernAppListener.java:304)
  at lucee.runtime.PageContextImpl.initApplicationContext(PageContextImpl.java:3135)
  at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:120)
  at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
  at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2460)
  at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2450)
  at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2421)
  at lucee.runtime.engine.Request.exe(Request.java:45)
  at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1179)
  at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1125)
  at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
  at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
  at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
  at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47)
  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
  at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
  at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
  at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
  at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:405)
  at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
  at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
  at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
  at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
  at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
  at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
  at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
  at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
  at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
  at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
  at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at runwar.Server$1.handleRequest(Server.java:510)
  at io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:280)
  at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:79)
  at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
  at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
  at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
  at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:260)
  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:79)
  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:852)
  at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
  at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
  at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
  at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1423)
  at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1280)
  at java.base/java.lang.Thread.run(Unknown Source)

Update on this issue:

I was working on another Coldbox module of mine and simply added a couple key-value pairs to the default module settings in the moduleConfig.cfc file and now this error is occurring with that Coldbox module as well. I believe a similar situation created the original error in this thread as well. Is it possible for changing the moduleConfig.cfc in a small way to affect the dependency injection in Coldbox at all?

Well, Jeff, the first and most obvious question is what exactly did you change in the ModuleConfig.cfc?

1 Like

Hi Michael,

Thanks for being willing to help. This is the git hunk that was changed in the moduleConfig.cfc file. The red is the before, and the green is after.

image

This is the result of dump( wirebox.getBinder().getMappings().keyArray() ); with the other module that is now experiencing the same issue on a different serverr

This module is also available on forgebox with box install dog if you’d like to see if you get the issue yourself

Problem One

You’re trying to use the CFC name as the module name in your injection DSL / alias.

binder.map( "dog@deliveryObservationGadget" )
        .to( "#moduleMapping#.models.deliveryObservationGadget" )
        .asSingleton();

Why this particular DSL to inject your main model?

It seems like you’re putting the cart before the horse - i.e., you should inject="deliveryObservationGadget@dog", not vice-versa.

If you really prefer the dog alias, you can do dog@dog:

binder.map( "dog@dog" )
        .to( "#moduleMapping#.models.deliveryObservationGadget" )
        .asSingleton();

Problem Two

If you’re already using binder.map(...).to(...), you don’t need the binder.mapDirectory(), as you’re just (trying to) create the same injection DSL twice. Redundant and duplicate. :stuck_out_tongue_winking_eye:

1 Like

With that said, I haven’t actually spun up a ColdBox app and tested my above recommendation. Take it with a grain of salt, as I’m just guessing at what is going on here.

Honestly, if you didn’t do any binder.map() at all, you should be able to use the default mappings courtesy of ColdBox and Wirebox auto-mapping magic:

property name="dog" inject="deliveryObservationGadget@dog";

IMO, you’re trying too hard. :grin:

1 Like

Hi Michael! Thanks so much for chiming in.

Per your second post, I erased all of the binder mapping stuff and this is what the moduleConfig.cfc looks like for my dog module:

However, I still unfortunately get this error after starting my server with injecting this dependency:

I’ve only tried it on my machine so far, so I’ll see if my coworker can try it on his on Monday, to see if the problem is with my machine and not the module.

Wait a second… do you have spaces in your directory name? :thinking: Wouldn’t be surprised if ACF or Lucee throws when trying to create the component, in that case.

My next question would ask about case-sensitive vs non-case-sensitive file systems. Check your casing, even on Windows.

1 Like