我有一个要部署到JBossEAP6.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内存增加到700 my,但没有运气。因此,我怀疑hotswap代理正在监视我耳中的所有类,包括lib目录中的类,这导致它消耗了太多的内存。
接下来我要研究的是在默认情况下禁用hotswap,将autoHotswap=false放在hotswap-agent.properties中。我试着将这个文件放在EAR中,如上面所示,EJB和WAR类路径,但是没有任何区别。我也尝试过这样添加JVM_OPTS,但没有结果:
-javaagent:/workspace/tools/hotswap-agent-1.0.jar=disablePlugin=Deltaspike,disablePlugin=JavaBeans,autoHotswap=false"
所以我的问题是,如何在我的环境中控制热浪剂?另外,是否有一种方法只监视指定包中的类,比如"com.foobar"?最后,为jboss上的ear部署配置hotswap代理的正确方法是什么。
发布于 2017-04-14 13:36:06
最后,在弗拉基米尔在代理人论坛中的帮助下,我的项目得到了hotswap代理的帮助。他说的这些话帮助解决了失控的PermGen内存:
JbossAS对每个模块都有单独的classLoader,如jar、war等。在运行的JBossAS中可以有很多模块类加载器。除了HotswapAgent之外,它还将其类复制到每个模块类加载器中(这是必要的,否则HotswapAgent在模块类加载器中就无法工作)。因此,JVM可以多次加载同一个HotswapAgent的类!至于全球禁用插件的复制,它是错误,我们应该修复它。您可以直接从hotswap-agent.jar中删除未使用的插件,作为解决办法,它应该有助于性能。
一旦我从jar中删除了不需要的插件,我就可以在合理的时间和PermGen内存内启动jboss。
https://stackoverflow.com/questions/43289324
复制相似问题