CommandBox newb questions

Hi folks, I’m just starting to take a look at this, very interesting and powerful so far.

Couple questions before I’m down the rabbit hole chasing ghosts…

  • Is running more than one CommandBox Lucee server at a time with different root directories supported?

  • Is there any way to set the classpath for a CommandBox Lucee instance?

Thanks in advance.

Answers below:

Hi folks, I’m just starting to take a look at this, very interesting and powerful so far.

Couple questions before I’m down the rabbit hole chasing ghosts…

  • Is running more than one CommandBox Lucee server at a time with different root directories supported?

Yes.

  • Is there any way to set the classpath for a CommandBox Lucee instance?

Class path for external jars?

Thanks Luis, and yes, I want to add the classpath for some external jars, for that specific instance only.

Dave

I would suggest you just create a “lib” folder in the application and add this to Application.cfc

// JAVA INTEGRATION: JUST DROP JARS IN THE LIB FOLDER
// You can add more paths or change the reload flag as well.
this.javaSettings = { loadPaths = [ “lib” ], reloadOnChange = false };

That’s it. Then you can create objects “java” as normal.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Makes sense, however, for reasons not worth going into, one of the apps in question doesn’t use Application.cfc, so that’s not a viable option. Is there any way to accomplish this at the CommandBox level? Doesn’t need to be app-specific, just per web-root/start-dir. Is that possible somehow?

Thanks,
Dave

You have several options.

  1. Add it to the web context server. If you run the command “server status —verbose” You will see the server location. There is a “lib” folder inside that location. Just drop any extra Jars there.
  2. CommandBox wide. If you go to ~/.CommandBox/engine/cfml/server/lucee-server/lib that is where you can place them

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Thanks Luis. Just to make sure I understand:

  • Option 2 affects every CommandBox instance, not what I need

  • Option 1 has me copy the jar(s) from each app into C:\Users{me}.CommandBox\server{SomeHash}-{RootDirName}\lib
    That’s more attractive, and sufficient if need be, but still not ideal. The jar(s) in question are created by the app’s build process, and are already present inside the instance directory. The most elegant solution would be some way to adjust the classpath for each instance running that app to point to the existing jar, inside that dir. For instances I create that run some version of that app (I work on multiple releases of it at once) it’s even in the same path relative to the root dir of the instance.
    Is anything like that feasible?

And once again Luis, thank you very much for your help on my unusual situation, and for CommandBox and your other tools. Great stuff!

Dave

So why doesn’t your build process copy it over to the instance lib location?

Build process generates the app installer zip, which can be deployed on any server, no relation to CommandBox instances. CommandBox “deployment” would be just for dev, where it’s super handy to spin up an ad hoc Lucee instance of any code base anywhere any time.

Is there a CommandBox onInstanceStartup hook? If so, maybe I could have that make the copy from the location inside the app.

My apologies for not having read all the docs yet and pestering you instead. I’ve known about ComandBox for a while now, thought it was very cool, but didn’t have a strong enough case fo actually using it in real life to put the time in. Now that I understand it can spin up a Lucee instance anywhere on demand, I’m trying to figure out whether there are any can’t-get-there’from-here issues for my situation before I dive in deeper.

Which in short means, thanks again for putting up with this stream of questions :slight_smile: Wish I’d picked a better thread title, so anyone else who’s interested in this question could find it.

Dave

Dave/Luis, Here is a vote to hopefully get to a resolution on this, and then have a simple step-by-step installation process for a newbie for Command Box on Windows 7. I had the same issue about java not on the path! Not sure why. After many commandbox installs, it seems to work now (and work very well!), but I certainly am not sure exactly why. Hopefully the instructions will have an example: "put COMMANDBOX here, make an instance there, be sure PATH is set to … " For me, this would be more helpful than me having to develop some installation script. I would give them a shot when trying the latest CommandBox.

As always, Luis and team, thanks for all the effort.

Don

If your final deployment is no Lucee, you can actually specify jar file when using createObject(). Honestly, the correct answer IMO is to use the JavaSettings in Application.cfc. The fact that you’re not using Application.cfc is really more a failure of your code and nothing to do with CommandBox since we’re just working within the CFML engine.

> Is there a CommandBox onInstanceStartup hook? If so, maybe I could have that make the copy from the location inside the app.

No, but this is something we’ve talked about several times for other reasons. I’ll take this as another vote for adding a listener system into CommandBox though we’d have to talk about how you’d configure the listeners and where they would be stored. I think this could go hand-in-hand with our planned task runner functionality. Perhaps even having some tasks that get run by convention based on their name.

> thanks again for putting up with this stream of questions

No worries at all. We love hearing about how CommandBox is being used so we know what features to focus on and where the pain points are.

Thanks!

~Brad

Don, I think you’re confused as to what this thread was about. It sounds like you had issues with the CommandBox binary not finding Java installed on your PC. This thread was about starting the embedded Lucee server and loading Jars for the CFML code to have access to.

That said, if you’d like to provide some feedback on the installation process for Windows (or whatever) please feel free to expound on a new thread. I’ll also note our docs are stored in a GitHub repo and and you can actually provide pull requests to update them!

Our current getting started guide is here:
http://ortus.gitbooks.io/commandbox-documentation/content/getting_started_guide.html

And our detailed installation guide is here:
http://ortus.gitbooks.io/commandbox-documentation/content/setup/installation.html

Thanks!

~Brad

Thanks for jumping in Brad. I agree that it’s “sub-optimal”, to put it kindly, that one of these apps doesn’t use Application.cfc, and it is being looked at, but that’s just not where that app is right now. When in Rome, you know, at least for now.

In a normal static ACF/Lucee/Railo environment, we just add our jar to the class path in jvm config, I’m looking for a way to do that, or some equivalent, on the fly for CommandBox instances.

I’ll keep an eye on this space for a hook plan then I guess.