2017-04-08 3 views
4

J'ai un projet EAR que je déploie sur JBoss EAP 6.1. Le produit de mon build Maven ressemble à ceci:Hotswap-agent sur JBoss EAP 6.1 - java.lang.OutOfMemoryError: espace PermGen

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 

Voici ce que je reçois dans le journal jboss quand quand je déploie mon application:

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

et

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

Le problème est que quand je déploie mon oreille dans jboss cela prend environ 10 fois son temps normal et quand j'essaie d'accéder à l'application à partir d'un navigateur, il lance un "PermGen space: java.lang.OutOfMemoryError: PermGen space". J'ai fatigué d'augmenter ma mémoire PermGen à 700 Mo mais pas de chance. J'ai donc suspecté que hotswap-agent surveille toutes les classes de mon fichier EAR, y compris celles du répertoire lib, ce qui provoque une trop grande consommation de mémoire. L'endroit suivant que j'ai regardé est la désactivation de hotswap par défaut, en plaçant autoHotswap = false dans hotswap-agent.properties. J'ai essayé de placer ce fichier dans le fichier EAR comme indiqué ci-dessus et les classpaths EJB et WAR, mais cela ne faisait aucune différence. J'ai aussi essayé, en vain, en ajoutant aux JVM_OPTS comme ceci:

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

Ma question est, comment peut-on contrôler le hotswap-agent dans mon environnement? Existe-t-il également un moyen de ne regarder que les classes dans un paquet spécifié, par exemple "com.foobar"? Enfin, quelle est la bonne façon de configurer hotswap-agent pour un déploiement d'oreille sur jboss.

Répondre

3

Enfin obtenu hotswap-agent travaillant dans mon projet avec l'aide de Vladimir dans le hotswap-agent forum. Ce qui a dit ce qu'il a aidé à résoudre la mémoire PermGen emballement:

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.

Une fois que je l'ai enlevé les plugins inutiles du pot que je pourrais commencer jboss dans un délai raisonnable et de la mémoire PermGen.