cashlalala / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

JBoss AS 7 and JavaMelody problems #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Deploy JavaMelody in JBoss AS 7 WAR
2. java.lang.NoClassDefFoundError: com/sun/management/OperatingSystemMXBean
3. After fixing this, 100% CPU load over 20 seconds calling the dashboard, but 
rendered result is OK

What is the expected output? What do you see instead?
I expect the dashboard without bugs ;)

09:31:51,006 WARNUNG [net.bull.javamelody] (MSC service thread 1-2) exception 
while collecting data: java.lang.NoClassDefFoundError: 
com/sun/management/OperatingSystemMXBean
    at net.bull.javamelody.MemoryInformations.<init>(MemoryInformations.java:75) [javamelody-core-1.30.0.jar:]
    at net.bull.javamelody.JavaInformations.<init>(JavaInformations.java:137) [javamelody-core-1.30.0.jar:]
    at net.bull.javamelody.Collector.collectLocalContextWithoutErrors(Collector.java:230) [javamelody-core-1.30.0.jar:]
    at net.bull.javamelody.FilterContext.initCollect(FilterContext.java:221) [javamelody-core-1.30.0.jar:]
    at net.bull.javamelody.FilterContext.<init>(FilterContext.java:94) [javamelody-core-1.30.0.jar:]
    at net.bull.javamelody.MonitoringFilter.init(MonitoringFilter.java:70) [javamelody-core-1.30.0.jar:]

You can fix this exception with:
Add com/sun/management to jboss-as-7\modules\sun\jdk\main\modules.xml:
...
    <dependencies>
        <module name="system" export="false" services="import">
            <exports>
                <include-set>
                    <path name="com/sun/management"/>
                    <path name="com/sun/script/javascript"/>
...

Than JavaMelody runs fine, but I have 100% CPU load for 20 seconds if i call 
the dashboard.

What version of the product are you using? On what application server, JDK,
operating system?

JBoss AS 7, JDK 1.6.0_26, Windows 7 Enterprise 64 bit

Please provide any additional information below.

Original issue reported on code.google.com by andrePan...@gmail.com on 10 Aug 2011 at 7:42

GoogleCodeExporter commented 9 years ago
sry...the CPU problems are not from JavaMelody, they are from PrettyFaces 3.2.0.
This adds 600ms CPU time to each single request. So --- closed.

May be you could at least add some doc entry concerning the 
com/sun/management/OperatingSystemMXBean in the new OSGi env.

Original comment by andrePan...@gmail.com on 10 Aug 2011 at 1:15

GoogleCodeExporter commented 9 years ago
I have added a chapter on JBoss AS 7 in the wiki:
http://code.google.com/p/javamelody/wiki/UserGuideAdvanced#Usage_of_in_JBoss_AS_
7_%28which_uses_OSGI%29
with a link at the end of the user guide:
http://code.google.com/p/javamelody/wiki/UserGuide#Advanced_documentation_%28set
up_with_an_ear,_centralized_collect_s

Thanks for the tip.

Original comment by evernat@free.fr on 13 Aug 2011 at 9:23

GoogleCodeExporter commented 9 years ago
Hi,

I am trying to do javamelody run on an application in JBoss 7.1.0, I got the 
error below, from what I saw he tries to get the property maxThreads HTTP 
connector only on JBoss 7 this property does not exist, this version is the 
equivalent property max-connections.
This error occurs because the property maxThreads no longer exists or is 
related to some configuration error?

