kirill-grouchnikov / substance

A modern and high-performant Swing look-and-feel library
164 stars 109 forks source link

NullPointerException when running executable jar with substance-7.1.0.1 dependancy. #65

Closed MarkWilds closed 6 years ago

MarkWilds commented 6 years ago

Version of Substance

7.1.0.1

Version of Java

1.8

Version of OS

Windows 8.1

The issue you're experiencing (expected vs actual, screenshot, stack trace etc)

When I try to run my executable uber jar I get the stacktrace you can see below: In my IDE IntelliJ it works fine when I run the default run comfiguration! I run maven packaging an uber jar and it can't execute my jar.

java.lang.NullPointerException at org.pushingpixels.lafplugin.ComponentPluginManager.processAllDefaultsEntries(ComponentPluginManager.java:111) at org.pushingpixels.substance.api.SubstanceLookAndFeel.setSkin(SubstanceLookAndFeel.java:2110) at org.pushingpixels.substance.api.SubstanceLookAndFeel.initialize(SubstanceLookAndFeel.java:1656) at java.desktop/javax.swing.UIManager.setLookAndFeel(Unknown Source) at pao.editor.EditorApplication.lambda$main$0(EditorApplication.java:19) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=] java.lang.Error at java.desktop/javax.swing.UIDefaults.getUIError(Unknown Source) at java.desktop/javax.swing.MultiUIDefaults.getUIError(Unknown Source) at java.desktop/javax.swing.UIDefaults.getUI(Unknown Source) at java.desktop/javax.swing.UIManager.getUI(Unknown Source) at java.desktop/javax.swing.JPanel.updateUI(Unknown Source) at java.desktop/javax.swing.JPanel.<init>(Unknown Source) at java.desktop/javax.swing.JPanel.<init>(Unknown Source) at java.desktop/javax.swing.JPanel.<init>(Unknown Source) at java.desktop/javax.swing.JRootPane.createGlassPane(Unknown Source) at java.desktop/javax.swing.JRootPane.<init>(Unknown Source) at java.desktop/javax.swing.JFrame.createRootPane(Unknown Source) at java.desktop/javax.swing.JFrame.frameInit(Unknown Source) at java.desktop/javax.swing.JFrame.<init>(Unknown Source) at pao.editor.gui.EditorView.<init>(EditorView.java:25) at pao.editor.EditorApplication.lambda$main$0(EditorApplication.java:23) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JPanel[,0,0,0x0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=] java.lang.Error at java.desktop/javax.swing.UIDefaults.getUIError(Unknown Source) at java.desktop/javax.swing.MultiUIDefaults.getUIError(Unknown Source) at java.desktop/javax.swing.UIDefaults.getUI(Unknown Source) at java.desktop/javax.swing.UIManager.getUI(Unknown Source) at java.desktop/javax.swing.JPanel.updateUI(Unknown Source) at java.desktop/javax.swing.JPanel.<init>(Unknown Source) at java.desktop/javax.swing.JPanel.<init>(Unknown Source) at java.desktop/javax.swing.JPanel.<init>(Unknown Source) at java.desktop/javax.swing.JRootPane.createContentPane(Unknown Source) at java.desktop/javax.swing.JRootPane.<init>(Unknown Source) at java.desktop/javax.swing.JFrame.createRootPane(Unknown Source) at java.desktop/javax.swing.JFrame.frameInit(Unknown Source) at java.desktop/javax.swing.JFrame.<init>(Unknown Source) at pao.editor.gui.EditorView.<init>(EditorView.java:25) at pao.editor.EditorApplication.lambda$main$0(EditorApplication.java:23) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Substance delegate used when Substance is not the current LAF [component JRootPane in window null:'null' under Substance Cerulean] at org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities.traceSubstanceApiUsage(SubstanceCoreUtilities.java:1933) at org.pushingpixels.substance.internal.utils.SubstanceColorSchemeUtilities.getColorScheme(SubstanceColorSchemeUtilities.java:222) at org.pushingpixels.substance.internal.utils.SubstanceColorUtilities.getBackgroundFillColor(SubstanceColorUtilities.java:716) at org.pushingpixels.substance.internal.ui.SubstanceRootPaneUI.installDefaults(SubstanceRootPaneUI.java:313) at java.desktop/javax.swing.plaf.basic.BasicRootPaneUI.installUI(Unknown Source) at org.pushingpixels.substance.internal.ui.SubstanceRootPaneUI.installUI(SubstanceRootPaneUI.java:227) at java.desktop/javax.swing.JComponent.setUI(Unknown Source) at java.desktop/javax.swing.JRootPane.setUI(Unknown Source) at java.desktop/javax.swing.JRootPane.updateUI(Unknown Source) at java.desktop/javax.swing.JRootPane.<init>(Unknown Source) at java.desktop/javax.swing.JFrame.createRootPane(Unknown Source) at java.desktop/javax.swing.JFrame.frameInit(Unknown Source) at java.desktop/javax.swing.JFrame.<init>(Unknown Source) at pao.editor.gui.EditorView.<init>(EditorView.java:25) at pao.editor.EditorApplication.lambda$main$0(EditorApplication.java:23) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

kirill-grouchnikov commented 6 years ago

Looks like this has something to do with the way you're packaging the app, at least for the first exception in this snippet (there are multiple exceptions without separation between them).

Things are quite different in the development trunk (version 8.0 scheduled for late first quarter of 2018). I'd suggest trying your app with the dev branch to see if you're still experiencing this issue.

Otherwise, I don't have plans to come back to the old way of doing things (looking up plugins with class loaders), and you'll need to figure out what is happening with your custom app packaging.

https://github.com/kirill-grouchnikov/laf-plugin/blob/master/src/org/pushingpixels/lafplugin/PluginManager.java can return null from line 164, and then that would indeed fail in line 111 of https://github.com/kirill-grouchnikov/laf-plugin/blob/master/src/org/pushingpixels/lafplugin/ComponentPluginManager.java

That is effectively dead code that is no longer used in the dev trunk.

MarkWilds commented 6 years ago

How stable is the dev trunk at the moment? I plan to use your library extensively.

And do you know why It would work inside the IDE and not outside?

*Edit tried the dev version, still the same problem

kirill-grouchnikov commented 6 years ago

Still the same stack trace? ComponentPluginManager is not used any more in 8.0.0-dev.

https://github.com/kirill-grouchnikov/substance/blob/master/www/release-info/8.0/release-info.md is the preliminary draft of the release notes. If you're not using custom Substance APIs / client properties, then the migration should be just replacing the jar.

The main planned changes have been done. The last one is for extending the main content into the title pane (tracked by https://github.com/kirill-grouchnikov/substance/issues/42) and I consider that a low-risk enhancement. This work will be happening in the next couple of weeks.

Please copy-paste the stack trace of the exception you're seeing under Substance 8.0.0dev.

MarkWilds commented 6 years ago

I'll do it as soon as possible.