[coldbox-4.3.0] Trouble starting CB app using new Adobe CF 11 instance

I’m new to ColdBox so I hope this is an easy configuration issue. Windows 7 and Adobe CF 11. Sorry if this is too lengthy of a post but I wanted to give you what I think is the relevant information to minimize the back and forth. Thanks in advance if you can help!

Using CommandBox and following the HelloWorld instructions I created a CB app at “C:\ColdBox\CommandBox\a_playground”, which contains Application.cfc, box.json, etc. I then created a website in IIS pointing to “C:\ColdBox\CommandBox\a_playground”.

Using my dev version of CF 11 I created a new CF instance named “ColdBox_Playground”, which resulted in a new folder “C:\ColdFusion11\ColdBox_Playground”. Then I ran the connector (wsconfig in “C:\ColdFusion11\ColdBox_Playground\runtime\bin”) to connect the website to the CF instance. This is what I do for new instances/ websites all the time and it usually works ok.

To add libraries used by CB, I updated the jvmconfig file to add C:/ColdBox/CommandBox/lib to the classpath and set the coldfusion.libPath to this path. Not entirely sure what I have to update in the jvmconfig file, these are just guesses.

In the coldbox Application.cfc I kept the COLDBOX_APP_ROOT_PATH at “getDirectoryFromPath( getCurrentTemplatePath() )”. I have tried different values for COLDBOX_APP_MAPPING such as “”, “C:\ColdFusion11\ColdBox_Playground”, “C:\ColdFusion11\ColdBox_Playground\wwwroot”, and “C:\ColdFusion11\ColdBox_Playground\wwwroot\WEB-INF”.

When I attempt to start my CF instance, the log file (coldfusion-error.log) indicates that some things start ok but I then get a long set of errors that seem to indicate that the app is not looking in the right place for jars. Here’s a sample:

Jan 23, 2017 10:44:04 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.2.2 using APR version 1.5.1.
Jan 23, 2017 10:44:04 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Jan 23, 2017 10:44:05 AM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.2d 9 Jul 2015)
Jan 23, 2017 10:44:05 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [“ajp-apr-8015”]
Jan 23, 2017 10:44:05 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [“http-nio-8502”]
Jan 23, 2017 10:44:05 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 23, 2017 10:44:05 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 23, 2017 10:44:05 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Jan 23, 2017 10:44:08 AM org.apache.catalina.core.ApplicationContext log
INFO: ColdFusionStartUpServlet: ColdFusion: Starting application services
Jan 23, 2017 10:44:08 AM org.apache.catalina.core.ApplicationContext log
INFO: ColdFusionStartUpServlet: ColdFusion: VM version = 25.25-b02
java.security.AccessControlException: access denied (“java.lang.RuntimePermission” “setContextClassLoader”)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.Thread.setContextClassLoader(Thread.java:1467)
at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:124)
at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Jan 23, 2017 10:44:09 AM org.apache.catalina.core.ApplicationContext log
INFO: failed to load: coldfusion.server.j2ee.CFStartUpServlet
Jan 23, 2017 10:44:09 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet / threw load() exception
java.security.AccessControlException: access denied (“java.lang.RuntimePermission” “setContextClassLoader”)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.Thread.setContextClassLoader(Thread.java:1467)
at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:124)
at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

(Many more errors follow)

The part of the log that errors out is when my other instances have this:

Dec 19, 2016 11:46:24 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-9.0.7.v20131107
Dec 19, 2016 11:46:24 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started o.e.j.s.ServletContextHandler@c33fea0{/,null,AVAILABLE}
Dec 19, 2016 11:46:24 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started ServerConnector@10639c1e{HTTP/1.1}{0.0.0.0:5501}
Dec 19, 2016 11:46:24 AM org.apache.catalina.core.ApplicationContext log
INFO: CFMxmlServlet: Macromedia Flex Build: 87315.134646
Dec 19, 2016 11:46:28 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“ajp-apr-8012”]
Dec 19, 2016 11:46:28 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“http-nio-8500”]
Dec 19, 2016 11:46:28 AM com.adobe.coldfusion.launcher.Launcher run
INFO: Server startup in 12481 ms

Am I missing something really simple? Any help would be greatly appreciated. Would love to start using this framework for my CF apps.

Chris Gulla

Hi Chris, I’m not sure what you’re trying to do, but that isn’t how you use CommandBox at all! CommandBox starts up stand-alone CFML servers without the need to have any other software configured on the computer. Adding the CommandBox lib to your classpath has most certainly created Java classloader chaos as you are mixing in all the Lucee and CommandBox jars into an Adobe CF instance.

To start the site up in CommandBox, all you need to do is run the CommandBox shell, “cd” into the web root and type:

server start

That’s it! And if you want to start a CF11 instance (completely separate from your existing stuff) just type this instead:

server start cfengine=adobe@11

When you’re done playing around, run “server stop” to stop the server and optionally, “server forget” to delete all the associated files that were installed. CommandBox can start as many servers as you like at the same time, running any CF engine version, and in any folders on your hard drive. Each one you start, will create an icon in your system tray with additional options. Here’s some reading for you:

https://commandbox.ortusbooks.com/content/getting_started_guide.html
https://commandbox.ortusbooks.com/content/embedded_server/embedded_server.html

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

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

