Results 1 to 10 of 10
  1. #1
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Posts
    10
    Rep Power
    0

    Default java.lang.VerifyError

    I got the message ON and OFF. previously i got the same message.
    without changing the java code...sometime...it runs normally.
    Today, i got the problem agian.

    Please guide what is the problem?

    TIA



    Exception in thread "main" java.lang.VerifyError: (class: ResultSetTableModel, method: <init> signature: (Ljava/sql/ResultSet;)V) Constructor must call super() or this()
    at ResultSetFrame.actionPerformed(ResultSetTable23.ja va:251)
    at javax.swing.JComboBox.fireActionEvent(JComboBox.ja va:1240)
    at javax.swing.JComboBox.contentsChanged(JComboBox.ja va:1311)
    at javax.swing.AbstractListModel.fireContentsChanged( AbstractListModel.java:100)
    at javax.swing.DefaultComboBoxModel.setSelectedItem(D efaultComboBoxModel.java:88)
    at javax.swing.DefaultComboBoxModel.addElement(Defaul tComboBoxModel.java:126)
    at javax.swing.JComboBox.addItem(JComboBox.java:696)
    at ResultSetFrame.<init>(ResultSetTable23.java:220)
    at ResultSetTable23.main(ResultSetTable23.java:14)

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default

    Show us the code.
    Looks like you have your constructor set up incorrectly in ResultSetFrame.
    Show use the constructor around line 251 in ResyltSetTable23.java.

  3. #3
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Posts
    10
    Rep Power
    0

    Default code

    public void actionPerformed(ActionEvent evt)
    { //System.out.println(tableNames + "123");
    if (evt.getSource() == tableNames)
    { // show the selected table from the combo box

    if (scrollPane != null)
    //System.out.println("me");
    getContentPane().remove(scrollPane);
    try
    { String tableName
    = (String)tableNames.getSelectedItem();
    if (rs != null) rs.close();
    //System.out.println(tableName);
    //System.out.println("PROVEN??????");
    String query = "SELECT * FROM " + tableName;
    rs = stmt.executeQuery(query);
    //System.out.println(SCROLLABLE+"z1y2");
    if (SCROLLABLE)
    modelzyx = new ScrollingResultSetTableModel(rs);
    else
    modelzyx = new CachingResultSetTableModel(rs);

    JTable table = new JTable(modelzyx);
    scrollPane = new JScrollPane(table);
    getContentPane().add(scrollPane, "Center");
    pack();
    doLayout();
    }
    catch(SQLException e)
    { System.out.println("Error " + e);
    }
    }
    }

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default

    So, which is line 251?
    Also please use code tags.

    Oh, and while you're at it can you show us the constructor?
    That seems to be the root of this.

  5. #5
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Posts
    10
    Rep Power
    0

    Arrow

    Dear Tolls,

    sorry i miss the reference line 251 by now as i have added some comment line in it.

    Here is the structure of the public class:
    Java Code:
    public class ResultSetTable23 {
       public static void main(String[] args)
       {  JFrame frame = new ResultSetFrame();
    .....

    1st InnerClass
    Java Code:
    abstract class ResultSetTableModel extends AbstractTableModel
    {  public ResultSetTableModel(ResultSet aResultSet)
       {  rstm23 = aResultSet;
    2nd InnerClass
    Java Code:
     
    class ScrollingResultSetTableModel extends ResultSetTableModel 
    {  public ScrollingResultSetTableModel(ResultSet aResultSet)
       {  super(aResultSet);
    ...

    3rd InnerClass:
    Java Code:
    class CachingResultSetTableModel extends ResultSetTableModel
    {  public CachingResultSetTableModel(ResultSet aResultSet)
       {  super(aResultSet);
    ...

    4th InnerClass:
    Java Code:
    class ResultSetFrame extends JFrame
       implements ActionListener
    {  public ResultSetFrame()
       {  setTitle("ResultSet");
    .   .....
        }
    
       public void actionPerformed(ActionEvent evt)
    ....
    ///I think this is the problem:
     if (SCROLLABLE)
                   modelzyx = new ScrollingResultSetTableModel(rsFrame);
      else
                   modelzyx = new CachingResultSetTableModel(rsFrame);
    
    ....
    public ResultSetTableModel modelzyx;
    public ResultSet rsFrame;
    }

    Other Public Class.


    Java Code:
    public class ResultSetTableModel implements TableModel { 
        public ResultSet resultsTM;             
        public ResultSetMetaData metadataTM;    
        public int numcolsTM, numrowsTM; 
    
    
    /////the constructor
    public ResultSetTableModel(ResultSet aResultSet) throws SQLException {
    	this.resultsTM = aResultSet;                
    	metadataTM = resultsTM.getMetaData();    
                 numcolsTM = metadataTM.getColumnCount();    
    	resultsTM.last();                         	
                 numrowsTM = resultsTM.getRow();         
    }
    ...

    TQ

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default

    What is the rest of this constructor:
    Java Code:
    abstract class ResultSetTableModel extends AbstractTableModel
    {  public ResultSetTableModel(ResultSet aResultSet)
       {  rstm23 = aResultSet;
    ?

    This is what it's complaining about (I got the wrong class earlier, sorry).

  7. #7
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Posts
    10
    Rep Power
    0

    Default

    Here is the complete constructor of InnerClass of public class ResultSetTable23

    Java Code:
    abstract class ResultSetTableModel extends AbstractTableModel
    involving ResultSetTableModel.
    {  public ResultSetTableModel(ResultSet aResultSet)
       {  rstm23 = aResultSet;
                try
          {  rsmd23 = rstm23.getMetaData();
             ///System.out.println(rsmd);
          }
          catch(SQLException e)
          {  System.out.println("Error " + e);
          }
       }
    TIA

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default

    I've just noticed that you have two classes with the same name.
    OK, one is an inner class, but it's still a bit confusing to read...

    Anyway, your frame is still being built and you already have events being fired. It looks like you are trying to do something with one of these not-yet-built objects. Either don't attach the listeners until after you've added all the data you want, or (and this may not work) use anonymous listeners, or a different listener class, rather than having the Frame being a listener.

    Personally I find extending JFrame to be a mistake anyway. You're nto extending the Frame, you're using it. But that's by the by.

  9. #9
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Posts
    10
    Rep Power
    0

    Default

    i am so confused...because sometime it works Properly...but when i do with other java...it is NOT work again.

    Trying to get the error from var\cache\index.

    Here is the err of "ResultSetTable.java.err"
    :
    Java Code:
    ERROR:15:duplicate class\d A_JavaCode.ResultSet.ResultSetTableModel
    ERROR:26:method does not override or implement a method from a supertype
    ERROR:62:cannot find symbol\n  symbol\d   method getResultSet()\n  location\d class A_JavaCode.ResultSet.ScrollingResultSetTableModel
    ERROR:77:cannot find symbol\n  symbol\d   method getResultSet()\n  location\d class A_JavaCode.ResultSet.ScrollingResultSetTableModel
    ERROR:57:unreported exception java.sql.SQLException; must be caught or declared to be thrown
    ERROR:97:cannot find symbol\n  symbol\d   method getResultSet()\n  location\d class A_JavaCode.ResultSet.CachingResultSetTableModel
    ERROR:93:unreported exception java.sql.SQLException; must be caught or declared to be thrown

  10. #10
    Andri_JT is offline Member
    Join Date
    Jan 2011
    Posts
    10
    Rep Power
    0

    Default

    Dear Tolls/All,

    thank you for the feedback and response.

    this case being closed due to i have not close the connection...so while other java.code try to access the same database...it is conflicted.

    TIA.

Similar Threads

  1. Replies: 5
    Last Post: 03-17-2011, 02:26 PM
  2. Replies: 8
    Last Post: 11-04-2010, 01:46 PM
  3. Replies: 5
    Last Post: 06-02-2010, 01:05 PM
  4. Replies: 3
    Last Post: 06-01-2010, 03:01 PM
  5. Replies: 2
    Last Post: 09-18-2008, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •