Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create driver in springboot3.2 #1434

Closed
kukume opened this issue Nov 30, 2023 · 6 comments
Closed

Failed to create driver in springboot3.2 #1434

kukume opened this issue Nov 30, 2023 · 6 comments
Labels

Comments

@kukume
Copy link

kukume commented Nov 30, 2023

Windows and debian both show this error.
The playwright version is 1.40.0
Build a jar with SpringBoot 3.2 build plugin, then execute java -jar xx.jar,
and throw a exception in code Playwright.create(). SpringBoot 3.1 have no exception.

java.lang.RuntimeException: Failed to create driver
        at com.microsoft.playwright.impl.driver.Driver.createAndInstall(Driver.java:105) ~[driver-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.driver.Driver.ensureDriverInstalled(Driver.java:57) ~[driver-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.PlaywrightImpl.createImpl(PlaywrightImpl.java:45) ~[playwright-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.PlaywrightImpl.create(PlaywrightImpl.java:35) ~[playwright-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.Playwright.create(Playwright.java:110) ~[playwright-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.Playwright.create(Playwright.java:114) ~[playwright-1.40.0.jar!/:1.40.0]
        at me.kuku.api.utils.PlaywrightUtils$playwright$2.invoke(PlaywrightUtils.kt:14) ~[!/:1.0-SNAPSHOT]
        at me.kuku.api.utils.PlaywrightUtils$playwright$2.invoke(PlaywrightUtils.kt:13) ~[!/:1.0-SNAPSHOT]
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) ~[kotlin-stdlib-1.9.21.jar!/:1.9.21-release-633]
        at me.kuku.api.utils.PlaywrightUtils.getPlaywright(PlaywrightUtils.kt:13) ~[!/:1.0-SNAPSHOT]
        at me.kuku.api.utils.PlaywrightUtils.browser(PlaywrightUtils.kt:20) ~[!/:1.0-SNAPSHOT]
        at me.kuku.api.utils.PlaywrightUtils.browser$default(PlaywrightUtils.kt:17) ~[!/:1.0-SNAPSHOT]
        at me.kuku.api.logic.NodeSeekLogic.sign(NodeSeekLogic.kt:88) ~[!/:1.0-SNAPSHOT]
        at me.kuku.api.logic.NodeSeekLogic$sign$1.invokeSuspend(NodeSeekLogic.kt) ~[!/:1.0-SNAPSHOT]
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.9.21.jar!/:1.9.21-release-633]
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) ~[kotlinx-coroutines-core-jvm-1.7.3.jar!/:na]
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) ~[netty-common-4.1.101.Final.jar!/:4.1.101.Final]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) ~[netty-common-4.1.101.Final.jar!/:4.1.101.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[netty-common-4.1.101.Final.jar!/:4.1.101.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) ~[netty-transport-4.1.101.Final.jar!/:4.1.101.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.101.Final.jar!/:4.1.101.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.101.Final.jar!/:4.1.101.Final]
        at io.ktor.server.netty.EventLoopGroupProxy$Companion.create$lambda$1$lambda$0(NettyApplicationEngine.kt:296) ~[ktor-server-netty-jvm-2.3.5.jar!/:2.3.5]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.101.Final.jar!/:4.1.101.Final]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Caused by: java.util.zip.ZipException: read CEN tables failed
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1561) ~[jdk.zipfs:na]
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:179) ~[jdk.zipfs:na]
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getZipFileSystem(ZipFileSystemProvider.java:125) ~[jdk.zipfs:na]
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:106) ~[jdk.zipfs:na]
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:339) ~[na:na]
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:288) ~[na:na]
        at com.microsoft.playwright.impl.driver.jar.DriverJar.initFileSystem(DriverJar.java:111) ~[driver-bundle-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.driver.jar.DriverJar.extractDriverToTempDir(DriverJar.java:127) ~[driver-bundle-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.driver.jar.DriverJar.initialize(DriverJar.java:66) ~[driver-bundle-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.driver.Driver.initialize(Driver.java:64) ~[driver-1.40.0.jar!/:1.40.0]
        at com.microsoft.playwright.impl.driver.Driver.createAndInstall(Driver.java:101) ~[driver-1.40.0.jar!/:1.40.0]
        ... 24 common frames omitted

In stack

 at me.kuku.api.utils.PlaywrightUtils$playwright$2.invoke(PlaywrightUtils.kt:14) ~[!/:1.0-SNAPSHOT]
        at me.kuku.api.utils.PlaywrightUtils$playwright$2.invoke(PlaywrightUtils.kt:13) ~[!/:1.0-SNAPSHOT]

code is

    val playwright: Playwright by lazy {
        Playwright.create()
    }
@yury-s
Copy link
Member

yury-s commented Nov 30, 2023

We don't officially support spring boot loader, but it looks like there is a problem with how the driver is packaged and extracted from the zip: java.util.zip.ZipException: read CEN tables failed. Perhaps something have changed in the zip fs or how the resources are packaged? Can you share a repro?

@kukume
Copy link
Author

kukume commented Dec 2, 2023

@yury-s
Copy link
Member

yury-s commented Dec 4, 2023

We cannot debug a jar file, by repro I meant source code of a minimal project. Try debugging what's going on during the unzip (FileSystems.newFileSystem), why it is failing when updating SpringBoot 3.1 -> 3.2. Since playwright didn't change, it has something to do with the spring boot version and your build configuration.

@kukume
Copy link
Author

kukume commented Dec 5, 2023

It a source code zip: https://minio.kuku.me/kuku/playwright.zip
And only upgrade springboot from 3.1 to 3.2, it throw exception in jar

@dgozman
Copy link

dgozman commented Dec 5, 2023

@kukume Unfortunately, supporting SpringBoot loader is out of scope of Playwright. If you manage to figure out a fix, consider posting the solution here for others to benefit.

@dgozman dgozman closed this as completed Dec 5, 2023
@fairjm
Copy link

fairjm commented Dec 19, 2023

this is a spring boot bug.
see:
spring-projects/spring-boot#38595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants