Leonardocezary / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
1 stars 1 forks source link

JCEF fails to start when embedded in a NetBeans module with "Failed to launch child process" message #128

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Install NetBeans and create an empty NetBeans module project.
2.
Set the jcef jar files as dependencies to the project.
2.
Embed JCEF to the module so that when a button is pushed then a jcef window is 
started similar to the one in the simple jcef example.
3.
Build the module project and copy the native dependencies of jcef to a 
lib/[architecture] folder next to the module's jar file. For me it is 
D:\projects\netbeans-modules\webgl-view\target\nbm\netbeans\extra\modules\lib\x8
6
4. Start the module project and wait for the new NetBeans instance to start. 
Push the button to start the embedded jcef window.

What is the expected output? What do you see instead?
The jcef window should appear and it should show a web page. It does not appear 
and gives the following logs as output:

initialize on Thread[AWT-EventQueue-0,6,main] with library path D:\Program 
Files (x86)\NetBeans 
8.0.1\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\Program 
Files (x86)\ActiveState Komodo Edit 
8\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\W
indowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web 
Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance 
Toolkit\;C:\Program Files 
(x86)\play-1.2.3;C:\Python27;C:\Python27\Scripts;C:\Program Files 
(x86)\cwRsync\bin;C:\Program Files (x86)\Microsoft SQL 
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL 
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL 
Server\100\DTS\Binn\;C:\Program Files (x86)\apache-maven\bin;C:\Program 
Files\Microsoft\Web Platform Installer\;C:\Program Files 
(x86)\QuickTime\QTSystem\;C:\Program Files\doxygen\bin;C:\Program Files 
(x86)\Java\jdk1.7.0_55\jre\bin;C:\Program Files 
(x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\OpenVPN\bin;C:\Program 
Files\TortoiseSVN\bin;D:\depot_tools;C:\Program Files 
(x86)\Java\jdk1.7.0_55\bin;C:\Program Files 
(x86)\ProTrader\Common;C:\Chocolatey\bin;C:\Program Files (x86)\Git\cmd;;.
[1021/002156:ERROR:child_process_launcher.cc(328)] Failed to launch child 
process
[1021/002157:ERROR:child_process_launcher.cc(328)] Failed to launch child 
process

What version of the product are you using? On what operating system?
Rev 105, Win32

Please provide any additional information below.

Original issue reported on code.google.com by janos.br...@gmail.com on 20 Oct 2014 at 10:41

GoogleCodeExporter commented 9 years ago
The problem is that in a NetBeans module environment getJcefLibPath() in 
CefApp.java cannot determine the path of jcef.dll so the whole 
java.library.path is passed instead to the N_Initialize() method as the 
pathToJavaDLL parameter. This causes the settings.browser_subprocess_path in 
CefApp.cpp to not be set to the correct path of jcef_helper.exe, and the 
child_process_launcher in cef cannot start jcef_helper.exe.

getJcefLibPath() tries to find jcef.dll in the original java.library.path. In 
this case NetBeans uses a custom ClassLoader for our module which is also used 
when loading jcef.dll in CefApp. This custom ClassLoader overrides the 
FindLibrary protected method of ClassLoader so that it can load native 
libraries from e.g. 
D:\projects\netbeans-modules\webgl-view\target\nbm\netbeans\extra\modules\lib\x8
6. Therefore, jcef.dll might not be found in the folders of java.library.path 
by getJcefLibPath().

I attached a patch with a solution which uses the protected FindLibrary method 
of the custom classloader to determine the path of jcef.dll. Though it uses 
reflection to call the protected method I think it's more robust than the 
current method.

Please merge the fix if you agree with it. I tested it on Win32. Thanks!

Original comment by janos.br...@gmail.com on 20 Oct 2014 at 11:16

Attachments:

GoogleCodeExporter commented 9 years ago
JCEF version: rev 105
CEF version: 3.1916.1749 win32
OS version: Windows 7
NetBeans version: 8.0.1

Original comment by janos.br...@gmail.com on 20 Oct 2014 at 11:28

GoogleCodeExporter commented 9 years ago
settings the VM options worked for me...

Original comment by manslogic@gmail.com on 6 Nov 2014 at 9:22

Attachments:

GoogleCodeExporter commented 9 years ago
I think your screenshot shows the settings of a plain Netbeans Java *project* 
not a Netbeans *module project*. Maybe the original description was not clear 
enough but what does not work for me is a *module project*. I want to embed 
jcef in the Netbeans IDE itself to have WebGL support in Netbeans (see 
screenshot which uses my patched version of jcef).

Original comment by janos.br...@gmail.com on 6 Nov 2014 at 10:10

Attachments:

GoogleCodeExporter commented 9 years ago
I try to give a more exact description to reproduce the problem so that you can 
verify that my patch works.

1. Open the chromium-embedded2 project from the attached zip file in Netbeans. 
This is a Maven project of a very simple Netbeans module using jcef.
2. Install the jcef jar dependencies manually to the local Maven repo from 
within Netbeans, see screenshots 2 & 3.
3. Copy native dependencies from jcef\src\binary_distrib\win32\bin\lib\win32\*.*
to the folder under the new project chromium-embedded2\release\modules\lib\x86\ 
(see screenshot).
4. Build chromium-embedded2 in Netbeans
5. Run chromium-embedded2 from Netbeans
6. Observe the log output in Netbeans. Without the patch the log is the 
following for me:

...
initialize on Thread[AWT-EventQueue-0,6,main] with library path D:\Program 
Files (x86)\NetBeans 
8.0.1\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\Program 
Files (x86)\ActiveState Komodo Edit 
8\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\W
indowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web 
Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance 
Toolkit\;C:\Program Files 
(x86)\play-1.2.3;C:\Python27;C:\Python27\Scripts;C:\Program Files 
(x86)\cwRsync\bin;C:\Program Files (x86)\Microsoft SQL 
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL 
Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL 
Server\100\DTS\Binn\;C:\Program Files (x86)\apache-maven\bin;C:\Program 
Files\Microsoft\Web Platform Installer\;C:\Program Files 
(x86)\QuickTime\QTSystem\;C:\Program Files\doxygen\bin;C:\Program Files 
(x86)\Java\jdk1.7.0_55\jre\bin;C:\Program Files 
(x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\OpenVPN\bin;C:\Program 
Files\TortoiseSVN\bin;D:\depot_tools;C:\Program Files 
(x86)\Java\jdk1.7.0_55\bin;C:\Program Files 
(x86)\ProTrader\Common;C:\Chocolatey\bin;C:\Program Files (x86)\Git\cmd;;.
[1021/002156:ERROR:child_process_launcher.cc(328)] Failed to launch child 
process
[1021/002157:ERROR:child_process_launcher.cc(328)] Failed to launch child 
process

I hope this helps.

Original comment by janos.br...@gmail.com on 6 Nov 2014 at 10:57

Attachments: