ハードな 1 週間の終わりなので、次のコードを何らかの形で強化できる可能性はかなり高いですが、通常はこのアプローチでうまくいくはずです。
<cfscript>
// this script is here http://XXXXXXX/test/paths/relative/reports/index.cfm
// component is here http://XXXXXXX/test/paths/relative/bin/myComponent.cfc
local = {};
// initialize with dynamic mapping
local.myComponentDynamic = createObject("component", "/bin/myComponent");
// grab the current directory name
local.parentPathExpanded = ExpandPath("../");
local.scriptPathExpanded = ExpandPath(cgi.SCRIPT_NAME);
local.thisDirectory = GetDirectoryFromPath(Replace(local.scriptPathExpanded, local.parentPathExpanded, ""));
// build base path
local.scriptPathDirectory = GetDirectoryFromPath(cgi.SCRIPT_NAME);
local.basePath = Replace(local.scriptPathDirectory, local.thisDirectory, "");
// this is relative path we already know
local.relativePath = "bin/myComponent";
// initialize with slash-syntax (path starting with /)
local.myComponentSlash = createObject("component", local.basePath & local.relativePath);
// convert path to the dot-syntax
local.dottedPath = Replace(local.basePath & local.relativePath, "/", ".", "ALL");
local.dottedPath = Right(local.dottedPath, Len(local.dottedPath)-1);
// initialize with dot-syntax path
local.myComponentDot = createObject("component", local.dottedPath);
</cfscript>
<cfdump var="#local#">
この例を読みやすく理解しやすくするために、プロセスを個別の変数に分割し、共通コンテナーをダンプしました。
ただし、Application.cfc で動的マッピングを使用できる場合は、それを使用してください。
編集:親フォルダーに Application.cfc があると仮定して、そのような例を追加しました (たとえば、index.cfm から見る場合は「../Application.cfc」)。
<cfcomponent output="false">
<cfset this.mappings["/bin"] = getDirectoryFromPath(getCurrentTemplatePath()) & "bin/" />
</cfcomponent>
私の「パス変換」の例は、楽しいトリックであり、コードをいじっているだけであり、優れたアプリケーションの単純なアプローチではありません。