Open GoogleCodeExporter opened 8 years ago
The best explanation of that behavior I have found so far is below. If anyone
knows better, please speak up...
http://forums.netbeans.org/ptopic8237.html
Quote:
/* Find classes used in the on... methods. The classes can't be looked up
locally since these methods are called from a system thread and FindClass
therefore uses the system class loader to find these classes. This fails if
used with Java Web Start, which uses its own class loader. Looking the classes
up in the constructor works because the constructor is called from a Java ->
Native call and the class loader of the calling Java class is used. We need to
create global refs since the class objects are used from a different thread. */
Original comment by christop...@gmail.com
on 2 Jul 2014 at 2:05
Yes, that approach worked. Creating a cache of global refs to jclass'es and
using it instead of FindClass from CEF threads avoids this JavaWebStart
limitation.
If anyone has a better idea, happy to hear it... Preparing a patch that I will
attach here.
Original comment by christop...@gmail.com
on 2 Jul 2014 at 4:07
A good side effect of this is that I discovered
https://code.google.com/p/javachromiumembedded/issues/detail?id=100
Original comment by christop...@gmail.com
on 2 Jul 2014 at 5:42
Here's the patch. In jni_util.cpp, we look up a global cache of class
references before attempting to invoke env->FindClass. The global cache is
created from the Java thread that invokes CefApp_N.Initialize. That thread can
load CEF classes in both JavaWebStart and non JavaWebStart deployments.
Let me know what you think. If you prefer not to take it, we'll have to keep
patching this over. Hopefully this will be useful to anyone doing JavaWebStart
deployments in future.
Original comment by christop...@gmail.com
on 4 Jul 2014 at 5:42
Attachments:
I wouldn't want to maintain this giant array of class names by hand. If there
isn't a way to auto-discover them in the code then I'd suggest writing a python
script to generate the array (as separate h/cpp files). The script could be run
from gyp_cef similar to how the make_version_header.py script is run.
Original comment by magreenb...@gmail.com
on 10 Jul 2014 at 5:11
I had the same issue when trying to embed jcef to a NetBeans module. AFAIK the
NetBeans platform uses a separate class loader for each module. I came up with
a more general solution by first storing a global reference to the correct
classloader in CefApp.N_Initialize and then using the stored classloader
everywhere instead of env->FindClass() .
I attached the patch, please merge it if you agree. I tested it on Win32.
Original comment by janos.br...@gmail.com
on 20 Oct 2014 at 7:25
Attachments:
JCEF is transitioning from Google Code to Bitbucket project hosting. If you
would like to continue receiving notifications on this issue please add
yourself as a Watcher at the new location:
https://bitbucket.org/chromiumembedded/java-cef/issue/99
Original comment by magreenb...@gmail.com
on 18 Mar 2015 at 6:00
Original issue reported on code.google.com by
christop...@gmail.com
on 2 Jul 2014 at 1:50