简体   繁体   English

JBoss EAP 6.1上的Hotswap-agent - java.lang.OutOfMemoryError:PermGen space

[英]Hotswap-agent on JBoss EAP 6.1 - java.lang.OutOfMemoryError: PermGen space

I have an EAR project I'm deploying to Jboss EAP 6.1. 我有一个EAR项目,我正在部署到Jboss EAP 6.1。 The product of my maven build looks like this: 我的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

Here's what I get in the jboss log when when I deploy my app: 以下是我在部署应用程序时在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'.

and

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'.

The problem is that when I deploy my ear into jboss it takes about 10 times it's normal time and when I try to access the application from a browser it throws a "PermGen space: java.lang.OutOfMemoryError: PermGen space". 问题是,当我将我的耳朵部署到jboss时,它需要大约10倍的正常时间,当我尝试从浏览器访问应用程序时,它会抛出“PermGen space:java.lang.OutOfMemoryError:PermGen space”。 I tired increasing my PermGen memory to 700MB but no luck. 我厌倦了将我的PermGen内存增加到700MB,但没有运气。 So I suspected that hotswap-agent is watching all the classes in my EAR including the ones in the lib directory which's causing it to consume too much memory. 所以我怀疑hotswap-agent正在观察我的EAR中的所有类,包括lib目录中的那些导致它消耗太多内存的类。

The next place I looked into is disabling hotswap by default, by placing autoHotswap=false in hotswap-agent.properties. 我调查的下一个地方是默认情况下禁用hotswap,方法是在hotswap-agent.properties中放置autoHotswap = false。 I tried placing this file in the EAR as shown above and the EJB and WAR classpaths but it didn't make any difference. 我尝试将此文件放在EAR中,如上所示,以及EJB和WAR类路径,但它没有任何区别。 I also tried, to no avail, adding to the JVM_OPTS like so: 我也试过,无法添加到JVM_OPTS中,如下所示:

-javaagent:/workspace/tools/hotswap-agent-1.0.jar=disablePlugin=Deltaspike,disablePlugin=JavaBeans,autoHotswap=false"

So my question is, how does one control the hotswap-agent in my environment? 所以我的问题是,如何在我的环境中控制hotswap-agent? Also is there a way to only watch classes in a specified package, say "com.foobar"? 还有一种方法只能观察指定包中的类,比如“com.foobar”吗? Finally, what's the right way to configure hotswap-agent for an ear deployment on jboss. 最后,为jboss上的ear部署配置hotswap-agent的正确方法是什么。

Finally got hotswap-agent working in my project with the help of Vladimir in the hotswap-agent forum . 最后,在hotswap-agent论坛上 ,在Vladimir的帮助下,我的项目得到了hotswap-agent This what he said that helped solve the runaway PermGen memory: 他说这有助于解决失控的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. JBossAS为jar,war等每个模块都有单个classLoader。在该帐户中,运行JbossAS中可能有很多模块类加载器。 Alongside HotswapAgent copies it's classes to each of that module classloaders (it is necessary otherwise HotswapAgent doesn't work inside module classloader). 与HotswapAgent一起将它的类复制到每个模块类加载器(否则HotswapAgent在模块类加载器中不起作用)。 Hence the same HotswapAgent's class can be loaded by JVM multiple times ! 因此,JVM可以多次加载相同的HotswapAgent类! As far as the copying of globaly disabled plugin, it is bug, we should fix it. 至于复制globaly disabled插件,它是bug,我们应该修复它。 You can just remove unused plugins directly from hotswap-agent.jar as a workaround, it should help with performance. 您可以直接从hotswap-agent.jar中删除未使用的插件作为解决方法,它应该有助于提高性能。

Once I removed the unneeded plugins from the jar I could start jboss within reasonable time and PermGen memory. 一旦我从jar中删除了不需要的插件,我就可以在合理的时间内启动jboss和PermGen内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 常量java.lang.OutOfMemoryError:PermGen空间Arquillian + Wildfly 8.1 - Constant java.lang.OutOfMemoryError: PermGen space Arquillian + Wildfly 8.1 在PowerMockito中运行Cobertura并抛出java.lang.OutOfMemoryError:PermGen空间 - Running Cobertura with PowerMockito throwing java.lang.OutOfMemoryError: PermGen space 不断获取java.lang.OutOfMemoryError:PermGen空间错误 - Keep getting java.lang.OutOfMemoryError: PermGen space error java.lang.OutOfMemoryError:与Jenkins和Maven的PermGen - java.lang.OutOfMemoryError: PermGen with Jenkins and Maven Maven“线程中的异常”http-bio-8080-exec-32“java.lang.OutOfMemoryError:PermGen space” - Maven “Exception in thread ”http-bio-8080-exec-32“ java.lang.OutOfMemoryError: PermGen space” java.lang.OutOfMemoryError:PermGen(GWT + NetBeans + Maven) - java.lang.OutOfMemoryError: PermGen (GWT + NetBeans + Maven) 在 Eclipse 上构建 Maven:java.lang.OutOfMemoryError:Java 堆空间 - Maven build on Eclipse: java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError:Maven 中的 Java 堆空间 - java.lang.OutOfMemoryError: Java heap space in Maven 获取java.lang.OutOfMemoryError:编译AspectJ项目时出现Java堆空间错误 - Get java.lang.OutOfMemoryError: Java heap space error when compiling aspectJ project 编译悬带时出现java.lang.OutOfMemoryError - java.lang.OutOfMemoryError while compiling sling
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM