How to get Instance name in CommandBox CF 2018?

167 views Asked by At

I recently started using commandBox to run ColdFusion in my local environment. After I played around for a while one issue I run into was related to adminapi. Here is the code that I use in one of my projects:

adminObj = createObject("component","cfide.adminapi.runtime");
instance = adminObj.getInstanceName();

This code is pretty straight forward and work just fine if I install traditional ColdFusion Developer version on my machine. I tried running this on commandBox: "app":{ "cfengine":"[email protected]" }

After I run the code above this is the error message I got:

Object Instantiation Exception.
Class not found: com.adobe.coldfusion.entman.ProcessServer

The first debugging step was to check if component exists. I simply checked that like this:

adminObj = createObject("component","cfide.adminapi.runtime");
writeDump(adminObj);

The result I got on the screen was this:

component CFIDE.adminapi.runtime
        extends CFIDE.adminapi.base
METHODS

Then I tried this to make sure method exists in the scope:

adminObj = createObject("component","cfide.adminapi.runtime");
writeDump(adminObj.getInstanceName);

The output looks like this, and that confirmed that method getInstanceName exists.

function getInstanceName
Arguments:  none
ReturnType: any
Roles:   
Access: public
Output: false
DisplayName:     
Hint:   returns the current instance name
Description:

The error is occurring only if I call the function getInstanceName(). Does anyone know what could be the reason of this error? Is there any solution for this particular problem? Like I already mentioned this method works in traditional ColdFusion 2018 developer environment. Thank you.

1

There are 1 answers

1
Brad Wood On BEST ANSWER

This is a bug in Adobe ColdFusion. The CFC you're creating is trying to create an instance of a specific Java class. I recognize the class name com.adobe.coldfusion.entman.ProcessServer as being related to their enterprise manager which controls features only available in certain versions of CF as well as features only available on their "standard" Tomcat installation (as opposed to a J2E deployment like CommandBox).

Please report this to Adobe in the Adobe bug tracker as they appear to be incorrectly detecting the servlet installation. I worked with them a couple years ago to improve their servlet detection on CommandBox, but I guess they still have some issues.

As a workaround, you could try and find out what jar that class is from on a non-CommandBox installation of Adobe ColdFusion and add it to the path, but I can't promise that it will work and that it won't have negative consequences.