[Looking for Charlie's main web site?]

How to identify what jvm.config a ColdFusion instance uses (and vice-versa)

Note: This blog post is from 2012. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
If you run ColdFusion in its Multiserver mode (multiple instances), you may know that you can configure things so that different instances use different jvm.config files, otherwise by default, all instances share just one. (If you didn't know how to change that, particularly if running CF as Windows Services, I'll offer some references explaining more.)

But have you ever wondered which jvm.config is used by a given instance? Or perhaps found multiple jvm.configs in your [jrun4]\bin directory and wondered which instance each went with? The answer isn't as straightforward as it may seem, when you're running CF as Windows Services. There's no single CF feature that reports this, but I do offer a solution here.

The simple answer is that one can find the information in the registry. The longer answer, including how to find that, as well as how to get that info more easily from the command line if you may prefer, follows.

Background

This question came up today on the Adobe ColdFusion Server Administration Forums, and I offered there what I think would be the best way to determine the answer. I wanted to blog it as well for those who don't see the forums (and also to learn if perhaps someone may have a still-better answer).

The question was related to CF8, and the answer applies to CF 6-9. Things are different in CF10, as now each instance in CF10 (Enterprise/Trial/Developer) can have its own jvm.config. I'll touch on that briefly at the end.

How instances and jvm.config files can be connected together

Again, assuming you're running CF on Windows and running each instance as a service, then the way to indicate a different jvm.config should be used for an instance is to modify the service definition to denote that. You would do that using the command line jrunsvc command and its config argument.

(For more info on how to setup different instances to use different jvm.config files, see blog entries as such as those from Steven Neiland, Nate Williams, and Mark Kruger, to name just a few.)

Sadly, there is no jrunsvc argument that lists these service definitions (that I know of), to see which jvm.config has been set for each instance.

And you can't find it by looking at the Windows service definition. You'll just see it pointing to jrunsvc.exe itself, not indicating which jvm.config it uses.

The answer is in the Registry

Instead, the configuration is saved as part of the Service definition as tracked by Windows in the Registry, and that's where you need to look to find this info. If you're comfortable using RegEdit, I'll share what you need to find it. If you may prefer to use a command-line tool instead, I'll show that also, which is helpful both to get for many instances quickly as well as to avoid risk of editing values by mistake in regedit.

First, note that all services are defined in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\. So let's say your service name of interest was "Adobe Coldfusion 8 AS instance1". You'd find that there's a key there with that name. And under that key you will see it has various values, among which is one (if you did modify it to have its own jvm.config) called "Parameters", which is where the JRunSVC command would place this config argument and value if provided.

So that's one way to find what config is used for what service.

Using the Command-line REG tool instead

But a second way is to use the REG command-line tool (should be available free within Windows on most versions that I've seen.)

You'd want to use its "query" argument, and you could then pass it the keyname whose values you want to see. (I'll show still another variant where you don't need to offer the keynames at all.)

Sticking with the approach of listing them one-by-one (for the sake of appreciating how things work), note that when you specify the keyname, you need to include the service (instance) name as well, so the keyname is a little varied from the one I showed above. Also note that if the service name has spaces, then you need to enclose the whole keyname in quotes.

Referring again to the example service I offered above, you could use:

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Adobe Coldfusion 8 AS instance1"

That will show all the values for that key and their data.

But even niftier is that you can get it to list JUST the one value you're interested in (in this case, the one called "parameters") and its data (the -config arg and its jvm file/path) using the /v argument:

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Adobe Coldfusion 8 AS instance1" /v parameters

This could show a result like this:

  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Adobe Coldfusion 8 AS instance1    

Parameters REG_SZ -config C:\Jrun4\bin\jvm2.config

So this is at least one way to find what jvm.config is used for each instance, if any is specified at all.

Using REG to list ALL the instances and any jvm.config definition

But it's tedious to do it that way, since you have to name each instance. Here's where the REG command has another nice argument we can use, to list all the jvm.configs for all the instances! Add the /s argument, and change the key to the level for all the services, as in:

reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services" /v parameters /s

This will return a list of each service definition which has a Parameters value (meaning, which has been modified by JRunSVC to specify a specific jvm.config). Here's an example of how that result could look:

  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Macromedia JRun CFusion Server    

Parameters REG_SZ -config C:\Jrun4\bin\jvm.config

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Adobe Coldfusion 8 AS instance1

Parameters REG_SZ -config C:\Jrun4\bin\jvm2.config

That's certainly a lot easier than listing each service one by one! :-) And if there is none that has a customized jvm.config (meaning, no Parameters value within the registry key), then it will return:

End of search: 0 match(es) found.

Of course, technically this variation of the REG QUERY command would return info on ANY services that may have a "Parameters" value, beyond just CF services. You could technically limit this result list still further, using any of a number of available arguments to the REG QUERY command, but that's beyond the scope of what I want to cover here. Use "REG QUERY /?" to get more details on its options.

A couple more REG QUERY tips

Before concluding, note also that the REG QUERY command lets you specify a machine name (before the keyname) so that you could run this against other servers in your network. Then there are those still other args I referred to above that may be of interest. Again, run "REG QUERY /?" from the command line to learn more about the tool.

What about in CF10?

Finally, I had mentioned how things are different in ColdFusion 10. How so? Well, first note that it no longer has the limit whereby all instances share only one default jvm.config. Instead, each instance has its own.

More specifically, each instance has its own bin directory, where its jvm.config lives. Whereas in CF 6-9, the jvm.config was in [jrun4]\bin, and therefore shared by all the instances, in CF10 there is no equivalent "central" directory for this.

So the first instance (still called cfusion) would have its jvm.config in C:\ColdFusion10\cfusion\bin. If you had an instance called instance1, that would have its jvm.config in C:\ColdFusion10\instance1\bin. So you see, there's also no longer a need to come up with new names for jvm.config files.

One last comment: some may have noticed (and I mentioned it in my "Hidden Gems in CF10" talk) that each instance's CF Admin DOES now have the "java and jvm" page (which previously did not exist in the CF Admin for any instances in CF 6-9.) But I'll point out that there's no field on that page that indicates what the name of (or path to) the jvm.config file is. But then it never has had that. Again, CF traditionally just used a jvm.config in its bin directory (in the Standard or Enterprise Server edition).

And that's now how CF10 works, whether using instances or not, so it's actually easier than when we had to worry with how to specify different ones for different instances.

Conclusion: Does this help? Know of other solutions?

Going back to the original question, I do think that using this registry info will be the most straight-forward way to get the listing of "what instances use what jvm.configs". For anyone interested in the topic, let me know in comments if this info helps or you need more info.

And indeed if you may know of some other solution to get the info (whether in some configuration info, or via some coding technique), please do share it.

For more content like this from Charlie Arehart: Need more help with problems?
  • If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
  • See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments
Thanks for the article. I manage a server with 10+ instances, each with their own JVM, and what I've done is name the JVM file based on the instance name. For example, jvm.config_Acme (where Acme is the instance name). This makes it pretty straightforward to track down which instance is using a given JVM file.

I'm happy to hear the JVM files in CF 10 are in their own instance bin directory, though.

Cheers,
Jose
# Posted By Jose Gosende | 6/27/12 11:11 AM
Great point, Jose. Doing something like that would certainly help prevent the problem.That said, I was focused more on those with the problem and how to get to the point of even being able to solve it that way. :-) Still, thanks for the kind regards.
I have one web site with different applications in different directories. I don't really want to move them to their own web site so I can run them in their own instance. Is it possible to setup another instance and have the cf pages in a certain directory use the new instance on the same web server?
# Posted By Chris | 8/17/12 8:16 AM
Thanks for all your hard work in the CF community.

Another way to determine which JVM file a Multiserver CF 9 instance is using on Windows2008 R2 is:

1) Open Task Manager
2) Go to 'Processes'
3) In the Menu: 'View' > 'Select Columns ...'
4) Select the 'Command Line' (checkbox)
5) 'OK'
6) Expand the 'Command Line' column
7) If you do not see '-config [custom_jvm_config]' then you're using the default, jvm.config.
# Posted By Glen Rainbird | 9/6/13 12:16 AM
@Glen, great point, and I want to smack my head that I didn't think to mention that, because I do indeed point people to that all the time when trying to show them which process is running a particular instance. I just didn't think to connect the dots when writing this entry to propose looking there at the jvm.config (if a custom one is defined). So thanks! :-)
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting