Bug 65388 - Unable to make field private static * accessible module * does not * to unnamed module
Summary: Unable to make field private static * accessible module * does not * to unnam...
Status: RESOLVED DUPLICATE of bug 65300
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: Nightly (Please specify date)
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2021-06-17 11:35 UTC by Rabin
Modified: 2021-06-26 18:50 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rabin 2021-06-17 11:35:38 UTC
Hello, 

after upgrading my Fedora machine to F34 and using Java 16 I started to get this message and JMeter will fail to load.

```
An error occurred: Unable to make field private static java.lang.String sun.awt.X11.XToolkit.awtAppClassName accessible: module java.desktop does not "opens sun.awt.X11" to unnamed module @667a738
```

I'm not a java developer, But after looking a bit on stack-oferflow, I found this  [1] question and one thing to the other ...


I edit the `jmeter.sh` and added this option to JAVA9_OPTS variable

 
 --add-opens=java.desktop/sun.awt.X11=ALL-UNNAME

So my script looks like this now, 



# Check if Java is present and the minimal version requirement
if [ "$CURRENT_VERSION" -gt "$MINIMAL_VERSION" ]; then
    JAVA9_OPTS+=" --add-opens java.desktop/sun.awt=ALL-UNNAMED"
    JAVA9_OPTS+=" --add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED"
    JAVA9_OPTS+=" --add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED"
    JAVA9_OPTS+=" --add-opens java.desktop/sun.swing=ALL-UNNAMED"
    JAVA9_OPTS+=" --add-opens java.desktop/javax.swing.text.html=ALL-UNNAMED"
    JAVA9_OPTS+=" --add-opens=java.base/java.lang=ALL-UNNAMED"
    JAVA9_OPTS+=" --add-opens=java.base/java.lang.invoke=ALL-UNNAMED"
fi

And that seems to help, and now jmeter is loading again.




[1] https://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m
Comment 1 Felix Schumacher 2021-06-17 15:07:36 UTC
Out of curiosity: Any reason for using bin/jmeter.sh instead of bin/jmeter?

The opens directives have been copied from jmeter script to jmeter.sh script and should work now. It would be nice, if you could report back if that is really the case :)

Thanks for the report.

commit 659c1ff5eaea941eb7ad0638b58e904dcc06d961
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Thu Jun 17 17:02:04 2021 +0200

    Fix jmeter.sh on Java 16
    
    Copy the opens-directives from bin/jmeter to bin/jmeter.sh.
    
    Bugzilla Id: 65388
    Bugzilla Id: 65300
---
 bin/jmeter.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

*** This bug has been marked as a duplicate of bug 65300 ***
Comment 2 Rabin 2021-06-17 15:49:49 UTC
(In reply to Felix Schumacher from comment #1)
> Out of curiosity: Any reason for using bin/jmeter.sh instead of bin/jmeter?
> 
> The opens directives have been copied from jmeter script to jmeter.sh script
> and should work now. It would be nice, if you could report back if that is
> really the case :)
> 
> Thanks for the report.
> 

Not sure why, I created the .desktop file long time ago, so maybe back then, it didn't have this problem.

I just tested running `bin/jmeter` and it seems to work OK.

Out of curiosity: Why there are 2 files ? :)
Comment 3 Matias piloni 2021-06-26 15:57:35 UTC
I have the same problem. I run jmeter.jar
Java version 8 update 291 build 1.8.0_192-b10

