This discussion is archived
1 2 Previous Next 25 Replies Latest reply: Jun 28, 2013 11:22 AM by StephanosPiperoglou RSS

7U25: UIDefaults.getUI() failed: no ComponentUI class for:

946128 Newbie
Currently Being Moderated

Several of my users have reported this error after upgrading to Java 7 Update 25:

 

UIDefaults.getUI() failed: no ComponentUI class for: Javax.swing.JMenu[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=null,paintBorder=false,paintFocus=false,pressedIcon=,rolloverEnabled=false,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=]

 

java.lang.Error

  at javax.swing.UIDefaults.getUIError(Unknown Source)

  at javax.swing.MultiUIDefaults.getUIError(Unknown Source)

  at javax.swing.UIDefaults.getUI(Unknown Source)

  at javax.swing.UIManager.getUI(Unknown Source)

  at javax.swing.JMenu.updateUI(Unknown Source)

  at javax.swing.JMenuItem.init(Unknown Source)

  at javax.swing.JMenuItem.<init>(Unknown Source)

  at javax.swing.JMenuItem.<init>(Unknown Source)

  at javax.swing.JMenu.<init>(Unknown Source)

  at javax.swing.JMenu.<init>(Unknown Source)

...

 

when creating a JMenu like this: final JMenu submenu = new JMenu();

 

The application has not changed (and works fine on 7U21) and only some of the users experience this.

 

After restarting the application it seems to run correctly.

 

The are running on Windows 7

 

