"java.lang.InternalError: HTHEME is null" on arbitrary JREs (Windows) - java

We are getting an exception when changing the Windows Theme on Windows 7 (via right-click Desktop > Personalize) while our Java app is running. Searching the web did produce some results, but they are mostly about java bug reports that claim to have been resolved ages ago. This is the trimmed and partially obfuscated stack trace:
java.lang.InternalError: HTHEME is null
at sun.awt.windows.ThemeReader.paintBackground(Native Method)
at sun.awt.windows.ThemeReader.paintBackground(Unknown Source)
at com.sun.java.swing.plaf.windows.XPStyle$SkinPainter.paintToImage(Unknown Source)
at sun.swing.CachedPainter.paint0(Unknown Source)
at sun.swing.CachedPainter.paint(Unknown Source)
at com.sun.java.swing.plaf.windows.XPStyle$Skin.paintSkinRaw(Unknown Source)
at com.sun.java.swing.plaf.windows.AnimationController.paintSkin(Unknown Source)
at com.sun.java.swing.plaf.windows.XPStyle$Skin.paintSkin(Unknown Source)
at com.sun.java.swing.plaf.windows.XPStyle$Skin.paintSkin(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsScrollBarUI.paintThumb(Unknown Source)
at javax.swing.plaf.basic.BasicScrollBarUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at java.awt.Window.paint(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1200(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.WaitDispatchSupport$2.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(Unknown Source)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at com.example.App$130$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.WaitDispatchSupport$2.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.awt.WaitDispatchSupport$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.WaitDispatchSupport.enter(Unknown Source)
... goes on and on
It seems to be related to LAF. The app does not support changing LAF after startup. It does call
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
at startup, however. This happens on a Windows 7 Enterprise x64 machine, running 1.8.0_74 64bit an arbitrary JRE version. This is an example of a Java bug report which appears to be quite similar and is supposedly resolved.
Can anyone shed some light on what the cause may be and how it may be worked around (besides the obvious "do not set system look and feel on Windows")?
P.S.: A comment in the linked bug report claims:
A good application to reproduce the issue is SwingSet3 (https://java.net/projects/Swingset3).
Change Look-and-Feel to Windows, and click JInternalFrame in the list of components on the left. Create several more internal frames. Try switching Windows themes: Windows 7 Basic ??? Windows Classic.
but we had no luck doing that it only happened a single time for us, while SwingSet3 was showing a JTable.
Edit: this indeed happens during Windows Theme changing - either when done manually or when the user logs on to the machine running the Java app through Remote Desktop. To ensure a more responsive interface, Aero may be disabled and a switch to Windows Classic based theme may be made automatically. I've edited the question accordingly.

The only way around this is to ignore this specific exception instead of throwing it into your user's face, which is exactly what we did. Since it happens during painting, there's no major harm done and the app survives it just fine (during testing at least). This is probably the reason no one cares about actually fixing it (besides Swing dying slowly over time).
If you get HTHEME is null exception and the stack trace mentions a table header renderer, read this answer, if you are using a custom renderer that wraps the default one. That one has a proper solution.

Related

Java 8 Swing application: javax.net.ssl.SSLKeyException: RSA premaster secret error

I have a Swing based Java application that uses Java 8 u161.
The jre that the application uses is stored in one of its directories (it doesn't use an installed jre).
One of the screens in the application approaches a Webshere that is installed on a distant server via HTTPS. The public key is installed on cacert in the client's jre\lib\security folder.
When the application runs as a standalone application, all is well: the handshake is completed successfully, the message is sent to the server and the returned code is 200 (OK).
But when the application runs in collaboration with another application (a dotnet application that injects code to the Java application. I'm not even sure what exactly), a "javax.net.ssl.SSLKeyException: RSA premaster secret error" is thrown
Most similar problems on the internet were solved by uninstalling and reinstalling all the Java versions. But my Java is not installed, so I can't do that.
I tripled checked that my Java application uses the correct jre- it does.
I can't understand what causes this exception and I don't know what else to check.
Here is how I open the connection:
URL servletUrl = new URL(urlStr); //throws java.net.MalformedURLException
HttpsURLConnection.setDefaultHostnameVerifier(new ChequesServletHostnameVerifier());
servletConnection = (HttpsURLConnection) servletUrl.openConnection(); //throws java.io.IOException
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
OutputStream os = servletConnection.getOutputStream(); //throws java.io.IOException
And here is the complete stacktrace:
javax.net.ssl.SSLKeyException: RSA premaster secret error
at sun.security.ssl.RSAClientKeyExchange.<init>(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverHelloDone(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at qs.localtransactions.servlet.SrvltTxn.connect2Servlet(SrvltTxn.java:114)
at qs.localtransactions.AmgImgBase.retrieveImagesFromServlet(AmgImgBase.java:562)
at qs.localtransactions.AMGIMG91.sendAndReceive(AMGIMG91.java:27)
at qs.localtransactions.AMGIMG.sendAndReceive(AMGIMG.java:32)
at idb.messenger.sender.LocalBackendDispatcher.send(LocalBackendDispatcher.java:26)
at qc.distribution.protocol.idb.QtMessengerIDB.sendAndReceive(QtMessengerIDB.java:127)
at qc.distribution.QtTransaction.sendRemote(QtTransaction.java:3338)
at qc.distribution.QtTransaction.send(QtTransaction.java:2528)
at qc.distribution.QtTransaction.send(QtTransaction.java:1930)
at qt.presentacion.QtLogic.send(QtLogic.java:800)
at qt.presentacion.QtLogic.performObserverCommand(QtLogic.java:584)
at qt.presentacion.logic.QtAction.evaluateSensitive(QtAction.java:536)
at qt.presentacion.logic.QtAction.evaluate(QtAction.java:258)
at qt.presentacion.logic.QtLogicEvaluator.evaluateActions(QtLogicEvaluator.java:472)
at qt.presentacion.logic.QtLogicEvaluator.evaluate(QtLogicEvaluator.java:397)
at qt.presentacion.logic.QtLogicRoutines.evaluateNotificationStack(QtLogicRoutines.java:582)
at qt.presentacion.logic.QtLogicRoutines.evaluate(QtLogicRoutines.java:555)
at qt.presentacion.logic.QtLogicEvaluator.update(QtLogicEvaluator.java:1431)
at qt.presentacion.logic.QtLogicStackController.processNotification(QtLogicStackController.java:108)
at qc.controls.observer.QtNotificator.notify(QtNotificator.java:65)
at qt.presentacion.QtRadioButtonModel.setValid(QtRadioButtonModel.java:110)
at qt.presentacion.QtRadioButton.radiobutton_ItemStateChanged(QtRadioButton.java:1111)
at qt.presentacion.QtRadioButton.connEtoC2(QtRadioButton.java:150)
at qt.presentacion.QtRadioButton.itemStateChanged(QtRadioButton.java:882)
at javax.swing.AbstractButton.fireItemStateChanged(Unknown Source)
at javax.swing.AbstractButton$Handler.itemStateChanged(Unknown Source)
at javax.swing.DefaultButtonModel.fireItemStateChanged(Unknown Source)
at qt.presentacion.QtRadioButtonModel.setSelected(QtRadioButtonModel.java:95)
at javax.swing.ButtonGroup.setSelected(Unknown Source)
at qt.presentacion.QtRadioButtonModel.setSelected(QtRadioButtonModel.java:89)
at javax.swing.AbstractButton.setSelected(Unknown Source)
at qt.presentacion.QtRadioButton.select(QtRadioButton.java:1181)
at qt.presentacion.QtRadioButton.performObserverCommand(QtRadioButton.java:1045)
at qt.presentacion.logic.QtAction.evaluateSensitive(QtAction.java:536)
at qt.presentacion.logic.QtAction.evaluate(QtAction.java:258)
at qt.presentacion.logic.QtLogicEvaluator.evaluateActions(QtLogicEvaluator.java:472)
at qt.presentacion.logic.QtLogicEvaluator.evaluate(QtLogicEvaluator.java:397)
at qt.presentacion.logic.QtLogicEvaluator.register(QtLogicEvaluator.java:1312)
at qt.presentacion.QtLogic.registerEvaluators(QtLogic.java:741)
at qt.presentacion.QtLogic.initState(QtLogic.java:510)
at qt.presentacion.QtLogic.paint(QtLogic.java:529)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at qt.presentacion.QtPanel.paint(QtPanel.java:1995)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at javax.swing.RepaintManager$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$1200(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169)
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223)
at sun.security.ssl.JsseJce.getKeyGenerator(Unknown Source)
... 105 more
Any information with be appreciated.
Like many people mentioned in older posts regarding exception
javax.net.ssl.SSLKeyException: RSA premaster secret error
it means that two different java versions are mixed. Therefore, reinstalling Java helps.
In my case, apparently, the dotnet application set the java extension folder to an older java version. When the extension configuration was set to the correct Java version, the problem was solved.

Getting java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.swing") with JDK8?

I am trying to run my applet with JDK8 but i'm getting below exception on java console at this line of my code
SplitPaneH = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
Traces
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.swing")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkPackageAccessHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPackageAccess(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jb2011.lnf.beautyeye.ch17_split.BESplitPaneDivider.<init>(BESplitPaneDivider.java:77)
at org.jb2011.lnf.beautyeye.ch17_split.BESplitPaneUI.createDefaultDivider(BESplitPaneUI.java:54)
at javax.swing.plaf.basic.BasicSplitPaneUI.installDefaults(Unknown Source)
at javax.swing.plaf.basic.BasicSplitPaneUI.installUI(Unknown Source)
at javax.swing.JComponent.setUI(Unknown Source)
at javax.swing.JSplitPane.setUI(Unknown Source)
at javax.swing.JSplitPane.updateUI(Unknown Source)
at javax.swing.JSplitPane.<init>(Unknown Source)
at javax.swing.JSplitPane.<init>(Unknown Source)
at javax.swing.JSplitPane.<init>(Unknown Source)
at TeleProvisionManager.InventoryPage.<init>(InventoryPage.java:382)
at TeleProvisionManager.MainFrame.createMainTab(MainFrame.java:2147)
at TeleProvisionManager.MainFrame.<init>(MainFrame.java:1253)
at TeleProvisionManager.LoginChangeGroupDlg.handleContinueButton(LoginChangeGroupDlg.java:791)
at TeleProvisionManager.LoginChangeGroupDlg.jbtnContinueActionPerformed(LoginChangeGroupDlg.java:489)
at TeleProvisionManager.LoginChangeGroupDlg.access$100(LoginChangeGroupDlg.java:56)
at TeleProvisionManager.LoginChangeGroupDlg$4.actionPerformed(LoginChangeGroupDlg.java:355)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicRootPaneUI$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.SwingUtilities.processKeyBindings(Unknown Source)
at javax.swing.UIManager$2.postProcessKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
But it was worked well with JDK7. I am not getting what is the problem and how to solve it. And i tried downloading 'jsdg-stubs-jre1.5.jar' which contains sun.swing classes and copying that jar to WEB-INF/lib folder but no use. How to solve it please help me. TIA!
"accessClassInPackage.sun.swing" which signifies that in Webstart it is not allowed to use the package sun.swing.
You need to sign your applet, and with latest jdk 8 security, will block any applet signed with an untrusted certificate authority.So if you self sign this applet put low the security settings.untill it executes.
As an example here.
The thing with java 8 is that we have the security level ranging from high to very high ,while on java 7 it ranged from medium and above.The setting was only intended to block malicious or unsigned apps in java 8.However sometimes it may cause trouble with active X controls.If your app is running using low setting ,good otherwise i suggest java7, unless you dont use enhanced features like lambda expressions and other stuff
Between java7 and java8 there were a bunch of security restrictions added to the way applets are constrained in sandbox mode - especially in communicating over the network.
Check if anything here applies to your case - it may not be applicable, but these need to be checked anyway.

Swing stack trace with no line information where it's failing

I'm working with Swing, and it's giving me this stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.windows.WindowsButtonUI.getXPButtonState(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsButtonUI.paintXPButtonBackground(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsButtonUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at java.awt.Window.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$700(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I've tried debugging but it's failing in the Thread[AWT-EventQueue-0] in the EventDispatchThread.pumoEventsForFiler(int, Conditional, EventFilter) line:not available
I'm not really quite sure where to go from with this. Could someone explain how to do with stack traces with no line information?
EDIT:
Basically I tried to do MVC in Swing and my ButtonModel was atrocious. So I deleted it and the problem went away. I would post my code but Eclipse isn't bringing the file back. My button still doesn't work but that's a completely new issue.
When you don’t have the line, it sometimes help to look at the entire method to look what could be the possible situation. In your case there seems to be only one possible cause: you have set the model of a button to null. It seems that Swing’s button class allows this, but the Windows look and feel does not check for this.

Problems in running I/O in EDT of applet

Our applet source code is kind of spaghetti (written in 2000, Java 1.3 then) and we want to recompile it to Java 1.6 or 1.7.
When I'm testing it, most of the Swing is OK but after sometime, an Exception occurred, which is EDT exception. Specifically, when a drag event is done, a series of EDT exceptions appear.
Is this something to with coding the I/O part in ActionListeners because I've read that it is bad to code I/O operations in action listeners, which EDT executes when a action is performed.
EDIT:
This is the recurring exception
Exception in thread "AWT-EventQueue-3" java.lang.NullPointerException
at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(Unknown Source)
at javax.swing.BufferStrategyPaintManager.copyArea(Unknown Source)
at javax.swing.RepaintManager.copyArea(Unknown Source)
at javax.swing.JViewport.blitDoubleBuffered(Unknown Source)
at javax.swing.JViewport.windowBlitPaint(Unknown Source)
at javax.swing.JViewport.setViewPosition(Unknown Source)
at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.vsbStateChanged(Unknown Source)
at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(Unknown Source)
at javax.swing.DefaultBoundedRangeModel.fireStateChanged(Unknown Source)
at javax.swing.DefaultBoundedRangeModel.setRangeProperties(Unknown Source)
at javax.swing.DefaultBoundedRangeModel.setValue(Unknown Source)
at javax.swing.JScrollBar.setValue(Unknown Source)
at javax.swing.plaf.basic.BasicScrollBarUI$TrackListener.setValueFrom(Unknown Source)
at javax.swing.plaf.basic.BasicScrollBarUI$TrackListener.mouseDragged(Unknown Source)
at java.awt.Component.processMouseMotionEvent(Unknown Source)
at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
I guess it has something to do with the version of java plugin.
In java 1.6_10, a new version of this plugin is release, i just disabled the option in java found in control panel
Advance->Java Plug In ->Enable the next generation Java Plug in
When i disable this, this recurring error with no distinct behavior no longer appears.
I guess also it has something to do with our code written in the days of Java 1.3.

java: IllegalStateException - Buffers have not been created

I have a weird exception in one my servers.
The same application (java, swing ) runs on several servers.
Each server runs with dual monitors.
Same jre version (jre 6 version 24)
All of them in a decent CPU/memory consumption.
In only one of them - when I drag my app from one monitor to the other it throws a java.lang.IllegalStateException exception. I have attached the full exception below.
Does anyone have any idea ?
Thank you.
And now, behold, the exception :
java.lang.IllegalStateException: Buffers have not been created
at sun.awt.windows.WComponentPeer.getBackBuffer(Unknown Source)
at java.awt.Component$FlipBufferStrategy.getBackBuffer(Unknown Source)
at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Unknown Source)
at java.awt.Component$FlipBufferStrategy.revalidate(Unknown Source)
at java.awt.Component$FlipBufferStrategy.revalidate(Unknown Source)
at java.awt.Component$FlipBufferStrategy.getDrawGraphics(Unknown Source)
at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Try adding the following parameter to your java command line:
-Dsun.java2d.d3d=false
having tried the following,
-Dsun.java2d.d3d=false
-Dsun.java2d.noddraw=true
-Dsun.java2d.ddoffscreen=false
-DJ2D_D3D=false
and NOT finding a solution, i stumbled on this which worked.
jframe.createBufferStrategy(1);
http://www.java-gaming.org/index.php/topic,25021.0
This is the case in the Oracle bug database: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6933331.
From the bug evaluation:
.. has no consequences other
than a stack trace dump in a console (no hang, no visual artifacts were reported)

Categories

Resources