Hotswap-agent on JBoss EAP 6.1 - java.lang.OutOfMemoryError: PermGen space
Hotswap-agent on JBoss EAP 6.1 - java.lang.OutOfMemoryError: PermGen space
我有一个要部署到 Jboss EAP 6.1 的 EAR 项目。我的 Maven 构建的产品如下所示:
myapp-ear
├── myapp-ejb.jar
├── myapp-web.war
├── lib
│ ├── activation.jar
│ ├── activiti-bpmn-converter.jar
│ ├── activiti-bpmn-model.jar
.....
│ ├── xml-apis.jar
│ └── xmlbeans.jar
└── META-INF
├── application.xml
├── hotswap-agent.properties
├── myapp-ds.xml
├── jboss-deployment-structure.xml
└── MANIFEST.MF
这是我在部署我的应用程序时在 jboss 日志中得到的内容:
21:34:55,570 INFO [stdout] (MSC service thread 1-5) HOTSWAP AGENT: 21:34:55.569 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.jbossmodules.JBossModulesPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ds.xml:main" from Service Module Loader'.
21:35:04,357 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "null" (runtime-name: "myapp-web.war")
21:35:04,357 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "null" (runtime-name: "myapp-ejb.jar")
21:35:04,781 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for myproject
21:35:05,306 INFO [stdout] (MSC service thread 1-7) HOTSWAP AGENT: 21:35:05.306 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.jbossmodules.JBossModulesPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ear.ear:main" from Service Module Loader'.
和
21:35:05,488 INFO [stdout] (MSC service thread 1-6) HOTSWAP AGENT: 21:35:05.487 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ear.ear.myapp-web.war:main" from Service Module Loader'.
21:35:05,520 INFO [stdout] (MSC service thread 1-4) HOTSWAP AGENT: 21:35:05.517 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.jbossmodules.JBossModulesPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ear.ear.myapp-ejb.jar:main" from Service Module Loader'.
问题是,当我将耳朵部署到 jboss 时,它花费的时间大约是正常时间的 10 倍,而当我尝试从浏览器访问该应用程序时,它会抛出一个 "PermGen space: java.lang.OutOfMemoryError: PermGen space"。我厌倦了将 PermGen 内存增加到 700MB,但没有成功。所以我怀疑 hotswap-agent 正在监视我的 EAR 中的所有 类,包括导致它消耗过多内存的 lib 目录中的那些。
我研究的下一个地方是通过在 hotswap-agent.properties 中设置 autoHotswap=false 来默认禁用热交换。我尝试将此文件放在 EAR 中(如上所示)以及 EJB 和 WAR 类路径,但没有任何区别。我也试过,但没有用,像这样添加到 JVM_OPTS:
-javaagent:/workspace/tools/hotswap-agent-1.0.jar=disablePlugin=Deltaspike,disablePlugin=JavaBeans,autoHotswap=false"
所以我的问题是,如何控制我环境中的热交换代理?也有没有办法只在指定的包中观看 类,比如 "com.foobar"?最后,为 jboss.
上的 ear 部署配置 hotswap-agent 的正确方法是什么?
在 Vladimir in the hotswap-agent forum 的帮助下,终于让 hotswap-agent 在我的项目中工作了。他所说的这有助于解决失控的 PermGen 内存问题:
JBossAS has single classLoader for each module like jar, war etc. On
that account there can be a lot of module classloaders in the running
JbossAS. Alongside HotswapAgent copies it's classes to each of that
module classloaders (it is necessary otherwise HotswapAgent doesn't
work inside module classloader). Hence the same HotswapAgent's class
can be loaded by JVM multiple times ! As far as the copying of globaly
disabled plugin, it is bug, we should fix it. You can just remove
unused plugins directly from hotswap-agent.jar as a workaround, it
should help with performance.
一旦我从 jar 中删除了不需要的插件,我就可以在合理的时间和 PermGen 内存中启动 jboss。
我有一个要部署到 Jboss EAP 6.1 的 EAR 项目。我的 Maven 构建的产品如下所示:
myapp-ear
├── myapp-ejb.jar
├── myapp-web.war
├── lib
│ ├── activation.jar
│ ├── activiti-bpmn-converter.jar
│ ├── activiti-bpmn-model.jar
.....
│ ├── xml-apis.jar
│ └── xmlbeans.jar
└── META-INF
├── application.xml
├── hotswap-agent.properties
├── myapp-ds.xml
├── jboss-deployment-structure.xml
└── MANIFEST.MF
这是我在部署我的应用程序时在 jboss 日志中得到的内容:
21:34:55,570 INFO [stdout] (MSC service thread 1-5) HOTSWAP AGENT: 21:34:55.569 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.jbossmodules.JBossModulesPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ds.xml:main" from Service Module Loader'.
21:35:04,357 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "null" (runtime-name: "myapp-web.war")
21:35:04,357 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "null" (runtime-name: "myapp-ejb.jar")
21:35:04,781 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for myproject
21:35:05,306 INFO [stdout] (MSC service thread 1-7) HOTSWAP AGENT: 21:35:05.306 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.jbossmodules.JBossModulesPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ear.ear:main" from Service Module Loader'.
和
21:35:05,488 INFO [stdout] (MSC service thread 1-6) HOTSWAP AGENT: 21:35:05.487 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ear.ear.myapp-web.war:main" from Service Module Loader'.
21:35:05,520 INFO [stdout] (MSC service thread 1-4) HOTSWAP AGENT: 21:35:05.517 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.jbossmodules.JBossModulesPlugin' initialized in ClassLoader 'ModuleClassLoader for Module "deployment.myapp-ear.ear.myapp-ejb.jar:main" from Service Module Loader'.
问题是,当我将耳朵部署到 jboss 时,它花费的时间大约是正常时间的 10 倍,而当我尝试从浏览器访问该应用程序时,它会抛出一个 "PermGen space: java.lang.OutOfMemoryError: PermGen space"。我厌倦了将 PermGen 内存增加到 700MB,但没有成功。所以我怀疑 hotswap-agent 正在监视我的 EAR 中的所有 类,包括导致它消耗过多内存的 lib 目录中的那些。
我研究的下一个地方是通过在 hotswap-agent.properties 中设置 autoHotswap=false 来默认禁用热交换。我尝试将此文件放在 EAR 中(如上所示)以及 EJB 和 WAR 类路径,但没有任何区别。我也试过,但没有用,像这样添加到 JVM_OPTS:
-javaagent:/workspace/tools/hotswap-agent-1.0.jar=disablePlugin=Deltaspike,disablePlugin=JavaBeans,autoHotswap=false"
所以我的问题是,如何控制我环境中的热交换代理?也有没有办法只在指定的包中观看 类,比如 "com.foobar"?最后,为 jboss.
上的 ear 部署配置 hotswap-agent 的正确方法是什么?在 Vladimir in the hotswap-agent forum 的帮助下,终于让 hotswap-agent 在我的项目中工作了。他所说的这有助于解决失控的 PermGen 内存问题:
JBossAS has single classLoader for each module like jar, war etc. On that account there can be a lot of module classloaders in the running JbossAS. Alongside HotswapAgent copies it's classes to each of that module classloaders (it is necessary otherwise HotswapAgent doesn't work inside module classloader). Hence the same HotswapAgent's class can be loaded by JVM multiple times ! As far as the copying of globaly disabled plugin, it is bug, we should fix it. You can just remove unused plugins directly from hotswap-agent.jar as a workaround, it should help with performance.
一旦我从 jar 中删除了不需要的插件,我就可以在合理的时间和 PermGen 内存中启动 jboss。