I'm using wildfly 8.2 with CDI and EJB. I'm having errors using the HotswapAgent. if I make a change in one of my @Stateless beans, I get:
15:45:14,951 INFO [stdout] (Thread-341) java.lang.reflect.InvocationTargetException
15:45:14,951 INFO [stdout] (Thread-341) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:45:14,951 INFO [stdout] (Thread-341) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:45:14,951 INFO [stdout] (Thread-341) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:45:14,951 INFO [stdout] (Thread-341) at java.lang.reflect.Method.invoke(Method.java:497)
15:45:14,951 INFO [stdout] (Thread-341) at org.hotswap.agent.plugin.weld.command.BeanClassRefreshCommand.executeCommand(BeanClassRefreshCommand.java:73)
15:45:14,951 INFO [stdout] (Thread-341) at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:25)
15:45:14,951 INFO [stdout] (Thread-341) Caused by: java.lang.IllegalStateException: JBAS016071: Singleton not set for ModuleClassLoader for Module "deployment.mytest.war:main" from Service Module Loader. This means that you are trying to access a weld deployment with a Thread Context ClassLoader that is not associated with the deployment.
15:45:14,951 INFO [stdout] (Thread-341) at org.jboss.as.weld.services.ModuleGroupSingletonProvider$TCCLSingleton.get(ModuleGroupSingletonProvider.java:77)
15:45:14,951 INFO [stdout] (Thread-341) at org.jboss.as.weld.services.ModuleGroupSingletonProvider$TCCLSingleton.get(ModuleGroupSingletonProvider.java:134)
15:45:14,951 INFO [stdout] (Thread-341) at org.jboss.weld.Container.instance(Container.java:55)
15:45:14,951 INFO [stdout] (Thread-341) at org.jboss.as.weld.WeldProvider.getCDI(WeldProvider.java:61)
15:45:14,951 INFO [stdout] (Thread-341) at javax.enterprise.inject.spi.CDI.current(CDI.java:60)
15:45:14,951 INFO [stdout] (Thread-341) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.reloadBean(BeanDeploymentArchiveAgent.java:179)
15:45:14,951 INFO [stdout] (Thread-341) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.refreshBeanClass(BeanDeploymentArchiveAgent.java:157)
15:45:14,951 INFO [stdout] (Thread-341) ... 6 more
I read that the weld plugin doesn't support EJB that well yet, and I should just disable it. I did so by creating a hotswap-agent.properties file in src/main/resources, with the line:
I then try to restart wildfly, but it gives an error because the Weld plugin is disabled:
15:50:26,184 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016002: Processing weld deployment mytest.war
15:50:26,186 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."mytest.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."mytest.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "mytest.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_51]
Caused by: java.lang.Error: java.lang.IllegalArgumentException: Plugin class org.hotswap.agent.plugin.weld.WeldPlugin is not initialized in classloader ModuleClassLoader for Module "deployment.mytest.war:main" from Service Module Loader.
at org.jboss.as.weld.deployment.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:95)
at org.jboss.as.weld.deployment.processors.BeanArchiveProcessor$ResourceRootHandler.createExplicitBeanDeploymentArchive(BeanArchiveProcessor.java:328)
at org.jboss.as.weld.deployment.processors.BeanArchiveProcessor$ResourceRootHandler.processResourceRoot(BeanArchiveProcessor.java:287)
at org.jboss.as.weld.deployment.processors.BeanArchiveProcessor$ResourceRootHandler.handleResourceRoot(BeanArchiveProcessor.java:221)
at org.jboss.as.weld.deployment.processors.BeanArchiveProcessor$ResourceRootHandler.access$100(BeanArchiveProcessor.java:193)
at org.jboss.as.weld.deployment.processors.BeanArchiveProcessor.deploy(BeanArchiveProcessor.java:116)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 5 more
Caused by: java.lang.IllegalArgumentException: Plugin class org.hotswap.agent.plugin.weld.WeldPlugin is not initialized in classloader ModuleClassLoader for Module "deployment.mytest.war:main" from Service Module Loader.
at org.hotswap.agent.config.PluginRegistry.getPlugin(PluginRegistry.java:196) [hotswap-agent.jar:0.3.1-SNAPSHOT]
at org.hotswap.agent.config.PluginManager.getPlugin(PluginManager.java:75) [hotswap-agent.jar:0.3.1-SNAPSHOT]
at org.hotswap.agent.config.PluginManager.getPlugin(PluginManager.java:60) [hotswap-agent.jar:0.3.1-SNAPSHOT]
How can I either fix the weld plugin, or disable it (so I can at least use some of the HotswapAgent features)?