Search code examples
jmeterjmeter-3.2

How to resolve updating GUI error in JMeter


I am facing 'problem updating GUI' error in JMeter. I am using web driver sample and when i inserted java script code. this error occurred. JMeter version - 3.3 I have tried with Lower versions as well like: 2.11, 3.0, 3.2 etc. but did not find the solution.

When this error occurred in log file under JMeter, i can see below exception: -

////////////////////////////////////////////////////////////////////////////////

jmeter.gui.action.ActionRouter: performAction(logger_panel_enable_disable) updateCurrentGui() onjava.awt.event.ActionEvent[ACTION_PERFORMED,cmd=logger_panel_enable_disable,when=0,modifiers=] on javax.swing.JButton[,1281,8,22x22,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@15a010e8,flags=16777504,maximumSize=,minimumSize=,preferredSize=,defaultIcon=jar:file:/C:/Users/gaurav.sharma/Downloads/apache-jmeter-2.11/apache-jmeter-2.11/lib/ext/ApacheJMeter_core.jar!/org/apache/jmeter/images/warning.png,disabledIcon=,disabledSelectedIcon=,margin=java.awt.Insets[top=0,left=0,bottom=0,right=0],paintBorder=false,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true] caused java.lang.ClassCastException: java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEventUndoableWrapper cannot be cast to java.desktop/javax.swing.text.AbstractDocument$DefaultDocumentEvent

////////////////////////////////////////////////////////////////////////////////


Solution

  • TL;DR Bug marked as fixed in latest JMeter

    This error occur in Java 9. It was reported in various projects as netbeans:

    This bug i due to a change in Java 9 where the edit of the argument (a DefaultDocumentEvent) is first wrapped in a DefaultDocumentEventUndoableWrapper which hides the line number and other important stuff (I can't understand why!!), before

    public void undoableEditHappened(UndoableEditEvent e)

    is invoked.

    https://github.com/netroby/jdk9-dev/blob/master/jdk/src/java.desktop/share/classes/javax/swing/text/AbstractDocument.java#L279

    This makes this cast break: AbstractDocument.DefaultDocumentEvent event = (AbstractDocument.DefaultDocumentEvent)e.getEdit();

    The problem is that this cast is widely used in all kinds of code - originating from this post from 2008: https://tips4java.wordpress.com/2008/10/27/compound-undo-manager/

    Here is a possible fix: https://github.com/nordfalk/jsyntaxpane/commit/5fc75594f8bc4df6e8f7096d4a440490b768fd46#diff-b3f8826824f551219879f1c798618c12R67

    JMeter does not yet support JAVA 9, next JMeter version should support it, you can help and follow progress on this item in Bug 61529.