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

时间:2015-05-26 09:11:42

标签: coldfusion coldfusion-10 railo cfwheels

我有一些代码可以在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文件吗?

1 个答案:

答案 0 :(得分:5)

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

  

Adob​​e CF的createObject只有两个参数。类型和   类。

所以我需要把:

this.javaSettings = { LoadPaths = ["/miscellaneous"] };

/config/app.cfm中的

然后使用

CreateObject( "java", "BCrypt" );

/events/onapplicationstart.cfm中的