我收到返回 Vector 的函数之一的错误。在一切正常之前,我将返回类型从 Vector[] 更改为 Vector。
异常的stack Trace如下
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();
}
});
}
}
}