Quantcast

[JIRA] (JENKINS-15529) NoClassDefFoundError: com/sun/management/OperatingSystemMXBean

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15529) NoClassDefFoundError: com/sun/management/OperatingSystemMXBean

JIRA noreply@jenkins-ci.org
Issue Type: Bug Bug
Assignee: Unassigned
Components: monitoring
Created: 15/Oct/12 3:26 PM
Description:

A user of the Monitoring plugin reports seeing a repeated exception in the log:

java.lang.NoClassDefFoundError: com/sun/management/OperatingSystemMXBean
        at net.bull.javamelody.MemoryInformations.<init>(MemoryInformations.java:75) [javamelody-core-1.36.0.jar:1.36.0]
        at net.bull.javamelody.JavaInformations.<init>(JavaInformations.java:137) [javamelody-core-1.36.0.jar:1.36.0]
        at net.bull.javamelody.RemoteCallHelper$1.call(RemoteCallHelper.java:44) [:1.36.0]
        at net.bull.javamelody.RemoteCallHelper$1.call(RemoteCallHelper.java:36) [:1.36.0]
        at net.bull.javamelody.RemoteCallHelper$DelegatingTask.call(RemoteCallHelper.java:129) [:1.36.0]
        at hudson.remoting.LocalChannel$1.call(LocalChannel.java:52) [remoting-2.11.jar:]

Seems that operatingSystem was a com.sun.management.UnixOperatingSystem yet the JavaMelody code is not permitted to directly refer to com.sun.management.OperatingSystemMXBean.

Indeed making static reference to classes outside of the packages defined by the JRE is not safe; it will definitely fail for example in a default OSGi environment, and Java vendors are free to restrict access to such packages. Such code must be written defensively by using reflection and recovering gracefully from any errors.

By the way the isSunOsMBean checks for a class named com.sun.management.OperatingSystem but none such exists that I can see; was com.sun.management.OperatingSystemImpl meant?

Would be better to use reflection to try loading com.sun.management.OperatingSystemMXBean from the same class loader as operatingSystem, check if the bean is assignable to this interface, and if so look up methods such as getProcessCpuTime on that interface and call them on the bean. (Alternately, do all this with static classes but in a separate method wrapped in a try-block catching LinkageError.) Then there is no need to hardcode the implementation class names, which is even less stable than the com.sun.management package as a whole.

Environment: (JVM vendor still TBD)
Project: Jenkins
Labels: exception jdk
Priority: Major Major
Reporter: Jesse Glick
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15529) NoClassDefFoundError: com/sun/management/OperatingSystemMXBean

JIRA noreply@jenkins-ci.org
evernat commented on Bug JENKINS-15529

For reference, usage with OSGI (JBoss AS 7, Jonas 5...) is documented here and needs manual configuration:
http://code.google.com/p/javamelody/wiki/UserGuideAdvanced#Usage_of_in_JBoss_AS_7_%28which_uses_OSGI%29

com.sun.management.OperatingSystem exists in general in the Sun/Oracle JDK.
For example: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/com/sun/management/OperatingSystem.java

It can help to know the server info, the JVM vendor and the JVM version.
And the cause seems to be in a slave?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15529) NoClassDefFoundError: com/sun/management/OperatingSystemMXBean

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Jesse Glick commented on Bug JENKINS-15529

I see, OperatingSystem is the Windows implementation.

I do not yet know the identity of the JVM in this case; reporting on behalf of another user. That would certainly be necessary for testing, though a fix can be proposed without that.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15529) NoClassDefFoundError: com/sun/management/OperatingSystemMXBean

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
evernat resolved Bug JENKINS-15529 as Fixed

There is the same or similar issue for JBoss AS 7, when modules configuration is not changed, here:
https://code.google.com/p/javamelody/issues/detail?id=289

The JBoss AS 7 issue, and probably this one, will be fixed in the next release (1.44) of javamelody and of the monitoring plugin.
Reflection on methods of com/sun/management/OperatingSystemMXBean was used for the ugly fix.

Change By: evernat (02/Mar/13 6:55 PM)
Status: Open Resolved
Resolution: Fixed
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15529) NoClassDefFoundError: com/sun/management/OperatingSystemMXBean

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Change By: evernat (02/Mar/13 6:55 PM)
Assignee: evernat
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Loading...