SOLVED:Unable to lock surface

Having problems with building or using the JCEF Java binding? Ask your questions here.

SOLVED:Unable to lock surface

Postby JCEFBeginner » Thu Aug 19, 2021 12:44 pm

Hello,
when I start my application with JCEF then I get the following stack trace:
Code: Select all
Exception in thread "AWT-EventQueue-0" com.jogamp.nativewindow.NativeWindowException: Unable to lock surface
   at jogamp.nativewindow.jawt.x11.X11JAWTWindow.lockSurfaceImpl(X11JAWTWindow.java:84)
   at com.jogamp.nativewindow.awt.JAWTWindow.lockSurface(JAWTWindow.java:677)
   at com.jogamp.opengl.awt.GLCanvas.createJAWTDrawableAndContext(GLCanvas.java:718)
   at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:621)
   at org.cef.browser.CefBrowserOsr$1.addNotify(CefBrowserOsr.java:194)
   at java.awt.Container.addNotify(Container.java:2776)
   at javax.swing.JComponent.addNotify(JComponent.java:4740)
   at java.awt.Container.addNotify(Container.java:2776)
   at javax.swing.JComponent.addNotify(JComponent.java:4740)
   at java.awt.Container.addNotify(Container.java:2776)
   at javax.swing.JComponent.addNotify(JComponent.java:4740)
   at java.awt.Container.addNotify(Container.java:2776)
   at javax.swing.JComponent.addNotify(JComponent.java:4740)
   at javax.swing.JRootPane.addNotify(JRootPane.java:757)
   at java.awt.Container.addNotify(Container.java:2776)
   at java.awt.Window.addNotify(Window.java:770)
   at java.awt.Frame.addNotify(Frame.java:487)
   at java.awt.Window.pack(Window.java:807)
        [...]

I also tried to reproduce it with the JCEF test applications, but I couldn't reproduce it.

JCEFBeginner
Last edited by JCEFBeginner on Thu Aug 26, 2021 1:17 pm, edited 1 time in total.
JCEFBeginner
Techie
 
Posts: 18
Joined: Fri Feb 12, 2021 12:17 pm

Re: Unable to lock surface

Postby magreenblatt » Thu Aug 19, 2021 12:57 pm

Compare your code to the sample applications. Are you calling CefApp.startup?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Unable to lock surface

Postby JCEFBeginner » Sun Aug 22, 2021 8:41 am

I created a simple application with JCEF for test purposes:

Code: Select all
import org.cef.CefApp;
import org.cef.CefClient;
import org.cef.CefSettings;
import org.cef.browser.CefBrowser;

import javax.swing.*;
import java.awt.*;

class CefTest {
    public static void main(String[] args) {
        CefApp.startup(args);
        CefSettings settings = new CefSettings();
        settings.windowless_rendering_enabled = true;
        CefApp app = CefApp.getInstance(settings);
        CefClient client = app.createClient();
        CefBrowser browser = client.createBrowser("www.google.de", true, false);
        Component browserUI = browser.getUIComponent();

        JFrame frame = new JFrame();
        frame.add(browserUI);
        frame.setVisible(true);

    }
}


As soon as the frame is set to visible, the exception is thrown.
Another thing that is to say is that this problem only persists on Linux, not on Windows. (I don't know how it is on Mac)
JCEFBeginner
Techie
 
Posts: 18
Joined: Fri Feb 12, 2021 12:17 pm

Re: Unable to lock surface

Postby JCEFBeginner » Thu Aug 26, 2021 12:47 pm

I got my simple application from my last post to work, by putting the initialization of the JFrame before "CefApp.startup(args)".
But my other application is still not working.
EDIT: My application is now working. Thank you, for your answer
JCEFBeginner
Techie
 
Posts: 18
Joined: Fri Feb 12, 2021 12:17 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 23 guests