我正在使用Coldfusion8,并且被困在试图调用组件。这一直持续到几天前,虽然我不记得更改了什么,但我对这个组件的所有调用现在都失败了。
在这里,代码:
<cfinvoke component="form_mailer_user" method="msg_contact">
<cfinvokeargument name="userData" value="#Local.User#"/>
</cfinvoke> 除了传递一个结构之外,没有什么特别的东西是论点。
我得到了以下错误:
Could not find the ColdFusion Component or Interface form_mailer_user.
Ensure that the name is correct and that the component or interface exists它存在的很好..。那么,我能做些什么来尝试访问它呢?
谢谢你帮忙!
编辑:
这两个文件都位于一个名为services的文件夹中。我在我的application.cfc中有这个文件夹的映射
THIS.mappings["/services"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "services";但是试图像这样调用组件:
services.form_mailer_user
services.form_mailer_user.cfc也不管用。
编辑:
我的application.cfc
<cfcomponent displayname="Application" output="false" hint="Application handler">
<cfscript>
THIS.name = "abc";
THIS.sessionManagement = "true";
THIS.sessionTimeout = createTimeSpan(0,2,0,0);
THIS.s3.acceesKeyid = "___";
THIS.s3.awsSecretKey = "___";
// mappings
THIS.mapping = {};
THIS.mappings["/controllers"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "controllers";
THIS.mappings["/services"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "services";
</cfscript>
<cffunction name="onApplicationStart" returnType="boolean" output="false" hint="">
<cfscript>
Application.strConfig = structNew();
Application.strConfig.datasource = "___";
Application.strConfig.rootDir = "test/members/";
Application.strConfig.emailErrorMessaging = "on";
// pre
Session.activeSession = "No";
Session.activeLog = "No";
</cfscript>
<cfreturn true />
</cffunction>
<cffunction name="onSessionStart" returnType="boolean" output="false" hint="session initalizer">
<cfscript>
var Local = {};
Local.cfid = Session.cfid;
Local.cftoken = Session.cftoken;
StructClear( SESSION );
</cfscript>
<!---SESSION --->
<cfparam name="Session.log" default="">
<cfparam name="Session.activeLog" default="No">
<cfscript>
Session.cfid = Local.cfid;
Session.cftoken = Local.cftoken;
Session.activeSession = "Yes";
Session.datasource = Application.strConfig.datasource;
Session.testpath = "tes/";
Session.tpu = "../";
Session.bucketPath = "http://s3.amazonaws.com/";
Session.bucketName = "___";
</cfscript>
<cfreturn true />
</cffunction>
<cffunction name="onRequestStart" returnType="boolean" output="false" hint="Pre page processing!">
<cfscript>
var LOCAL = {};
</cfscript>
<!--- DEBUG --->
<!---
<cfif structKeyExists(url,'reset')>
<cfcache action="flush">
<cfset OnApplicationStart() />
<cfset THIS.OnSessionStart() />
</cfif>
--->
<cfif len( Session.errMsgs ) EQ 0>
<cfinvoke component="services.errorMsg" method="createErrMsgsLog" returnvariable="errMsgs"></cfinvoke>
<cfset Session.errMsgs = errMsgs>
</cfif>
<cfreturn true />
</cffunction>
<!--- custom functions --->
<cfinclude template="templates/tmp_functions.cfm">
</cfcomponent>编辑
我想我越来越近了。我有另一个邮件程序(相同的文件夹),我刚刚交换了这个来替换我的
<cfinvoke component="form_mailer_other" method="msg_contact">
<cfinvokeargument name="userData" value="#Local.User#"/>
</cfinvoke>现在Cold聚变无法找到方法,但这意味着它找到了cfc。那么,这会是我的mailer.cfc中的一个错误吗?
解决方案:
我不敢说..。
输入文件名from_mailer_user ..。谢谢大家的帮助!
发布于 2012-08-19 22:11:51
如果CFC和CFM文件不在同一个目录中,则需要添加CFC所在的带有点的目录名。见下文。(directory.form_mailer_user)
发布于 2013-03-10 19:04:35
在无法“看到”的方法的定义中添加属性access="public",如下所示:
<cffunction name="onRequestStart" access="public" returnType="boolean" output="false" hint="Pre page processing!"> ...https://stackoverflow.com/questions/12030318
复制相似问题