gpt4 book ai didi

coldfusion - 在 ColdFusion11 中使用 java 类 - CreateObject 函数的 java 对象类型未知

转载 作者:行者123 更新时间:2023-12-04 15:10:18 27 4
gpt4 key购买 nike

我有一些在 Railo 下工作的代码,但我试图让这个特定的应用程序在 CF10 和 CF11 上工作

这是一个 cfWheels 应用程序,我有一个 BCrypt.class /miscellaneous/ 中的文件目录。

在我的 /events/onapplicationstart.cfm文件,我有:

application.bCrypt = CreateObject( "java", "BCrypt", "/miscellaneous/" );

这适用于 Railo;但在 CF11 我得到
The java object type is unknown for the CreateObject function.

Verify the type of your object when creating it and try again.
Valid Types are : component | java | webservice | dotnet | com | corba | .NET


The error occurred in /Volumes/Documents/blah/public/events/onapplicationstart.cfm: line 8
Called from /Volumes/Documents/blah/public/wheels/global/cfml.cfm: line 111
Called from /Volumes/Documents/blah/public/wheels/events/onapplicationstart.cfm: line 388
6 :
7 : // BCrypt library
8 : application.bCrypt = CreateObject( "java", "BCrypt", "/miscellaneous/" );
9 :
10 : // Application Specific settings

我认为这只是一个语法问题?我可以在 CF10/11 上以这种方式调用 .class 文件吗?

最佳答案

啊谢谢大家。正如haxtbh所说in the comments ,问题是

Adobe CF's createObject only has two arguments. The type and the class.



所以我需要把:
this.javaSettings = { LoadPaths = ["/miscellaneous"] };
在/config/app.cfm

然后使用
CreateObject( "java", "BCrypt" );
在/events/onapplicationstart.cfm

关于coldfusion - 在 ColdFusion11 中使用 java 类 - CreateObject 函数的 java 对象类型未知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30454294/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com