Flex - '无法创建类的类'错误RemoteObject

时间:2015-09-09 14:17:13

标签: java actionscript-3 flex remoteobject

我在验证器包中有以下Java类 RemoteDBAccess ,如下所示。基本上,类中的函数将字符串作为输入,并返回字符串有效无效作为输出:

    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;
    }

}

remoting-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'的类。

请帮我解决这个问题。

0 个答案:

没有答案