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

Error in ServiceProviderExtensionFinder #5

Open
jchappelle opened this issue Feb 23, 2016 · 2 comments
Open

Error in ServiceProviderExtensionFinder #5

jchappelle opened this issue Feb 23, 2016 · 2 comments

Comments

@jchappelle
Copy link

I'm now experimenting with packaging my application as a zip file and deploying into the plugins folder. When I first did it I noticed my extensions all had two instances. It occurred to me that I needed to remove the META-INF/services files since now I'm using the @extension annotation. When I removed the entire META-INF/services folder I got an exception. So I decided to leave the META-INF/services folder but have it empty. Still the same exception.

I was able to fix it by making my Application class implement PluginManagerFactory and create my plugin manager like so:

    @Override
    public PluginManager createPluginManager(File pluginsDir)
    {
        return new DefaultPluginManager()
        {
            @Override
            protected ExtensionFinder createExtensionFinder()
            {
                return new LegacyExtensionFinder(this);
            }
        };
    }

Here is the exception I got. Am I doing something wrong or is this a bug? Not a huge deal since there is a work around but I did want to make you aware since it may expose a bigger problem.

java.lang.IllegalArgumentException: URI is not hierarchical
     at java.io.File.<init>(Unknown Source)
     at ro.fortsoft.pf4j.ServiceProviderExtensionFinder.readPluginsStorages(ServiceProviderExtensionFinder.java:119)
     at ro.fortsoft.pf4j.AbstractExtensionFinder.readStorages(AbstractExtensionFinder.java:124)
     at ro.fortsoft.pf4j.AbstractExtensionFinder.getEntries(AbstractExtensionFinder.java:131)
     at ro.fortsoft.pf4j.AbstractExtensionFinder.find(AbstractExtensionFinder.java:49)
     at ro.fortsoft.pf4j.DefaultExtensionFinder.find(DefaultExtensionFinder.java:41)
     at ro.fortsoft.pf4j.DefaultPluginManager.getExtensions(DefaultPluginManager.java:555)

Also, when I refreshed the page with a CTRL-F5 I got this exception. Figured this may give you more info into the problem. This was before I implemented the custom PluginManagerFactory.

java.nio.file.FileSystemAlreadyExistsException
     at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:113)
     at java.nio.file.FileSystems.newFileSystem(Unknown Source)
     at java.nio.file.FileSystems.newFileSystem(Unknown Source)
     at ro.fortsoft.pf4j.ServiceProviderExtensionFinder.readClasspathStorages(ServiceProviderExtensionFinder.java:70)
     at ro.fortsoft.pf4j.AbstractExtensionFinder.readStorages(AbstractExtensionFinder.java:123)
     at ro.fortsoft.pf4j.AbstractExtensionFinder.getEntries(AbstractExtensionFinder.java:131)
     at ro.fortsoft.pf4j.AbstractExtensionFinder.find(AbstractExtensionFinder.java:49)
     at ro.fortsoft.pf4j.DefaultExtensionFinder.find(DefaultExtensionFinder.java:41)
     at ro.fortsoft.pf4j.DefaultPluginManager.getExtensions(DefaultPluginManager.java:555)

I'm using the wicket-plugin version 0.5.0.

Thanks!

@decebals
Copy link
Member

I was able to fix it by making my Application class implement PluginManagerFactory and create my plugin manager like so:

It's correct. See also pf4j/pf4j#90 (comment)

java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.(Unknown Source)
at ro.fortsoft.pf4j.ServiceProviderExtensionFinder.readPluginsStorages(ServiceProviderExtensionFinder.java:119)

Something is wrong here because you removed ServiceProviderExtensionFinder overwridded DefaultPluginManager.createExtensionFinder

I the next release I think that I will disabled by default the interoperability with ServiceLoader and if you want this interoperability you must activate it via enableServiceLoader (a possible name) method.

@jchappelle
Copy link
Author

No you misunderstand. Those errors only happen when I DO NOT use my custom PluginManagerFactory.

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

No branches or pull requests

2 participants