我在 JMeter 中遇到“更新 GUI 时出现问题”错误。我正在使用 Web 驱动程序示例,并且当我插入 java 脚本代码时。发生此错误。 JMeter 版本 - 3.3 我也尝试过较低版本,例如:2.11、3.0、3.2 等,但没有找到解决方案。
当 JMeter 下的日志文件中发生此错误时,我可以看到以下异常: -
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
最佳答案
TL;DR 在最新的 JMeter 中标记为已修复的错误
此错误发生在 Java 9 中。在各个项目中将其报告为 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.
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 尚不支持 JAVA 9,下一个 JMeter 版本应该支持它,您可以在 Bug 61529 中帮助并跟踪此项目的进度。 .
关于jmeter - 如何解决 JMeter 中更新 GUI 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47571351/