2015-09-09 20 views
-1

我有以下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”的。

请帮我解决这个问题。

回答

0

我去我的Tomcat的安装WEB-INF/classes文件夹内创建了一个名为验证文件夹,里面我把我的RemoteDBAccess.class文件(即有理我的RemoteObject(验证程序.RemoteDBAccess)。 然后,重新启动Tomcat服务器,重新构建我的柔性代码并使其工作。