-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classloading issue based on EDT internal classloader #201
Comments
can you share your application so we can reproduce this issue? |
I'll have to ask my boss next week but I think the answer will be "No". Until then, is there any other information I can provide you with in order to reproduce? |
We tested with Oracle 8 u 172. The Popup Menu in our app works with or without the Log windows open. We need more info about your scenario. Can you share the link for the app? Do you have any VM args specified in your jnlp? Code:
|
Unfortunately the app is only used in our client's intranet, so I can't provide a link. We have the following VM args provided in our JNLP:
What I have observed though is that when I "hide" the log window this also helps, ie. the JPopups content will be rendered. It's not rendered when disabling the log-Window. It then looks like the thing in the red circle in the screenshot (ie. a frame without any content) |
We observe the same or a similar problem in our application with
|
Could you share your application so we can try to reproduce the behavior? |
We have found out that we don't seem to have this problem anymore after disabling any platform-specific look&feel and using the standard Swing L&F. Maybe that may serve as a workaround for you? Originally we have used Jide's
and then tried
and had problems with both. |
In my application's main method I use:
and I cannot reproduce the issue with oracle 1.8.0_172 You say that in your application (that is started by OWS) you use System or Jide's LnF and you are getting the issue with Amazon 1.8 u 222 and Oracle 1.8 u 231. OWS itself uses Popup and combo not showing up implies something to do with heavy and light weight components. Need to investigate further... |
Sorry, unfortunately that's not possible. The application is quite complex and it needs a server part to run. Furthermore it is closed source. |
That's interesting, we are also using Jide and also ran into this problem. I've been playing around with the L&F a bit, but it didn't help. The only thing that helps is turning on the console. But the problem doesn't seem to be related only to Jide, because we have another class that is not found. This is the WebSocket implementation.
This error also does not occur when the console is switched on. I just discovered that there is a similar sounding issue in the IcedTea-Web project. |
Tested with JGoodies and Jide Demo. Popups in combos, menus, rt-clk menu in file chooser work. |
We have a problem which seems to be related to this. We use Synthetica Look and Feel btw.
I could track down the problem that Swing is unable to load a class, the error above is just the result of not finding the class. Usualy the next exception below is not logged or printed i was only able to find it by debugging openwebstart: Class.forName fails. But the jar containing the class is in the jnlp and also downloaded in the cache.
|
If this looks like it could be classloader related than please try the 3.0.0-alpha1 release. |
I dont know much about the classloading possibilities. So i am just guessing here. Could this be related to the fact that the eventdispatch thread ist startet before you set some webstart classloader so this thread uses the wrong classloader? |
Ok i will check this tomorrow :) |
Hi, I would like to reproduce this issue on a simple Swing app. Can you please tell me the exact version of Synthetica lib and the exact name of the LnF class you are uisng from that lib? Thanks.. |
3.0.0-alpha1 did not fix the problem, however i think i found the reason behind it. The reason is that if no window is open anymore then awt initiates an auto shutdown, stops the event dispatch queue threads (this also explains why it works to let the console open as than no auto shutdown occurs). Later the eventdispatch thread is created again when starting the real application. The problem is that the classloader is stored in a singleton (EventQueue.class, field classLoader). So if the edt is created again it uses the wrong classloader. I got to it by finding this old bug which is quite similar: For reproduction it should be sufficient to add a delay off a few seconds to the main method of the launched application and before the start of the first invokelater or invokeandwait command. So the Autoshutdown is triggered. In the AWTAutoShutdown class the delay seems to be 1 second. A workarround which worked for me was hack i added to my main method inside my swing applicaiton:
|
Regarding a fix this could be tricky, as the EDT is initialized for use for the splashscreen and dowloadprogess. At that time the classloader is not yet available... |
Can you please provide the exact version of Synthetica LnF lib and the exact name of the LnF class you are using from that lib? Thanks.. |
@Gr33nbl00d great work! Your description makers sense. Let me think about a possible solution. I assume a "real" Java proxy would create more problems than it solves. Maybe we can change the class loader hierarchy. |
Thank you :) Yes i also thought there has to be a better way than a "real" java proxy as this would also not be good for performance. But here i hand it over to you as you seem to have more knowledge about classloaders and already some idea ;) |
Expected the same strange behavior - the first start works correctly for both (1.1.7 and 3.0 Alpha). Any following starts are leading to @Gr33nbl00d Thanks for helpful workarounds |
@FoxyBOA @Gr33nbl00d @FrankBusse @SonicSunset Can anyone of you provide a small sample that we can use to reproduce the error? I created several sample with Classloader and multithreading handling in it and I can not reproduce it :( |
@hendrikebbers I created an example project: in the main method is a Thread.sleep if it is set to something low for example 50msec than the shutdown does not trigger. When using a highter sleep time of 5000 msec The application crashes by a class not found exception because EDT autoshutdown occured and after restart of EDT the edt thread uses wrong classloader.
|
@Gr33nbl00d Thanks for providing this sample. I can reproduce the issue. We will investigate and report. |
We did some tests by checking the stored classloader of the EDT:
Looks like the classloader is always the same instance. Even directly before the exception. This one needs further investigation. Sadly we do not have the resources at the moment to spend much time on it. @Gr33nbl00d help is more than welcome :) |
The EventQueue.class stores the classloader in a final field classLoader. The EventQueue itself is stored static inside SunToolkit.class. Even if the active EDT thread classloader is modified to a JNLP classloader, classloading will fail once an AWTAutoShutdown occurs. (No edt activity for 1 second). If any new activity starts, the EDT Thread is recreated and initialized with the classloader stored in field classLoader in EventQueue class. This was not the JNLP classloader anymore. The result are ClassNotFound Exceptions. As there does not seem to be a "nice solution" because of the EventQueue implementation details the current solution temporary sets a DelegatingClassLoader to the thread which will initialize the eventqueue. Once initialized the original classloader is restored to the thread. During webstart loading the DelegatingClassLoader uses the original classloader once the jnlp classloader is active it gets injected into the DelegatingClassLoader. See: karakun/OpenWebStart#201
Yes the classloader inside EventQueue is always the same because it is only initialized during startup. it temporarly works because the currently active thread has the right classloader set by the method updating all threads with correct classloader. But after awtautoshutdown a new thread is created with the classloader in EventQueue which is still the normal classloader not the jnlp one. |
@Gr33nbl00d is this still meant to be left open after AdoptOpenJDK/IcedTea-Web#679 ? |
Hi,
in our application we use JPopupMenus for context-menus.
When using OpenWebstart the popup-menus are not displayed, only very small rectangles (i.e. the borders of a context menu without any content).
However, what is very weird is that the popup-menus are displayed when configuring in itw-settings.exe in the Logging section that the Log-Window should always be shown!
This problem is independent of the underlying JRE (in our case Corretto 1.8.0_222 and Oracle 1.8.0_231). When using Oracle Webstart we don't have this problem.
OS: Windows 10
OpenWebstart Version.: 1.1.4 (also on 1.0)
Java Versions: Amazon Corretto 1.8.0_222 and Oracle 1.8.0_231
The Context-Menu not shown is of javax.swing.JPopupMenu class
The text was updated successfully, but these errors were encountered: