Datasource not being recognized

So I just started looking at ColdBox yesterday. I was able to get the sample app up and running with no issue at all. Everything was going great until I wanted to start getting data from my database. My site is not inside the webroot, so I’m assuming that is why I’m getting: datasource doesn’t exist. Datasource was defined as this.datasource. I wasn’t sure if it had to be in the webroot or not since CB has its own standalone servers. I then created a new app in the webroot and turned off the server I created with it. So now the app was being referenced as localhost:8500/myapp. Now the database works but if I go to a different event or view such as localhost:8500/myapp/hello, I get:

Type Status Report

Message The requested resource [/myapp/hello] is not available

Any ideas what I’m doing wrong here?

Thanks!

Hi @houkster and welcome aboard.

Can you please expand a few things.

  • Are you using CommandBox as your application server?
  • Is this lucee or Adobe?
  • What version of ColdBox?
  • Can you paste the full exception stacktrace.
  • How did you define the datasource?

I had tried both. Would love to just use CommandBox as the app server. I’m using Adobe CF. I’m using the latest version from your site - 7.2.1+13. I had defined the datasourc in the application.cfc as this.datasource. I also tried to define it in the coldbox.cfc. Both gave me the same result.

Thanks for the response. Looking forward to getting this working.

lucee.runtime.exp.DatabaseException: datasource [meredith_manor] doesn’t exist
at lucee.runtime.exp.DatabaseException.notFoundException(DatabaseException.java:195)
at lucee.runtime.PageContextImpl.getDataSource(PageContextImpl.java:3591)
at lucee.runtime.tag.Query.toDatasource(Query.java:251)
at lucee.runtime.tag.Query.setDatasource(Query.java:243)
at views.main.index_cfm$cf$2.call(/views/main/index.cfm:1)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1025)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:929)
at system.web.rendererencapsulator_cfm$cf.call(/coldbox/system/web/RendererEncapsulator.cfm:57)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1025)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:940)
at lucee.runtime.tag.CFTag.doInclude(CFTag.java:319)
at lucee.runtime.tag.CFTag.cfmlStartTag(CFTag.java:245)
at lucee.runtime.tag.CFTag.doStartTag(CFTag.java:179)
at system.web.renderer_cfc$cf.udfCall2(/coldbox/system/web/Renderer.cfc:452)
at system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at system.web.renderer_cfc$cf.udfCall1(/coldbox/system/web/Renderer.cfc:337)
at system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at layouts.main_cfm$cf.call(/layouts/Main.cfm:182)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1025)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:929)
at system.web.rendererencapsulator_cfm$cf.call(/coldbox/system/web/RendererEncapsulator.cfm:57)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1025)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)
at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:940)
at lucee.runtime.tag.CFTag.doInclude(CFTag.java:319)
at lucee.runtime.tag.CFTag.cfmlStartTag(CFTag.java:245)
at lucee.runtime.tag.CFTag.doStartTag(CFTag.java:179)
at system.web.renderer_cfc$cf.udfCall2(/coldbox/system/web/Renderer.cfc:452)
at system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:804)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1794)
at system.web.renderer_cfc$cf.udfCall2(/coldbox/system/web/Renderer.cfc:668)
at system.web.renderer_cfc$cf.udfCall(/coldbox/system/web/Renderer.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:213)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:665)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1952)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:866)
at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1794)
at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:326)
at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:786)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at coldbox.system.bootstrap_cfc$cf.udfCall1(/coldbox/system/Bootstrap.cfc:506)
at coldbox.system.bootstrap_cfc$cf.udfCall(/coldbox/system/Bootstrap.cfc)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:664)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:787)
at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1775)
at application_cfc$cf$1.udfCall(/Application.cfc:102)
at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
at lucee.runtime.type.UDFImpl._call(UDFImpl.java:350)
at lucee.runtime.type.UDFImpl.call(UDFImpl.java:223)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:664)
at lucee.runtime.ComponentImpl._call(ComponentImpl.java:586)
at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1933)
at lucee.runtime.listener.ModernAppListener.call(ModernAppListener.java:444)
at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:135)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:44)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2493)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2478)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2449)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1216)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1162)
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:67)
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:67)
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 runwar.undertow.SSLClientCertHeaderHandler.handleRequest(SSLClientCertHeaderHandler.java:144)
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 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:275)
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.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
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:393)
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:1449)
at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.lang.Thread.run(Thread.java:750)

