playwright-java: [BUG] Can't run in Springboot application
When I use spring-boot-maven-plugin to build a jar and use java -jar demo.jar, it dosen’t run and throws exception.
java.nio.file.NoSuchFileException: /BOOT-INF/lib/driver-bundle-0.180.0.jar!/driver/win32_x64 at com.sun.nio.zipfs.ZipPath.getAttributes(ZipPath.java:666) at com.sun.nio.zipfs.ZipFileSystemProvider.readAttributes(ZipFileSystemProvider.java:294) at java.nio.file.Files.readAttributes(Unknown Source) at java.nio.file.FileTreeWalker.getAttributes(Unknown Source) at java.nio.file.FileTreeWalker.visit(Unknown Source) at java.nio.file.FileTreeWalker.walk(Unknown Source) at java.nio.file.FileTreeIterator.<init>(Unknown Source) at java.nio.file.Files.walk(Unknown Source) at java.nio.file.Files.walk(Unknown Source) at com.microsoft.playwright.impl.DriverJar.extractDriverToTempDir(DriverJar.java:58) at com.microsoft.playwright.impl.DriverJar.<init>(DriverJar.java:18) … 17 more
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 16 (5 by maintainers)
@yury-s I have just tried, and the issue has been fixed in my case. Thanks a lot, really appreciated.
@AhmedRiyad I had the same problem with 0.180.0 version. I’ve manually added to \lib\driver-bundle-0.180.0.jar in my project and start with -Dloader.path=lib/ org.springframework.boot.loader.PropertiesLauncher in my Dockerfile. And everything is good now.
@yury-s I had the same issue, and after debugging, I found that this line of code
Path relative = srcRoot.relativize(fromPath);inDriverJar.javais not working as expected in this case.e.g. srcRoot was
/driver/mac/and fromPath was'/driver/mac/playwright.sh'and the result was../mac/playwright.shI’m not an expert in Java, but it gave me the correct result when I tried this way.
Paths.get(srcRoot.toString()).relativize(Paths.get(fromPath.toString()))