jasondlee / Plummer

13 stars 9 forks source link

Having trouble understanding the logic #2

Closed hrsto closed 7 years ago

hrsto commented 7 years ago

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:

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.

import plugin.api.events.
public class NewClass {{
    public void qwe (@Observes EventTest e){
        java.util.logging.Logger.getLogger("log").log(java.util.logging.Level.INFO, "FROM PLUGIN: " + e.getMessage());
    }
}

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.

hrsto commented 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()