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

[ISSUE] FileSystemNotFoundException: Provider "bundleresource" not installed #495

Open
abhinav-kipper opened this issue Jun 16, 2021 · 7 comments

Comments

@abhinav-kipper
Copy link

abhinav-kipper commented Jun 16, 2021

Hi,
I am using playwright version 1.2.0 and getting the "Provider "bundleresource" not installed" exception.

Stacktrace -

Caused by: java.lang.RuntimeException: Failed to create driver
	at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:46)
	at com.microsoft.playwright.impl.PlaywrightImpl.create(PlaywrightImpl.java:33)
	at com.microsoft.playwright.Playwright.create(Playwright.java:76)
	at printjob.browser.ChromiumBrowser.<init>(ChromiumBrowser.java:18)
	at printjob.browser.ChromiumBrowser.getInstance(ChromiumBrowser.java:35)
	at printjob.PrintJob.getBrowserContext(PrintJob.java:28)
	at printjob.PrintJob.execute(PrintJob.java:35)

Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_172]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_172]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_172]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_172]
	at com.microsoft.playwright.impl.Driver.createDriver(Driver.java:65)
	at com.microsoft.playwright.impl.Driver.ensureDriverInstalled(Driver.java:44)
	... 34 more
Caused by: java.nio.file.FileSystemNotFoundException: Provider "bundleresource" not installed
	at java.nio.file.Paths.get(Paths.java:147)[:1.8.0_172]
	at com.microsoft.playwright.impl.DriverJar.extractDriverToTempDir(DriverJar.java:68)
	at com.microsoft.playwright.impl.DriverJar.<init>(DriverJar.java:32)

POM snippet-
I used maven bundle plugin OSGI for bundling/creating jar of my project.

<plugin>
    
<groupId>org.apache.felix</groupId>
    
     <artifactId>maven-bundle-plugin</artifactId>
    
     <version>5.1.2</version>
    
     <extensions>true</extensions>
    
     <configuration>
        
            <unpackBundle>true</unpackBundle>
        
            <instructions>
            
                    <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                     
                    <Export-Package>com.project.html2pdf</Export-Package>
           
                    <Embed-Dependency>*;scope=compile</Embed-Dependency>
            
                   <Import-Package>sun.misc.*;resolution:=optional,*</Import-Package>
            
                   <Embed-Transitive>true</Embed-Transitive>
        
             </instructions>
   
        </configuration>

</plugin>


<dependency>
   
        <groupId>com.microsoft.playwright</groupId>
    
       <artifactId>playwright</artifactId>
    
       <version>1.12.0</version>
    
       <scope>compile</scope>

</dependency>
```


Can anyone please help resolve this issue?
@abhinav-kipper
Copy link
Author

Speculation Ques - Can this issue occur if the browsers are not installed at location - %USERPROFILE%\AppData\Local\ms-playwright by playwright dependency? Because of internal proxy or something else?

@yury-s
Copy link
Member

yury-s commented Jun 16, 2021

Do you build a single jar app? Can you share the project? I'm interested in the pom.xml where the bundling is configured.

Speculation Ques - Can this issue occur if the browsers are not installed at location - %USERPROFILE%\AppData\Local\ms-playwright by playwright dependency? Because of internal proxy or something else?

The browsers are not getting installed because it fails on the previous step where it tries to extract driver binaries from driver-bundle.jar to a temp directory. I believe the problem is similar to the one we fixed for springboot in #306

@abhinav-kipper
Copy link
Author

@yury-s Unfortunately I cannot share the project, however I am creating standard OSGI bundle by adding packaging tag like this -
<groupId>groupid</groupId> <artifactId>artifactid</artifactId>
 <version>1.0.0</version>
 <packaging>bundle</packaging>

and using maven-bundle-plugin for the bundling which is configured as per the pom shared above.

I referred to the issue #306 , So Does the issue can be that driver-bundle.jar not present in the class path ?

@yury-s
Copy link
Member

yury-s commented Jun 17, 2021

I referred to the issue #306 , So Does the issue can be that driver-bundle.jar not present in the class path ?

Most likely there is no FileSystem provider for bundleresource scheme. This comment explains similar problem in another project. Basically there has to be a provider that represents bundleresource resources as a java filesystem (similar to jar files), without it Paths.get("bundleresource://...") will throw.

@abhinav-kipper
Copy link
Author

I tried resolving the issue but could not find anything helpful.

@yury-s I have created a OSGI dummy project for you to be able to reciprocate the issue and debug easily.

Can you please help resolving this issue?

@abhinav-kipper
Copy link
Author

Screenshot 2021-06-23 at 8 41 48 PM

Image of similar exception thrown by dummy project

@RaHehl
Copy link

RaHehl commented Feb 1, 2023

There is no easy fix for accessing the bundled drivers in the OSGI environment, but i found another solution:

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

No branches or pull requests

4 participants