线程“AWT-EventQueue-0”中的异常java.lang.NoSuchMethodError在Swing方法中

时间:2013-04-29 11:39:05

标签: java swing netbeans-7 nosuchmethoderror

我收到了一个返回Vector的函数的错误。在每件事情都正常工作之前,我将返回类型从Vector []更改为Vector。

异常的堆栈跟踪如下

  Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: DB.DBEngine.getComboDataAllQry(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Vector;
at jewelleryerpapplication.GUI.Orders.Orders.GetComboData(Orders.java:313)
at jewelleryerpapplication.GUI.Orders.Orders.formWindowOpened(Orders.java:3323)
at jewelleryerpapplication.GUI.Orders.Orders.access$800(Orders.java:70)
at jewelleryerpapplication.GUI.Orders.Orders$10.windowOpened(Orders.java:1936)
at java.awt.AWTEventMulticaster.windowOpened(AWTEventMulticaster.java:339)
at java.awt.Window.processWindowEvent(Window.java:2042)
at javax.swing.JFrame.processWindowEvent(JFrame.java:296)
at java.awt.Window.processEvent(Window.java:2003)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

代码的SSCCE如下

    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.util.Vector;
    import java.util.logging.Level;
    import java.util.logging.Logger;



    class DBUtil.DBEngine {

       public static Vector<Object> getComboDataAllQry( String colId,String colName,String tblName) throws Exception {

       Vector<Vector<String>> comboVector = new Vector<Vector<String>>();
       Vector<Object> test = new  Vector<Object>();

       Connection conn = dbConnection(dbName);

       ResultSet rsCombo=GetResultSetForQry(" Select"+colId+","+colName+" from "+tblName);
        ResultSet rsAllData=GetResultSetForQry(" Select * from "+tblName);   

       Vector<String> colNames = getColumnNamesFromResultSet(rsAllData);
       Vector<Vector<String>> comboVector = GetVctFromResultSet(rs_);

       Vector<Vector<String>> compResultSet = GetVctFromResutSet(rsAllData;


       test.add(comboVector);
       test.add(compResultSet);
       test.add(colNames);
       return test;
    } 
}

   import DBUtil.DBEngine;


    public class  jewelleryerpapplication.GUI.Orders.Orders{
   JComboBox orders=null;
   Vector<Vector<String> dataAll=null;
     public static void GetComboData(){
     Vector<Object> obj=   DBUtil.DBEngine.getComboDataAllQry("OrderID","OrderName"+"OrdersNew.dbo.Orders");

  Vector<Vector<String>> ComboData =(Vector<Vector<String>>)obj.get(0);
  Vector<Vector<String>> data =(Vector<Vector<String>>)obj.get(1);
  orders =New JComboBox(new DefaultComboBoxModel(ComboData))'

}

 public void formWindowOpened(){
  GetComboData();
    }

    public static void main(String args[]) {
   java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
              formWindowOpened();
            }
        });
    }

    }


}

1 个答案:

答案 0 :(得分:3)

您的调用代码仍然会看到旧版本的被调用代码,该代码具有不返回数组的旧方法。这不是编程问题,而是在运行/部署之前如何构建项目。建议:清理一切并从头开始重建。