Anyone else seen this error on 7U25?

  • 1. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    mKorbel Explorer
    Currently Being Moderated

    - not possible to suggest whatever (as you probably know very well) without post an SSCCE(http://sscce.org/), short, runnable, compilable, just about JFrame and JMenu caused a.m. exception

     

    - for why reason you call something as is UIDefaults.getUI(), did you creating an animatons with JMenu (in Nimbus) by switching betweens Colors, if not then to remove this code line an related workaround

  • 2. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    946128 Newbie
    Currently Being Moderated

    None of the developers are able to reproduce the error. Only some of our customers can do it. So unfortunately I am unable to post a SSCCE.

    I do not call UIDefaults.getUI() - it is in the default implementation of the JMenu contructor.

    I use Windows L&F loaded like this: UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel") prior to the instantiation of JMenu.

  • 3. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    63ccafff-78e0-49c0-8a95-ba3341bce5ff Newbie
    Currently Being Moderated

    Hi

     

    You may have run into issues caused by extra AppContext's introduced in Java 1.7u25. We are currently fighting this on Mac OS X.

     

    It seems that the handling of AppContext's in Java 1.7u25 were changed and that (at least for Java Web Start) an extra AppContext is in use. This results in event handlers etc. being called from two different AppContext's (and EDT's) which can result in problems with Look & Feel's as a lot of their state is derived from the "current" AppContext.

     

    Try printing out the AppContext of the thread creating the JMenu and verify that this is indeed the correct AppContext (the one that was "current" when you set the Look & Feel).

     

    Hope this helps

  • 4. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    946128 Newbie
    Currently Being Moderated

    I will try that - thanks

     

    I have found that the problem occurs every time the application starts after Windows has been restarted.

    If we kill the java process and start the application again there is no problem.

    The problem goes away if we set the "Show console" in Advanced/Java Console.

  • 5. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    63ccafff-78e0-49c0-8a95-ba3341bce5ff Newbie
    Currently Being Moderated

    Hi Again

     

    I think you're on the right track. Enabling the Java Console adds another AppContext for the Java Console (probably for keeping the Java console state separate from the application). This extra AppContext might stir up things so that the correct AppContext's are used. Looking at the changes made in AppContext in Java 1.7u25, it seems that AppContext's are now associated with Thread's using ThreadLocal's and that AppContext's gets associated on the fly which could explain why adding a new AppContext changes the sequence / timing of things.

  • 6. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    StephanosPiperoglou Newbie
    Currently Being Moderated

    Getting the same error on our Java Web Start app. Even more worrying: I'm getting this on a 6u37 JRE launched from a 7u25 Java Web Start (with both JREs enabled in Java control panel)

  • 7. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    StephanosPiperoglou Newbie
    Currently Being Moderated

    Are you using Substance Look & Feel by any chance (we are).

     

    I'm getting very inconsistent issues:

     

    - Box 1: Win7, JRE 7u25, error happens every time with console hidden but never with console showing

    - Box 2: Win7, JRE 7u25, never get the issue

    - Box 3: WinXP, JRE 6u37 and 7u25 installed and both enabled: App picks 6u37 and exhibits the error every time, whether or not console is enabled

    - Box 3: WinXP, JRE 6u37 and 7u25 installed but only 7u25 enabled: Never get the issue, whether or not console is enabled

  • 8. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    946128 Newbie
    Currently Being Moderated

    We use our own custom L&F extended from com.sun.java.swing.plaf.windows.WindowsLookAndFeel.

    I have tried to set the L&F to default Windows L&F like this: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); and even like this: UIManager.setLookAndFeel(new WindowsLookAndFeel());

    I still get the error.

     

     

     

    I have tried to not set the L&F and thereby staying with Metal - then there is no error!

  • 9. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    StephanosPiperoglou Newbie
    Currently Being Moderated

    Thanks for the info. We also use custom LaF (extended from Substance). Haven't tried not setting it yet... the error does not occur on my own machine so it's hard to test & reproduce (also the app is quite dependant on custom LaF to function). For the moment our customer support team is recommending users enable their Java Console to work around the problem but this is hardly ideal. Will keep digging.

  • 10. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    f3fd33f9-9a11-459b-8ff4-8deb8e625816 Newbie
    Currently Being Moderated

    We are experiencing AppContext to be null from our rmi callback threads. Does anyone have any further information on what was changed regarding AppContext?

     

    https://forums.oracle.com/thread/2552799

  • 11. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    jeffb Newbie
    Currently Being Moderated

    Having a similar problem and having added code to display the existing AppContext's at application startup to dig into this, I don't see that an extra one exists when Java Console is showing. Just FYI.

  • 12. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    63ccafff-78e0-49c0-8a95-ba3341bce5ff Newbie
    Currently Being Moderated

    Hi

     

    When I launch our Java Web Start based application (properly deployed to a real webserver and launched using the link to the .jnlp file) and use JVisualVM to look into the application, do a heap dump and look for sun.awt.AppContext instances YourKit I find 3 instances (see below).

     

    +----------------------------------------------------------------------------+

    |  +---sun.awt.AppContext                                                    |

    |  | +---table  java.util.HashMap                                            |

    |  | +---contextClassLoader  com.sun.jnlp.JNLPClassLoader [Stack Local]      |

    |  | +---threadGroup  java.lang.ThreadGroup                                  |

    |  | +---state  sun.awt.AppContext$State                                     |

    |  | +---mostRecentKeyValue  sun.awt.MostRecentKeyValue                      |

    |  | +---shadowMostRecentKeyValue  sun.awt.MostRecentKeyValue                |

    |  | +---DISPOSAL_TIMEOUT = long 1000  0x00000000000003E8                    |

    |  | +---THREAD_INTERRUPT_TIMEOUT = long 4477849072  0x000000010AE68DF0      |

    |  |                                                                         |

    |  +---sun.awt.AppContext [Stack Local]                                      |

    |  | +---contextClassLoader  sun.misc.Launcher$AppClassLoader [Stack Local]  |

    |  | +---table  java.util.HashMap                                            |

    |  | +---threadGroup  java.lang.ThreadGroup                                  |

    |  | +---changeSupport  java.beans.PropertyChangeSupport                     |

    |  | +---state  sun.awt.AppContext$State                                     |

    |  | +---mostRecentKeyValue  sun.awt.MostRecentKeyValue                      |

    |  | +---shadowMostRecentKeyValue  sun.awt.MostRecentKeyValue                |

    |  | +---DISPOSAL_TIMEOUT = long 1000  0x00000000000003E8                    |

    |  | +---THREAD_INTERRUPT_TIMEOUT = long 4483771472  0x000000010B40EC50      |

    |  |                                                                         |

    |  +---sun.awt.AppContext                                                    |

    |    +---contextClassLoader  com.sun.jnlp.JNLPClassLoader [Stack Local]      |

    |    +---table  java.util.HashMap                                            |

    |    +---threadGroup  java.lang.ThreadGroup                                  |

    |    +---state  sun.awt.AppContext$State                                     |

    |    +---mostRecentKeyValue  sun.awt.MostRecentKeyValue                      |

    |    +---shadowMostRecentKeyValue  sun.awt.MostRecentKeyValue                |

    |    +---DISPOSAL_TIMEOUT = long 1000  0x00000000000003E8                    |

    |    +---THREAD_INTERRUPT_TIMEOUT = long 4477386480  0x000000010ADF7EF0      |

    +----------------------------------------------------------------------------+

     

    I don't know if this dump could help explain the differences ?

     

     

    Additionally, I think the following Java developer list might be interesting for this issue:

     

     

      http://lists.apple.com/archives/java-dev/2013/Jun/index.html

     

     

    reading the posts related to Java 1.6u51 seems to show that Java 1.6u51 has some of the same issues.

  • 13. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    jeffb Newbie
    Currently Being Moderated

    I see the same.  My point was just that there are three whether or not Java Console is showing.  If you look at the threadGroup name of each they don't change with or without Java Console showing.  And yet, having that console showing is quite magical in fixing the problems in 7u25.  I'm still working on writing up the ones I'm encountering, which seem to be major classloader problems that manifest as a null java.util.logging Root logger, inability to load look and feels, and inability to use Class.forName().

  • 14. Re: 7U25: UIDefaults.getUI() failed: no ComponentUI class for:
    63ccafff-78e0-49c0-8a95-ba3341bce5ff Newbie
    Currently Being Moderated

    Hi Again

     

    Ok, now I can see that. What fooled be before was that the Console Window were hanging off one of the AppContext's in the dumps, which made me infer that the AppContext was for the Console Window...

     

    I have looked at the code differences between AppContext in Java 1.7u21 and Java 1.7u25 and a number of changes have indeed been made, tried out a few "hacks" to try to suppress some of the changes, but no luck...

     

    Our QA team is currently testing our application against Java 1.7u25 and Java 1.6u51 and have found a number of issues like the ones that others have reported. I will post any significant results of these tests so that we can hopefully get a workaround done.

     

    Have a nice weekend

1 2 Previous Next