Maybe. It’s hard to say because there is still a ton of missing information here about exactly how you’ve configured the datasource. And the reality is, none of this really applies to ColdBox MVC nor CommandBox CLI. It’s also not clear how many servers you have running what folders. Are they all CommandBox? Do you have a “normal” Adobe CF installation AS WELL as one or more CommandBox severs you’ve started?

Every CommandBox server is a totally separate “installation” of Adobe CF running as a separate Java process, with separate settings. So any settings configured in the web-based admin for a standard Adobe CF install won’t be visible to a CommandBox server.

If you created this.datasources in an Application.cfc and then create a subfolder with its OWN Application.cfc, the top one will be completely ignored. That’s just how CF works!

It’s hard to tell you which of these several scenarios you’ve got going on and how to fix it without knowing what the issue is, but you need to trace back through what server is running the COldBox app and how/where you’re expecting that site to be able to “see” your datasource config. That will likely lead you to the fix.

This is the because the out-of-the-box URL rewrites assume the ColdBox app is in the web root. They turn URIs like

/anything

into

/index.cfm/anything

So your URL, which is mixing actual folder names with your SES URLs is most likely turning

/myapp/hello

into

/index.cfm/myapp/hello

instead of:

/myapp/index.cfm/hello

I don’t recognize the wording of your error message so I’m not sure where it’s coming from. (A screenshot would really help there) but at the end of the day, if you’re going to use SES URLs with rewrites in a subfolder, you need to customize the rewrites to take that folder into account. And… again, I can’t really help you with that since it’s not clear which web server you’re having do rewrites here.

I do have the regular Adobe CF server installed on port 8500. For the sake of clarity, let’s forget it is there. I have the instance from commandbox installed and it works fine. I’ve been a CF developer for several years, so I’m totally aware of how application.cfc and defining the datasource there works. In a regular adobe cf instance, we define the datasource in the admin. Where is the admin in the ColdBox CF server? is there one? That’s where my confusion is. How do I define a datasource in the commandbox instance so that it is recognizable from either the application.cfc or the coldbox.cfc?

The Lucee or ColdFusion web-based admins in a CommandBox server are in the same place they are on any other server. You hit the normal URL, just on whatever host and port the CommandBox server is running on. And CommandBox actually makes it even easier, look for the server icon in your system tray click it, choosing the “Open” menu and then the “server admin” menu. Or, you can just run the

server open --admin

command in the web root of the server. Both of those shortcuts will open up the admin for you. But CommandBox even has one better than the admin-- we have an entire tool called CFConfig which allows you to script out all the config in the web admin to a JSON file that’s loaded into any server you start automatically.

Note, unless you change it, the default password for the Adobe admin will be “commandbox”.

Ok, THAT’S what I was looking for! I was able to get the admin open with no issue. I see it is a Lucee server and that it wants me to set the password in a text file. Will try that later tonight. Thank you so much. I had been going through the getting started guide but clearly missed this part. Thanks much, I really appreciate it!

1 Like

If you are wanting an Adobe server, you can get that. You just have to tell CommandBox.

server start cfengine=adobe

Also, I would forget all about Lucee’s annoying password.txt nonsense. CFConfig has your back there. In fact I just set a global env var that CFConfig picks up by convention and every server I ever start on my PC with CommandBox just automatically has my default admin password set for me automatically.

propertyFile set ~/.box.env cfconfig_adminPassword Password123!

Run that command, putting in whatever password you like, restart the CLI, and never think about it again :slight_smile:

3 Likes

Brad, THANK YOU so much! Man, you’ve been really helpful. I was able to spin up the Adobe CF server and get a datasource defined (once I ran Cfpm install sqlserver). Everything seems to be working now. I’m going to start to research on how to setup a portion of the site with authentication next then I can start to rewrite our site in ColdBox. Thanks again!

2 Likes