Circular loading of installed providers detected
Michael Hall
mik3hall at gmail.com
Wed Sep 29 20:59:48 UTC 2021
> On Sep 29, 2021, at 2:02 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 29/09/2021 18:28, Michael Hall wrote:
>> I have a FileSystemProvider with something like…
>>
>> public MacFileSystemProvider() {
>> List<FileSystemProvider> providers = FileSystemProvider.installedProviders();
>> for (FileSystemProvider provider : providers) {
>>
>> To search for the platform ‘file’ scheme provider to set as it’s priorProvider.
>>
>> I was trying to launch code that apparently attemps to reinstantiate a new no args instance (JShell via API)
>> getting…
>>
>> Caused by: java.lang.Error: Circular loading of installed providers detected
>> at java.base/java.nio.file.spi.FileSystemProvider.installedProviders(Unknown Source)
>> at us.hall.trz.osx.MacFileSystemProvider.<init>(MacFileSystemProvider.java:41)
>> at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> …
>>
>> This isn’t really circular it is just being done a second time.
>>
>> Should it be up to installedProviders() to know it has already been done and return what it already loaded?
>>
>> Or should my code handle this probably by changing it’s saved priorProvider to static and not trying to set it again if it is not null?
>>
> If you change the public constructor to have a FileSystemProvider parameter then it will be called with a reference to the built-in provider. That should avoid the need to iterated through the installed providers.
>
> -Alan.
The class has both constructors. With and without. I don’t remember why. The JShell invocation does seem to use the no argument.
Sorry for the length, full stack traces…
System.out.println("Hello, World!")
java.lang.InternalError: Exception during parse - java.util.ServiceConfigurationError: java.nio.file.spi.FileSystemProvider: Provider us.hall.trz.osx.MacFileSystemProvider could not be instantiated
at jdk.jshell/jdk.jshell.TaskFactory$ParseTask.parse(Unknown Source)
at jdk.jshell/jdk.jshell.TaskFactory$ParseTask.<init>(Unknown Source)
at jdk.jshell/jdk.jshell.TaskFactory.lambda$parse$0(Unknown Source)
at jdk.jshell/jdk.jshell.TaskFactory.lambda$runTask$4(Unknown Source)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskPool.getTask(Unknown Source)
at jdk.jshell/jdk.jshell.TaskFactory.runTask(Unknown Source)
at jdk.jshell/jdk.jshell.TaskFactory.parse(Unknown Source)
at jdk.jshell/jdk.jshell.TaskFactory.parse(Unknown Source)
at jdk.jshell/jdk.jshell.Eval.sourceToSnippets(Unknown Source)
at jdk.jshell/jdk.jshell.Eval.eval(Unknown Source)
at jdk.jshell/jdk.jshell.JShell.eval(Unknown Source)
at us.hall.repl.JShellReplImpl.main(JShellReplImpl.java:27)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.cmdline.psuedoGestalt.Runner.invoke(Runner.java:209)
at org.cmdline.psuedoGestalt.Runner.runStatic(Runner.java:236)
at org.cmdline.psuedoGestalt.Runner.runMain(Runner.java:228)
at org.cmdline.psuedoGestalt.Runner.run(Runner.java:146)
Caused by: java.lang.RuntimeException: java.util.ServiceConfigurationError: java.nio.file.spi.FileSystemProvider: Provider us.hall.trz.osx.MacFileSystemProvider could not be instantiated
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(Unknown Source)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.parse(Unknown Source)
... 20 more
Caused by: java.util.ServiceConfigurationError: java.nio.file.spi.FileSystemProvider: Provider us.hall.trz.osx.MacFileSystemProvider could not be instantiated
at java.base/java.util.ServiceLoader.fail(Unknown Source)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(Unknown Source)
at java.base/java.util.ServiceLoader$ProviderImpl.get(Unknown Source)
at java.base/java.util.ServiceLoader$3.next(Unknown Source)
at java.base/java.nio.file.spi.FileSystemProvider.loadInstalledProviders(Unknown Source)
at java.base/java.nio.file.spi.FileSystemProvider$1.run(Unknown Source)
at java.base/java.nio.file.spi.FileSystemProvider$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.nio.file.spi.FileSystemProvider.installedProviders(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.FSInfo.getJarFSProvider(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$SearchPath.addFile(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$SearchPath.addFiles(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$SearchPath.addFiles(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$SearchPath.addFiles(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$ClassPathLocationHandler.computePath(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$SimpleLocationHandler.setPaths(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$ClassPathLocationHandler.lazy(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations$ClassPathLocationHandler.getPaths(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.Locations.getLocation(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getLocation(Unknown Source)
at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getClassLoader(Unknown Source)
at jdk.jshell/jdk.jshell.MemoryFileManager.getClassLoader(Unknown Source)
at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager.getClassLoader(Unknown Source)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.initProcessorLoader(Unknown Source)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.<init>(Unknown Source)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.instance(Unknown Source)
at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugins(Unknown Source)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.prepareCompiler(Unknown Source)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.parseInternal(Unknown Source)
... 22 more
Caused by: java.lang.Error: Circular loading of installed providers detected
at java.base/java.nio.file.spi.FileSystemProvider.installedProviders(Unknown Source)
at us.hall.trz.osx.MacFileSystemProvider.<init>(MacFileSystemProvider.java:41)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.base/java.util.ServiceLoader$ProviderImpl$2.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
... 50 more
More information about the nio-dev
mailing list