pf4j-wicket
pf4j-wicket copied to clipboard
Error in ServiceProviderExtensionFinder
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!
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 https://github.com/decebals/pf4j/issues/90#issuecomment-186682650
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.
No you misunderstand. Those errors only happen when I DO NOT use my custom PluginManagerFactory.