我们创建了一个CFX客户标签和一个jar文件。 jar文件位于coldfusion服务器../WEB-INF/lib中。它成功处理多年。最近我们要升级到coldfusion11 linux。对于维护问题,系统管理员更喜欢将这些库文件从服务器WEB-INF / lib移出到应用程序本地目录。
以下是设置coldfusion 10的localpath的代码。
的Application.cfc
<cfcomponent>
<cfscript>
//this.name = hash( getCurrentTemplatePath() ); // unique app name
this.javaSettings = {
loadPaths: [
"/opt/WebRoot-DEV/afsapps/tp-web-apps/payroll/process/java/lib"
],
loadColdFusionClassPath: true,
reloadOnChange: true,
watchInterval: 100,
watchExtensions = "jar,class"
};
</cfscript>
<cffunction name="OnRequestStart" returnType="void">
<cfargument name="targetPage" type="string" required="true" />
<!--- Include Application.cfm --->
<cfinclude template="Application.cfm" />
</cffunction>
</cfcomponent>
但它不起作用,可以找到jar文件。我收到此错误消息: “错误消息是”在自定义标记数据库中找不到CFX自定义标记CFX_GenerateGarnishmentDocuments。您必须在使用之前将自定义标记添加到数据库。如果已将标记添加到数据库,请检查模板中标记的拼写,以确保它与数据库条目匹配。 “
我不确定我们是否可以将库文件移动到本地路径,这是否可行?如果是的话,该怎么办?
答案 0 :(得分:0)
As the error message says - it is not enough to simply add the jar file. You must also register it in the ColdFusion Adminstrator under "Extensions->CFX Tags" ... A CFX tag is a specific jar file that implements a native API interface to CF so it can be used without java. it's a special thing.
Step 1 is to get your file INTO the class path. You can do this by putting it in the Lib director, or you can specify the path via the JVM args like so:
Restart CF and then register the CFX Tag in the CF Administrator like so:
The class name will be part of the documentation of the CFX tag. To use it you then call it as one thing - CFX_nameofthetag with attributes specified by the documentation.
CFX is basically a wrapper so that you can use something more complex and Java like in a simple primitive values in/out and get something coldfusiony back like a query or struct. It's designed to let you do ColdFusion without knowing a lot of Java. :)