java.lang.IllegalAccessError: class com.github.weisj.darklaf.ui.label.DarkLabelUI (in unnamed module @0x3b938003) cannot access class sun.swing.SwingUtilities2 (in module java.desktop) because module java.desktop does not export sun.swing to unnamed module @0x3b938003
	at com.github.weisj.darklaf.ui.label.DarkLabelUI.paint(DarkLabelUI.java:83) ~[darklaf-core-2.5.4.jar:2.5.4]
	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161) ~[?:?]
	at javax.swing.JComponent.paintComponent(JComponent.java:797) ~[?:?]
	at javax.swing.JComponent.paint(JComponent.java:1074) ~[?:?]
	at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?]
	at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?]
	at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?]
	at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?]
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) ~[?:?]
	at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?]
	at javax.swing.JComponent.paintToOffscreen(JComponent.java:5271) ~[?:?]
	at javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1643) ~[?:?]
	at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1618) ~[?:?]
	at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1556) ~[?:?]
	at javax.swing.RepaintManager.paint(RepaintManager.java:1323) ~[?:?]
	at javax.swing.JComponent.paint(JComponent.java:1060) ~[?:?]
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39) ~[?:?]
	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:75) ~[?:?]
	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:112) ~[?:?]
	at java.awt.Container.paint(Container.java:2003) ~[?:?]
	at java.awt.Window.paint(Window.java:3949) ~[?:?]
	at javax.swing.RepaintManager$4.run(RepaintManager.java:876) ~[?:?]
	at javax.swing.RepaintManager$4.run(RepaintManager.java:848) ~[?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:391) ~[?:?]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848) ~[?:?]
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823) ~[?:?]
	at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772) ~[?:?]
	at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1884) ~[?:?]
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316) [?:?]
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) [?:?]
	at java.awt.EventQueue$4.run(EventQueue.java:721) [?:?]
	at java.awt.EventQueue$4.run(EventQueue.java:715) [?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:391) ~[?:?]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) ~[?:?]
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) ~[?:?]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) ~[?:?]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117) ~[?:?]
	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190) ~[?:?]
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235) ~[?:?]
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233) ~[?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:312) [?:?]
	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233) ~[?:?]
	at java.awt.Dialog.show(Dialog.java:1079) ~[?:?]
	at java.awt.Component.show(Component.java:1720) ~[?:?]
	at java.awt.Component.setVisible(Component.java:1667) ~[?:?]
	at java.awt.Window.setVisible(Window.java:1032) ~[?:?]
	at java.awt.Dialog.setVisible(Dialog.java:1014) ~[?:?]
	at org.apache.jmeter.SplashScreen.lambda$showScreen$0(SplashScreen.java:95) ~[ApacheJMeter_core.jar:5.4.1]
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316) ~[?:?]
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) ~[?:?]
	at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
	at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:391) [?:?]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) [?:?]
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) [?:?]
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?]
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]
Comment 4 Felix Schumacher 2021-06-26 18:47:11 UTC
(In reply to Matias piloni from comment #3)
> I have the same problem. I run jmeter.jar
> Java version 8 update 291 build 1.8.0_192-b10

You can't have this kind of stack trace with Java 8. The module system has been introduced with Java 9 and the classes in the exception have been closed even later.

This bug has been fixed in trunk, so try again (with your later than Java 8 runtime) with a nightly build or build from trunk.

> 
> java.lang.IllegalAccessError: class
> com.github.weisj.darklaf.ui.label.DarkLabelUI (in unnamed module
> @0x3b938003) cannot access class sun.swing.SwingUtilities2 (in module
> java.desktop) because module java.desktop does not export sun.swing to
> unnamed module @0x3b938003
> 	at com.github.weisj.darklaf.ui.label.DarkLabelUI.paint(DarkLabelUI.java:83)
> ~[darklaf-core-2.5.4.jar:2.5.4]
> 	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161) ~[?:?]
> 	at javax.swing.JComponent.paintComponent(JComponent.java:797) ~[?:?]
> 	at javax.swing.JComponent.paint(JComponent.java:1074) ~[?:?]
> 	at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?]
> 	at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?]
> 	at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?]
> 	at javax.swing.JComponent.paint(JComponent.java:1083) ~[?:?]
> 	at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) ~[?:?]
> 	at javax.swing.JComponent.paintChildren(JComponent.java:907) ~[?:?]
> 	at javax.swing.JComponent.paintToOffscreen(JComponent.java:5271) ~[?:?]
> 	at
> javax.swing.RepaintManager$PaintManager.
> paintDoubleBufferedImpl(RepaintManager.java:1643) ~[?:?]
> 	at
> javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.
> java:1618) ~[?:?]
> 	at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1556)
> ~[?:?]
> 	at javax.swing.RepaintManager.paint(RepaintManager.java:1323) ~[?:?]
> 	at javax.swing.JComponent.paint(JComponent.java:1060) ~[?:?]
> 	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
> ~[?:?]
> 	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:75)
> ~[?:?]
> 	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:112)
> ~[?:?]
> 	at java.awt.Container.paint(Container.java:2003) ~[?:?]
> 	at java.awt.Window.paint(Window.java:3949) ~[?:?]
> 	at javax.swing.RepaintManager$4.run(RepaintManager.java:876) ~[?:?]
> 	at javax.swing.RepaintManager$4.run(RepaintManager.java:848) ~[?:?]
> 	at java.security.AccessController.doPrivileged(AccessController.java:391)
> ~[?:?]
> 	at
> java.security.ProtectionDomain$JavaSecurityAccessImpl.
> doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
> 	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
> ~[?:?]
> 	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
> ~[?:?]
> 	at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
> ~[?:?]
> 	at
> javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1884)
> ~[?:?]
> 	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316) [?:?]
> 	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) [?:?]
> 	at java.awt.EventQueue$4.run(EventQueue.java:721) [?:?]
> 	at java.awt.EventQueue$4.run(EventQueue.java:715) [?:?]
> 	at java.security.AccessController.doPrivileged(AccessController.java:391)
> ~[?:?]
> 	at
> java.security.ProtectionDomain$JavaSecurityAccessImpl.
> doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
> 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) ~[?:?]
> 	at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
> 203) ~[?:?]
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
> 124) ~[?:?]
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
> 117) ~[?:?]
> 	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190) ~[?:?]
> 	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235) ~[?:?]
> 	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233) ~[?:?]
> 	at java.security.AccessController.doPrivileged(AccessController.java:312)
> [?:?]
> 	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233) ~[?:?]
> 	at java.awt.Dialog.show(Dialog.java:1079) ~[?:?]
> 	at java.awt.Component.show(Component.java:1720) ~[?:?]
> 	at java.awt.Component.setVisible(Component.java:1667) ~[?:?]
> 	at java.awt.Window.setVisible(Window.java:1032) ~[?:?]
> 	at java.awt.Dialog.setVisible(Dialog.java:1014) ~[?:?]
> 	at org.apache.jmeter.SplashScreen.lambda$showScreen$0(SplashScreen.java:95)
> ~[ApacheJMeter_core.jar:5.4.1]
> 	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316) ~[?:?]
> 	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) ~[?:?]
> 	at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
> 	at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
> 	at java.security.AccessController.doPrivileged(AccessController.java:391)
> [?:?]
> 	at
> java.security.ProtectionDomain$JavaSecurityAccessImpl.
> doIntersectionPrivilege(ProtectionDomain.java:85) [?:?]
> 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) [?:?]
> 	at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
> 203) [?:?]
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
> 124) [?:?]
> 	at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
> 113) [?:?]
> 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
> [?:?]
> 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
> [?:?]
> 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]
Comment 5 Felix Schumacher 2021-06-26 18:50:10 UTC
(In reply to Rabin from comment #2)
> (In reply to Felix Schumacher from comment #1)
> > Out of curiosity: Any reason for using bin/jmeter.sh instead of bin/jmeter?
> > 
> > The opens directives have been copied from jmeter script to jmeter.sh script
> > and should work now. It would be nice, if you could report back if that is
> > really the case :)
> > 
> > Thanks for the report.
> > 
> 
> Not sure why, I created the .desktop file long time ago, so maybe back then,
> it didn't have this problem.
> 
> I just tested running `bin/jmeter` and it seems to work OK.
> 
> Out of curiosity: Why there are 2 files ? :)

I wish I knew. I suspect the file was thought to be as an simpler version of the jmeter script to support different Java runtimes.