我正在使用 WildFly,并且据我所知已经正确配置了 Hotswap Agent 1.0。它以以下消息很好地启动:
HOTSWAP AGENT: 20:01:19.893 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.0} - unlimited runtime class redefinition.
HOTSWAP AGENT: 20:01:21.096 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, ClassInitPlugin, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Seam, ELResolver, WildFlyELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, JavaBeans]
20:01:22,363 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
但是,每次我修改一个类时,我都会在控制台日志中收到以下警告。修改后的类未正确重新加载。
19:56:07,946 INFO [stdout] (Thread-281) HOTSWAP AGENT: 19:56:07.946 WARNING (org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent) - BeanManagerImpl.contexts not accessible
19:56:07,947 INFO [stdout] (Thread-281) java.lang.NoSuchFieldException: contexts
19:56:07,948 INFO [stdout] (Thread-281) at java.lang.Class.getField(Class.java:1703)
19:56:07,948 INFO [stdout] (Thread-281) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.getContexts(BeanDeploymentArchiveAgent.java:269)
19:56:07,948 INFO [stdout] (Thread-281) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.reloadManagedBeanInContexts(BeanDeploymentArchiveAgent.java:318)
19:56:07,948 INFO [stdout] (Thread-281) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.reloadManagedBean(BeanDeploymentArchiveAgent.java:297)
19:56:07,948 INFO [stdout] (Thread-281) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.reloadBean(BeanDeploymentArchiveAgent.java:231)
19:56:07,948 INFO [stdout] (Thread-281) at org.hotswap.agent.plugin.weld.command.BeanDeploymentArchiveAgent.refreshBeanClass(BeanDeploymentArchiveAgent.java:192)
19:56:07,948 INFO [stdout] (Thread-281) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:56:07,949 INFO [stdout] (Thread-281) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
19:56:07,949 INFO [stdout] (Thread-281) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
19:56:07,949 INFO [stdout] (Thread-281) at java.lang.reflect.Method.invoke(Method.java:497)
19:56:07,949 INFO [stdout] (Thread-281) at org.hotswap.agent.plugin.weld.command.BeanClassRefreshCommand.executeCommand(BeanClassRefreshCommand.java:93)
19:56:07,949 INFO [stdout] (Thread-281) at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:25)
19:56:07,950 INFO [stdout] (Thread-281)
19:56:08,030 INFO [stdout] (Thread-282) HOTSWAP AGENT: 19:56:08.030 INFO (org.hotswap.agent.plugin.wildfly.el.PurgeWildFlyBeanELResolverCacheCommand) - Cleaning BeanPropertiesCache lgc.mysynap.ui.components.SourcePopup ModuleClassLoader for Module "deployment.mysynap-0.1.war:main" from Service Module Loader.
知道可能是什么原因吗?