UnsatisfiedLinkError with JCEF

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

UnsatisfiedLinkError with JCEF

Postby alrick » Mon Jul 08, 2019 6:32 am

Context :
  • Linux 64 debian
  • Java jdk 1.8.0_181
  • CEF_VERSION 75.0.13+g2c92fcd+chromium-75.0.3770.100 into CMakeLists.txt
  • Commit 467f8fc 2019-07-02

Here is the project tree :

Code: Select all
.
├── pom.yml
├── java-cef/. <------- the cloned java-cef repository
├── lib/ <------------- where builded jar cef and dependencies are stored
|   ├── jogamp/gluegen/1.0/gluegen-1.0.jar
|   ├── jogamp/jogl/1.0/jogl-1.0.jar
|   └── org/cef/1.0/cef-1.0.jar
└── src/


I am building the JCEF native sources, here are the followed commands :

Code: Select all
# Build the JCEF natives and jar
cd java-cef
mkdir jcef_build && cd jcef_build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
make -j4
cd ../tools
./compile.sh linux64
./make_jar.sh linux64

# Install the CEF jar and it's jar dependencies into lib/ folder
cd ../../
mvn install:install-file -Dfile=java-cef/out/linux64/jcef.jar -DgroupId=org -DartifactId=cef -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=lib
mvn install:install-file -Dfile=java-cef/third_party/jogamp/jar/jogl-all-natives-linux-amd64.jar -DgroupId=jogamp -DartifactId=jogl -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=lib
mvn install:install-file -Dfile=java-cef/third_party/jogamp/jar/gluegen-rt.jar -DgroupId=jogamp -DartifactId=gluegen -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=lib

# Link to avoid ICU internal errors of CEF
ln -s $PWD/native/Release/icudtl.dat $JAVA_HOME/jre/bin/icudtl.dat
ln -s $PWD/native/Release/natives_blob.bin $JAVA_HOME/jre/bin/natives_blob.bin
ln -s $PWD/native/Release/snapshot_blob.bin $JAVA_HOME/jre/bin/snapshot_blob.bin

mvn install


Here is the pom.xml :

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>my.app</groupId>
    <artifactId>app</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <dependencies>
    <!-- JCEF dependencies -->
        <dependency>
            <groupId>org</groupId>
            <artifactId>cef</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>jogamp</groupId>
            <artifactId>gluegen</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>jogamp</groupId>
            <artifactId>jogl</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>       
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- All about bash/bat creation -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>2.0.0</version>
                <configuration>
                    <programs>
                        <!-- generic -->
                        <program>
                            <mainClass>my.app.boot.Boot</mainClass>
                            <id>player</id>
                            <jvmSettings>
                                <extraArguments>
                                    <extraArgument>-Djava.library.path=${project.basedir}/java-cef/jcef_build/native/Release:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib</extraArgument>
                                </extraArguments>
                            </jvmSettings>
                        </program>
                    </programs>
                    <assembleDirectory>${project.basedir}</assembleDirectory>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


Issue :

When src code runs
Code: Select all
CefApp.getInstance(args, settings).getVersion();
it returns null and throws the following error :

Code: Select all
java.lang.UnsatisfiedLinkError: org.cef.CefApp.N_GetVersion()Lorg/cef/CefApp$CefVersion;
    at org.cef.CefApp.N_GetVersion(Native Method)
    at org.cef.CefApp.getVersion(CefApp.java:235)
    at my.app.boot.Browser.<init>(Browser.java:42)
    at my.app.boot.Boot.main(Boot.java:52)


Any idea ?
alrick
Newbie
 
Posts: 1
Joined: Mon Jul 08, 2019 6:25 am

Re: UnsatisfiedLinkError with JCEF

Postby magreenblatt » Mon Jul 08, 2019 2:27 pm

Looks like you're missing the native binaries. You should compare to the distribution created by the make_distrib.sh script.
magreenblatt
Site Admin
 
Posts: 12384
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 15 guests