我有以下Java類RemoteDBAccess裏面的驗證器包如下。基本上,類內的函數採用一個串作爲輸入,並返回字符串有效或無效作爲輸出:Flex - '無法創建類的類'錯誤RemoteObject
public class RemoteDBAccess {
public String Validator(String input)
{
String Output = "";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String connectionUrl = "jdbc:mysql://ctovm1873.dev.spotlight.com:3306/ttds";
String connectionUser = "root";
String connectionPassword = "root";
conn = DriverManager.getConnection(connectionUrl, connectionUser, connectionPassword);
stmt = conn.createStatement();
int rowcount = 0;
if(input.startsWith("CHG"))
{
rs = stmt.executeQuery("Select * from rm_projectrepository_gen where snow_change_id like '" + input + "'");
while (rs.next() != false) {
++rowcount;
}
}
else
{
rs = stmt.executeQuery("Select * from rm_projectrepository_gen where idRM_ProjectRepository_Gen like '" + input + "'");
while (rs.next() != false) {
++rowcount;
}
}
if(rowcount == 0)
{
Output = "invalid";
}
else{
Output = "valid";
}
}
catch (Exception e) {
e.printStackTrace();
}
return Output;
}
}
在遠程-config.xml的文件,我已經添加了目的地我的RemoteObject如下:`
<destination id="RemoteDBAccess">
<properties>
<source>validator.RemoteDBAccess</source>
</properties>
<adapter ref="java-object"/>
</destination>
在我的Flex代碼,我創建了的RemoteObject如下:<mx:RemoteObject id="BeforeWithAfterValidator" destination="RemoteDBAccess" source="validator.RemoteDBAccess" result="Alert.show(event.result.toString());" fault="Alert.show(event.fault.faultString);"/>
現在,當我用下面的代碼來調用遠程方法:
var Data:String = "1239";
Alert.show(BeforeWithAfterValidator.Validator(Data));
警示框顯示:無法創建類類型「validator.RemoteDBAccess」的。
請幫我解決這個問題。