创建 CEF 浏览器失败

时间:2021-03-08 08:19:20

标签: codenameone

我的应用无法构建甚至运行。它给我一个创建 CEF 浏览器失败的错误。 直到今天,一切都运行良好。我按照此链接中的说明再次卸载并安装了 CEF:Big Changes and CEF 但它仍然给了我错误。 这是控制台中的完整错误:

java.lang.RuntimeException: Failed to create CEF browser
[EDT] 0:0:0,40 - Exception: java.lang.RuntimeException - Failed to create CEF browser
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:130)
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createBrowserComponent(JavaCEFSEPort.java:98)
    at com.codename1.ui.BrowserComponent$9.run(BrowserComponent.java:557)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1338)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1280)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:1162)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.UnsatisfiedLinkError: /home/falcon/.codenameone/cef/lib/linux64/libjcef.so: libjawt.so: cannot open shared object file: No such file or directory
    at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
    at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
    at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2640)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
    at java.base/java.lang.System.loadLibrary(System.java:1873)
    at org.cef.SystemBootstrap$1.loadLibrary(SystemBootstrap.java:24)
    at org.cef.SystemBootstrap.loadLibrary(SystemBootstrap.java:36)
    at org.cef.CefApp.startup(CefApp.java:536)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:207)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:199)
    at com.codename1.impl.javase.cef.CEFBrowserComponent.create(CEFBrowserComponent.java:196)
    at com.codename1.impl.javase.cef.JavaCEFSEPort.createCEFBrowserComponent(JavaCEFSEPort.java:136)
    at com.codename1.impl.javase.cef.JavaCEFSEPort$2.run(JavaCEFSEPort.java:120)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
java.lang.RuntimeException: Failed to create screenshots for HTML <!doctype html> ...(CSS file contents)
</html>.  Timeout reached.  Likely there was a problem initializing the browser component.
    at com.codename1.designer.css.ResourcesMutator.createScreenshots(ResourcesMutator.java:668)
    at com.codename1.designer.css.CSSTheme.createImageBorders(CSSTheme.java:2562)
    at com.codename1.designer.css.CN1CSSCLI.compile(CN1CSSCLI.java:916)
    at com.codename1.designer.css.CN1CSSCLI.main(CN1CSSCLI.java:780)
    at com.codename1.designer.ResourceEditorApp._main(ResourceEditorApp.java:568)
    at com.codename1.designer.ResourceEditorApp.main(ResourceEditorApp.java:258)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.codename1.impl.javase.CN1Bootstrap.run(CN1Bootstrap.java:218)
    at com.codename1.impl.javase.CN1Bootstrap.run(CN1Bootstrap.java:96)
    at com.codename1.designer.ResourceEditorApp.main(ResourceEditorApp.java:265)
/home/falcon/NetBeansProjects/bizapp_mobile/build.xml:625: Java returned: 1
BUILD FAILED (total time: 1 minute 2 seconds)

可能是什么问题?

1 个答案:

答案 0 :(得分:2)

这是一个 known issue Linux 现在。

<块引用>

UnsatisfiedLinkException (libjcef.so: libjawt.so) 在 Ubuntu 20 和其他一些 Linux 版本上,据报道,当运行安装了 CEF 的 Codename One 模拟器时,您会收到 UnsatisfiedLinkException,其中提到 libjcef.so 找不到 libjawt.so。这是因为JDK的lib目录不在LD_LIBRARY_PATH中。您可以通过添加它来解决此问题。例如

导出 LD_LIBRARY_PATH=$JAVA_HOME/lib/amd64