18:52:44,973 ERROR 
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/Sicop].[def
ault]] (http--127.0.0.1-8080-1) Servlet.service() for servlet default threw 
exception: java.lang.IllegalStateException: 
javax.management.AttributeNotFoundException: No attribute called maxThreads
    at net.bull.javamelody.TomcatInformations.buildTomcatInformationsList(TomcatInformations.java:120) [javamelody-1.35.0.jar:]
    at net.bull.javamelody.JavaInformations.<init>(JavaInformations.java:138) [javamelody-1.35.0.jar:]
    at net.bull.javamelody.MonitoringFilter.doMonitoring(MonitoringFilter.java:317) [javamelody-1.35.0.jar:]
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:150) [javamelody-1.35.0.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: javax.management.AttributeNotFoundException: No attribute called 
maxThreads
    at org.jboss.as.jsr77.managedobject.BaseHandler.getAttribute(BaseHandler.java:57)
    at org.jboss.as.jsr77.managedobject.J2EEDomainHandler.getAttribute(J2EEDomainHandler.java:63)
    at org.jboss.as.jsr77.managedobject.ManagedObjectHandlerRegistry.getAttribute(ManagedObjectHandlerRegistry.java:89)
    at org.jboss.as.jsr77.subsystem.JSR77ManagementMBeanServer.getAttribute(JSR77ManagementMBeanServer.java:126)
    at org.jboss.as.jmx.PluggableMBeanServerImpl.getAttribute(PluggableMBeanServerImpl.java:151)
    at net.bull.javamelody.MBeans.getAttribute(MBeans.java:69) [javamelody-1.35.0.jar:]
    at net.bull.javamelody.TomcatInformations.<init>(TomcatInformations.java:68) [javamelody-1.35.0.jar:]
    at net.bull.javamelody.TomcatInformations.buildTomcatInformationsList(TomcatInformations.java:111) [javamelody-1.35.0.jar:]
    ... 17 more

Thanks

Original comment by ju...@3layer.com.br on 9 Mar 2012 at 10:00

GoogleCodeExporter commented 9 years ago
first off- could you please see if my modules.xml is ok?

<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2010, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<module xmlns="urn:jboss:module:1.1" name="sun.jdk">
    <resources>
        <!-- currently jboss modules has not way of importing services from
        classes.jar so we duplicate them here -->
        <resource-root path="service-loader-resources"/>
    </resources>
    <dependencies>
        <system export="true">
            <paths>
                <path name="com/sun/script/javascript"/>
                <path name="com/sun/jndi/dns"/>
                <path name="com/sun/jndi/ldap"/>
                <path name="com/sun/jndi/url"/>
                <path name="com/sun/jndi/url/dns"/>
                <path name="com/sun/security/auth"/>
                <path name="com/sun/security/auth/login"/>
                <path name="com/sun/security/auth/module"/>
                <path name="sun/misc"/>
                <path name="sun/io"/>
                <path name="sun/nio"/>
                <path name="sun/nio/ch"/>
                <path name="sun/security"/>
                <path name="sun/security/krb5"/>
                <path name="sun/util"/>
                <path name="sun/util/calendar"/>
                <path name="sun/util/locale"/>
                <path name="sun/security/provider"/>
                <path name="META-INF/services"/>
                <path name="com/sun/management"/>
            </paths>
            <exports>
                <include-set>
                    <path name="META-INF/services"/>
                </include-set>
            </exports>
        </system>
    </dependencies>
</module>

I couldnt run JBOSS with your example, so I just added com.sun.management 
inside of existing set.

No I got javax.management.AttributeNotFoundException: No attribute called 
maxThreads like a previous user.
Seems that there is a miscompatibility between JBOSS 7.1.1 final and JavaMelody

Original comment by sapo...@gmail.com on 14 May 2012 at 12:52

GoogleCodeExporter commented 9 years ago
Runs for us since AS 7.0.0, currently AS 7.1.2 with melody 1.37.0.

works without problems.

our modules:

<module xmlns="urn:jboss:module:1.1" name="sun.jdk">
    <resources>
        <!-- currently jboss modules has not way of importing services from
        classes.jar so we duplicate them here -->
        <resource-root path="service-loader-resources"/>
    </resources>
    <dependencies>
        <system export="true">
            <paths>
                <path name="com/sun/management"/>
                <path name="com/sun/script/javascript"/>
                <path name="com/sun/jndi/dns"/>
                <path name="com/sun/jndi/ldap"/>
                <path name="com/sun/jndi/url"/>
                <path name="com/sun/jndi/url/dns"/>
                <path name="com/sun/security/auth"/>
                <path name="com/sun/security/auth/login"/>
                <path name="com/sun/security/auth/module"/>
                <path name="sun/misc"/>
                <path name="sun/io"/>
                <path name="sun/nio"/>
                <path name="sun/nio/ch"/>
                <path name="sun/security"/>
                <path name="sun/security/krb5"/>
                <path name="sun/util"/>
                <path name="sun/util/calendar"/>
                <path name="sun/util/locale"/>
                <path name="sun/security/provider"/>
                <path name="META-INF/services"/>
            </paths>
            <exports>
                <include-set>
                    <path name="META-INF/services"/>
                </include-set>
            </exports>
        </system>
    </dependencies>
</module>

Original comment by andrePan...@gmail.com on 14 May 2012 at 1:01

GoogleCodeExporter commented 9 years ago
Hi,
For "AttributeNotFoundException: No attribute called maxThreads", the follow up 
will be in the issue 220

Original comment by evernat@free.fr on 25 May 2012 at 11:36