Search code examples
tomcatcoldfusioncoldfusion-10

Get instance name in ColdFusion 10


How can I get the name of the ColdFusion instance ("cfusion" for example) in ColdFusion 10?

Pre-10 you could do so by using the jrun java object:

<cfobject action="create" type="java" class="jrunx.kernel.JRun" name="jr">

#jr.getServerName()#

But since Jrun has been replaced by Tomcat I need to find a new way of getting the instance name.

I know it can be done using the admin api but that does not work for me because of security issues.


Solution

  • look in the server scope. There is a value at server.coldfusion.rootdir. On CF10 this is the directory of the instance. So for the "cfusion" instance on my Mac for example, this value is /Applications/ColdFusion10/cfusion. You could grab the last directory namd in the path and that is the name of the instance. Not exactly elegant, but might get you what you need.