Thanks Brad, really appreciate the quick response. I did successfully use the CommandBox commands you mention, but wanted to get CB and my own CF instance created through the CF Admin UI to play together. Our production environments utilize separate, pre-created and pre-configured CF 11 instances, so I need to make that work somehow. I am foggy on whether/ when CommandBox creates the physical instance and tears it down, and how to configure that CF instance every time I want to run my app. Like, do I have to set up my DSNs, Mail settings, and everything else, in CommandBox whenever I want to start my app? If I specify CF11, which Update level (there are now 8 I think) does it use? Is it meant to be used so that you write a CommandBox recipe that sets all that up every time? I feel like I am missing something really basic but important here.

But anyway, while I was waiting for my first post to be approved I went about things another way, according to a few (pretty old) posts by Adam Cameron here:

I have things working under my own separate pre-configured (you would probably call it an “external”) CF11 instance, without using CommandBox. I should probably figure out how to run CommandBox so that it’ll be compatible with this kind of directory structure and external CF instance at some point, as I believe it’ll be helpful for deploying addins like CacheBox.

Knowing what you know now about my needs, if you can point me in any particular direction, provide alternates to my configuration, etc. I would appreciate it but I know this is pretty basic. Thanks again for your help.

Chris

> but wanted to get CB and my own CF instance created through the CF Admin UI to play together.

They don’t play together :slight_smile: They are alternatives to each other. CommandBox also tries to play the part of your web server as well.

> Our production environments utilize separate, pre-created and pre-configured CF 11 instances, so I need to make that work somehow.

What specifically needs to work? For the most part, they’re all just servers. CommandBox simply provides a quick and painless way to spin up any number of CF engines around your hard drive with zero install. At the end of the day, it’s still a CF server though, just based on a WAR install.

> I am foggy on whether/ when CommandBox creates the physical instance and tears it down

The actual CF engine files are created the first time you run “server start” and never deleted unless you run “server forget” and type “yes” to the “are you sure???” confirmation.

> and how to configure that CF instance every time I want to run my app.

You configure it the first time you start it-- just like any other CF server install. You have access to the web-based administrator just like a “normal” server. If you want ideas on how to script the configuration so it’s seamless and automatic, read here:
https://commandbox.ortusbooks.com/content/embedded_server/coldfusion-settings.html

> do I have to set up my DSNs, Mail settings, and everything else, in CommandBox whenever I want to start my app

Nope, just log into the web admin the first time and create them like you normally would. Of course, for more automate-able options, read above.

> If I specify CF11, which Update level (there are now 8 I think) does it use?

You decide-- it’s entirely up to you.

start cfengine=adobe <— Starts the absolute latest version of Adobe ColdFusion (currently 2016 u3)
start cfengine=adobe@11 <— starts the latest version of ACF 11 (currently update 11)
start cfengine=adobe@11.0.11+301867 <— Starts that specific version.

In fact, you can use any valid npm-style semver range in there. Read more on semver here:
https://www.ortussolutions.com/blog/the-12-tips-of-commandbox-christmas-day-11-semantic-versioning

> Is it meant to be used so that you write a CommandBox recipe that sets all that up every time?

Well, that’s certainly in the realm of possibilities, but your configs are saved on disk even when you stop and restart your servers. Just keep in mind if you use a semver range like adobe@11, then the next time a new update comes out, CommandBox will currently start the newest version which will be a fresh copy. If that sounds bad, then you might want to lock in your engine version.

> while I was waiting for my first post to be approved

Yeah, sorry about that. Google moderates all new posts and I didn’t see the notification that yours had come in the first day.

> according to a few (pretty old) posts by Adam Cameron

Out of all the information on the Internet regarding ColdBox, I wouldn’t recommend using Adam’s blog. He looked at ColdBox very briefly a while back, approached it in the most obscure way I’ve ever seen, got seemingly hung up on the most tangential topics, and never actually built anything. If you have free time on your hands, read through our full GitBook documentation reference:
https://coldbox.ortusbooks.com
Follow our getting started guide:
https://coldbox.ortusbooks.com/content/full/getting_started_guide/
Read our official blog:
https://www.ortussolutions.com/blog/category/coldbox-mvc
Or peruse our vast array of recorded webinars:
https://www.ortussolutions.com/events/odw-2016
https://www.ortussolutions.com/events/restful-roadshow-2016
https://www.ortussolutions.com/events/odw-2015

> I should probably figure out how to run CommandBox so that it’ll be compatible with this kind of directory structure

What kind of directory structure? CommandBox servers behave the same as any other server. They’re just way easier to spin up and manage.

> I believe it’ll be helpful for deploying addins like CacheBox.

Nah, doesn’t really matter. CacheBox is already part of ColdBox though. You don’t need to do anything to set it up.

> provide alternates to my configuration

I don’t really know anything about your current configuration, so no not really :slight_smile:

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

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

Brad,

Thanks so much, this is very helpful. I am getting hung up on things that have been second nature to everyone in this group, and I am really grateful to the newbie-level assistance. Now that I know more about the CF instances I may have to return to the default ColdBox setup provided by CommandBox. Really looking forward to converting our really-old FuseBox app to ColdBox. Cheers and hope my next question in this group is a bit more challenging!

Chris