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

Use java class in ColdFusion11 - The java object type is unknown for the CreateObject function

我有一些代码可以在 Railo 下运行,但我正在尝试让这个特定的应用程序在 CF10 和 CF11 上运行

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

在我的 /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 所说 ,问题是

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