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:
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:
This could show a result like this:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Adobe Coldfusion 8 AS instance1Parameters 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:
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 ServerParameters 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:
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?
- Signup to get his blog posts by email:
- Follow his blog RSS feed
- View the rest of his blog posts
- View his blog posts on the Adobe CF portal
- 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
I'm happy to hear the JVM files in CF 10 are in their own instance bin directory, though.
Cheers,
Jose
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.