Closed hrsto closed 7 years ago
Right. The problem was with the class loader. The thread context class loader didn't work out, don't know why. But when used the class loader of the class that implements javax.enterprise.inject.spi.Extension, it works. PluginLoader.class.getClassLoader()
Hi. This is an interesting project, but is something i am struggling with for some days now.
Lets use wildfly 10.1 . The goal is to have a servlet fire CDI events and a dynamically loaded plugin capture those events.
Structure is as follows:
com.hr.plugin.MainServlet - just a doGet(...){...} method that will fire a CDI event similarly to your com.steeplesoft.plummer.example.webapp.BlogBean public String addEntry(){...} method
com.hr.plugin.PluginUpload - a doPost(){} method that will handle a post request, accepting a number of files and uploading them to a DB in binary format. The DB table that will hold the plugins will look like: (
name
varchar(255) primary key,plugin
longblob).com.hr.plugin.InitPlugins - this will be your com.steeplesoft.plummer.kernel.PluginLoader . In the beforeBeanDiscovery method it will first connect to the database, get the binary data for every plugin, and following the steps in com.steeplesoft.plummer.kernel.FilesystemPluginFinder and com.steeplesoft.plummer.kernel.PluginClassLoader, load the plugins and create AnnotatedType
It all goes well, AnnotatedType is added successfully, no errors are thrown. But the plugin is not able to catch any event - it just doesn't work - no errors, no nothing.
Will it be possible to provide more theory behind how all this ties together. I read your blog entry, but it's still a bit concise and the code is hard to make out at times.