JDK-7051182 : Regression: : jconsole scripting demo fails with UndeclaredThrowableException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.script
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2011-06-03
  • Updated: 2013-08-07
  • Resolved: 2013-08-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Resolved
Related Reports
Duplicate :  
Relates :  
Description
REGRESSION
----------
Not reproducible with JDK 7 b125 and earlier.
Not reproducible with JDK 6.
Licensee suspects CR 6980447, which was fixed in JDK 7 b126.

SYNOPSIS
--------
Regression: jconsole scripting demo fails with UndeclaredThrowableException

OPERATING SYSTEM
----------------
All (tested on Windows and Linux)

FULL JDK VERSION
----------------
JDK 7 b126 onwards
Not reproducible with Java 6


REPRODUCTION INSTRUCTIONS
-------------------------
1. Run jconsole as follows:

   jconsole -pluginpath <%JAVA_HOME%>\demo\scripting\jconsole-plugin\jconsole-plugin.jar

2. Select the jconsole process (Local Process
   sun.tools.jconsole.JConsole -pluginpath jconsole-plugin.jar)
   and click on 'Connect' button.

3. Select 'Script Shell' tab

4. Type "help()" at the prompt and hit return

Expected behaviour:
Usage information should be printed.

Observed behaviour:
A console window appears, containing lots of instances of the following Exception:

Exception in thread "AWT-EventQueue-0" java.lang.reflect.UndeclaredThrowableException
        at $Proxy7.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:660)
        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)
Caused by: java.security.PrivilegedActionException: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: Can't find method javax.swing.JComponent.print(string). (<built-in jconsole.js>#781) in <built-in jconsole.js> at line number 781
        at java.security.AccessController.doPrivileged(AccessController.java:294)
        at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler.invoke(InterfaceImplementor.java:66)
        ... 9 more
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: Can't find method javax.swing.JComponent.print(string). (<built-in jconsole.js>#781) in <built-in jconsole.js> at line number 781
        at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:226)
        at com.sun.script.javascript.RhinoScriptEngine.invokeMethod(RhinoScriptEngine.java:192)
        at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler$1.run(InterfaceImplementor.java:71)
        at java.security.AccessController.doPrivileged(AccessController.java:288)
        ... 10 more
Caused by: sun.org.mozilla.javascript.internal.EvaluatorException: Can't find method javax.swing.JComponent.print(string). (<built-in jconsole.js>#781)
        at sun.org.mozilla.javascript.internal.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
        at sun.org.mozilla.javascript.internal.Context.reportRuntimeError(Context.java:962)
        at sun.org.mozilla.javascript.internal.Context.reportRuntimeError(Context.java:1018)
        at sun.org.mozilla.javascript.internal.Context.reportRuntimeError1(Context.java:981)
        at sun.org.mozilla.javascript.internal.NativeJavaMethod.call(NativeJavaMethod.java:166)
        at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Interpreter.java:1711)
        at sun.org.mozilla.javascript.internal.Interpreter.interpret(Interpreter.java:854)
        at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:164)
        at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(ContextFactory.java:429)
        at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(ScriptRuntime.java:3163)
        at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:162)
        at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:220)
        ... 13 more

Comments
This is duplicate of JDK-7023754 (which is fixed in jdk8)
07-08-2013

EVALUATION Yes, this issue is reproducible as mentioned in "Description". But, I tried a standalone program - with a class called Window extending JPanel. The print(String) method on such window object can be called. So, it appears this is something specific with demo's scenario. I'd like to defer to this demo bug to update release.
06-06-2011