0

I'm currently making a system using a three layer architecture where the clients communicate with a business layer through RMI which in turn communicate with the a database layer using JDBC.

During testing i sometimes get an exception that i can't make any sense of. The exception occurs when a client makes a change (The change is sent to the business layer, saved in the database and distributed to the other clients). However, i do not know where in this process the exception is thrown, as the stack trace provides no location? Stack trace provided below.

The exception only seem to occur when there are two or more clients connected. (the 3>=0 part does not seem to be related to the number of clients) It's usually something between 0>=0 and 5>=0.

My best guess is that something happens when attempting to send the change to all the clients, but i can't make any sense of this stack trace. The only known source is this line

at java.security.AccessController.doPrivileged(Native Method)

Full stack trace:

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 3 >= 0
at java.util.Vector.elementAt(Unknown Source)
at javax.swing.table.DefaultTableModel.getValueAt(Unknown Source)
at javax.swing.JTable.getValueAt(Unknown Source)
at javax.swing.JTable.prepareRenderer(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1200(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
User892313
  • 225
  • 3
  • 19
  • Are you calling `JTable.getValueAt`? Or otherwise rendering a table with your data? – OneCricketeer Sep 25 '16 at 13:18
  • 2
    The stack trace gives you lots of information. Your issue is at `javax.swing.table.DefaultTableModel.getValueAt` where your table is trying to render a value that doesn't exist. It looks to me like you've changed the data in the `JTable` without telling it, and then asked to it redraw itself - which causes it to crash. – Boris the Spider Sep 25 '16 at 13:19
  • 2
    does [this](http://stackoverflow.com/questions/1732503/java-lang-arrayindexoutofboundsexception-0-0-attempting-to-populate-jtable) help? – Sabir Khan Sep 25 '16 at 13:21
  • Oh! Thank you guys, i am indeed modifying some tables. I will take a look at that! Just out of curiosity, the stack trace usually provides the class and line where things went wrong, how come that is not happening in this case? – User892313 Sep 25 '16 at 13:24
  • I guess that is because there are several layers of abstraction here. Basically your code touches something "in the left corner" in a wrong way; but that doesn't become a problem until something "on the far right corner" is working with that other thing. – GhostCat Sep 25 '16 at 13:25
  • I see. Thanks for all the answers! – User892313 Sep 25 '16 at 13:27

0 Answers0