Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Create new CF instances from command line

New Here ,
Jul 14, 2010 Jul 14, 2010

I'm running ColdFusion 9.0.0 Enterprise on CentOS 5.5 x86_64 with Apache 2.2.3 and connecting to databases on MS SQL Server 2005.  I'm trying to automate new server set up and would like to know if it is possible to create new ColdFusion instances via the command line, rather than by browsing to the CF Admin site and clicking on Add New Instance.  It seems to be possible to configure instances once they've been created by modifying the relevant xml files which are primarily in {cfserver_rootdir}/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib/.  But I don't know how to do the initial instance creation without the GUI.

If there is no way to trigger this via the command line, would it be reasonable instead to copy an existing instance and modify its configuration via the xml config files?  If so, how would I go about registering it with the main cfusion instance, so that it shows up under Enterprise Manager - Instance Manager?  Are there any potential problems with configuring instances this way?

1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 14, 2010 Jul 14, 2010

I can NOT tell you if this is or is not possible, and if it is I would have NO idea what the command line syntax would look like.

But, I might be able to provide you a hint on where to look for new information.  Multi-server ColdFusion is really just a JRun4 java server.  The ColdFusion administrator control panal you refer to is a special form of the JRun4 server control panal.  It is quite possible to use the JRun4 server control panal to manipluate the ColdFusion servers as well as any other Java Servers that may be on the system.  In fact, in CF 6, which was the first version to be on Java, the JRun4 server control panal was the ONLY way to do this.

So, if you look at the documentation for the JRun4 server control, there may be command line information there.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 14, 2010 Jul 14, 2010

Thanks for the suggestion Ian.  I did find some documentation for JRun 3.x that describes a command line utility that can create new JRun servers. (Or remove them or check for their existence.)  However, it does not seem to work with JRun 4.x, and the doc with command line information for 4.x makes no mention of the Server utility.

When I try to run the utility in 4.x I get an error because the class cannot be found:

[myuser@myserver foo]$ /usr/local/foo/cf9/jre/bin/java -cp /usr/local/foo/cf9/lib/jrun.jar allaire.jrun.tools.Server exists myjrunsrv /usr/local/foo/cf9
Exception in thread "main" java.lang.NoClassDefFoundError: allaire/jrun/tools/Server
Caused by: java.lang.ClassNotFoundException: allaire.jrun.tools.Server
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: allaire.jrun.tools.Server.  Program will exit.

Maybe this capability has been removed from JRun, or maybe it's just done some other way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jul 14, 2010 Jul 14, 2010

Cousin Scuzzy wrote:

Maybe this capability has been removed from JRun, or maybe it's just done some other way.

I'm afraid I know nothing about this!  Maybe somebody more knowledgeable can chime in.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 14, 2010 Jul 14, 2010

There is no command line utility for instance creation. If you want to program something, you have 2 options:

1. Have the admin application running and use its APIs to create a new instance. This requires a running instance and some custom JSP programming.

2. Change /lib/servers.xml to add your new instance, extract template.zip to lay out the filesystem and update some port numbers in the XML files (jrun.xml for sure, don't know if any of the others need updating) to set unique port numbers.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 14, 2010 Jul 14, 2010

I'm intrigued by option 1, but I don't know if/where the APIs are documented and the jsp programming is intimidating.

Option 2 seems simple enough, but I'm not sure where the contents of the new server should come from.  The contents of template.zip are only 340 kB, whereas a new JRun server instance created via CF Administrator is 240 MB.

I've had success copying an existing instance and then modifying lib/servers.xml, and correcting the port numbers as you mentioned.  The ones I modified in jrun.xml were for ProxyService and WebService, and I also changed the port for the java.naming.provider.url in jndi.properties.  Then there are a few xml files in cfusion.ear/cfusion.war/WEB-INF/cfusion/lib that can be modified to provide the settings I need.  This method isn't as sophisticated as I'd like, but it seems to work and meets the requirement of being scriptable.

Thanks to you and Ian for your help today!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 15, 2010 Jul 15, 2010
LATEST

Ah, the tricky nomenclature of J2EE servers. An instance is just a running process from the underlying Java layer. That instance is indeed only 340 KB. Then inside that instance you deploy ColdFusion as an Enterprise Application aRchive (EAR). To create one of those EARs, run the stanard ColdFusion installer and choose the option to create an EAR file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources