eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
386 stars 144 forks source link

ManagementFactory.getPlatformMBeanServer causes ClassNotFoundException #1409

Closed glassfishrobot closed 17 years ago

glassfishrobot commented 18 years ago

I'm developing YourKit Java Profiler integration with GlassFish. When starting server (e.g. from NetBeans 5.5 bundle) with yourkit agent there is a call 'ManagementFactory.getPlatformMBeanServer()' and following exception occurs:

Could not load Logmanager "com.sun.enterprise.server.logging.ServerLogManager" java.lang.ClassNotFoundException: com.sun.enterprise.server.logging.ServerLogManager at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.util.logging.LogManager$1.run(LogManager.java:166) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.(LogManager.java:156) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at com.sun.jmx.trace.Trace.initDestination(Trace.java:46) at com.sun.jmx.trace.Trace.(Trace.java:25) at javax.management.MBeanServerFactory.debug(MBeanServerFactory.java:543) at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:502) at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:530) at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:304) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:219) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:180) at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:264) at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:512) at com.yourkit.runtime.OOMEDumper.setValue(OOMEDumper.java:72) at com.yourkit.runtime.OOMEDumper.enable(OOMEDumper.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.yourkit.runtime.Core.enableOOMEDumper(Core.java:969) at com.yourkit.runtime.Core.init(Core.java:363)

Environment

Operating System: All Platform: All

Affected Versions

[9.1pe]

glassfishrobot commented 6 years ago
glassfishrobot commented 18 years ago

@glassfishrobot Commented vitaly_pimenov said: to reproduce this stack trace please use latest YourKit Java Profiler EAP build: http://www.yourkit.com/eap

Please contact me if some additional info will be neccessary.

glassfishrobot commented 18 years ago

@glassfishrobot Commented km105526 said: Can you please tell me when you started seeing this?

Can you try the same thing on a prior build, if you have time? I know there was a change in this area recently and want to find out if this is related to it.

Also, where can I read/know about the YourKit Profiler?

Assigning to Lloyd for he now knows everything about it

glassfishrobot commented 18 years ago

@glassfishrobot Commented vitaly_pimenov said: I've reproduced this with GlassFish V2 M1(build 19). On old GlassFish b42 there is no such problems.

To see the problem you should first install YourKit Java Profiler EAP (latest build can be found at http://www.yourkit.com/eap )

If you have NetBeans 5.5 release installed and intergated with GlassFish - then simply use "Tools | Integrate with IDE..." action in profiler UI - then start NetBeans , open any web project running on GlassFish (even with default sample project TomcatJSPExample) and start profiling (corresponding action can be found in main menu, toolbar, or context menu) - then take a look in server log - there you will see stack trace.

Without NetBeans - use "Tools | Integrate with J2EE Server..." action in profiler UI - choose GlassFish and after integration start it in common way.

To learn more see help inside profiler.

Regards, Vitaly Pimenov, YourKit LLC.

glassfishrobot commented 18 years ago

@glassfishrobot Commented vitaly_pimenov said: cc added

glassfishrobot commented 18 years ago

@glassfishrobot Commented llc said: This might not be related to my recent changes because none of our Interceptor code is involved (none shows in the exception call stack, and none of it is called, as determined by instrumenting the SunoneInterceptor, AppServerMBeanServerBuilder, etc).

Although this problem occurs, the rest of the server continues to start, and an MBeanServer is created normally, and many MBeans are registered. I don't understand how a profiler works, but it clearly is doing its thing very early--so early that our -D

I think it's quite bad that the profiler seems is creating an MBeanServer extremely early; I don't know how it could work before without issues; lots of our code assumes that the first MBeanServer is SunoneInterceptor, and the reported call stack appears to violate the assumption.

Below is shown the call stack for a successful initialization of the MBeanServer (which occurs in spite of the exception in the log).

java.lang.Exception: "AppServerMBeanServerBuilder.AppServerMBeanServerBuilder(): call stack" com.sun.enterprise.admin.server.core.jmx.MBeanServerDebug.dumpStack(MBeanServerDebug.java:88) com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder. (AppServerMBeanServerBuilder.java:66) com.sun.enterprise.ee.admin.AppServerMBeanServerBuilder.(AppServerMBeanServerBuilder.java: 31) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java: 27) java.lang.reflect.Constructor.newInstance(Constructor.java:494) java.lang.Class.newInstance0(Class.java:350) java.lang.Class.newInstance(Class.java:303) javax.management.MBeanServerFactory.newBuilder(MBeanServerFactory.java:456) javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:494) javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:530) javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:304) javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:219) javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:180) sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:264) java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:512) com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerFactory.getAppServerMBeanServer (AppServerMBeanServerFactory.java:69) com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerFactory.getMBeanServerInstance (AppServerMBeanServerFactory.java:49) com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.getMBeanServerInstance (SunoneInterceptor.java:182) com.sun.enterprise.admin.server.core.AdminService.init(AdminService.java:277) com.sun.enterprise.admin.server.core.AdminServiceLifeCycle.onInitialization (AdminServiceLifeCycle.java:103) com.sun.enterprise.server.ApplicationServer.onInitialization(ApplicationServer.java:238) com.sun.enterprise.server.ondemand.OnDemandServer.onInitialization(OnDemandServer.java:93) com.sun.enterprise.server.PEMain.run(PEMain.java:326) com.sun.enterprise.server.PEMain.main(PEMain.java:269) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) com.sun.enterprise.server.PELaunch.main(PELaunch.java:272)

glassfishrobot commented 18 years ago

@glassfishrobot Commented llc said: It appears to me that there might be a bug with the profiler; the following jvm option is apparently not set when getPlatformMBeanServer() is called (our AppServerMBeanServerBuilder does not get called):

- Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerMBeanServerBuilder
glassfishrobot commented 18 years ago

@glassfishrobot Commented vitaly_pimenov said: Thanks for reply. I see the problem. We call getPlatformMBeanServer() inside the JVM callback VmInit (see http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#VMInit) We do not have another guaranteed by JVM safe way to do our initialization. Further more, specification do not state anything about the best time to call getPlatformMBeanServer(), and we can't know whether SunoneInterceptor was already created. I don't think the problem is caused by missing vm argument - we use the complete set of jvm options declared in domain.xml. Looking inside this file I've found jvm option -Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder the same option exists in corresponding domain.xml files of SJSAS 8.x. At the moment GlassFish is the only application that has such kind of problem - all other applications successfully deal with getPlatformMBeanServer() We hope you can find a way MBeanServer can be created for our case.

Best regards, Vitaly Pimenov, YourKit LLC.

glassfishrobot commented 18 years ago

@glassfishrobot Commented llc said: What puzzles me is that if - Djavax.management.builder.initial=com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuild er were being used, then AppServerMBeanServerBuilder should be on the call stack--and it's not.

Maybe it too is inaccessible for some reason?

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: I have uncommited code which resolves this issue. It involves reengineering the SunoneInterceptor, and loading the MBeanServer and interceptor at startup (or before).

glassfishrobot commented 17 years ago

@glassfishrobot Commented gfbugbridge said:

glassfishrobot commented 17 years ago

@glassfishrobot Commented ehucka said: The exception is thrown together with an java error after attach to glassfish profiled by netbeans profiler m6. It is serious stopper for the profiler. glassfish V1 UR1 P01 Build 02, jdk 1.5.0_11

Error log:

Could not load Logmanager "com.sun.enterprise.server.logging.ServerLogManager" java.lang.ClassNotFoundException: com.sun.enterprise.server.logging.ServerLogManager at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.util.logging.LogManager$1.run(LogManager.java:166) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.(LogManager.java:156) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at com.sun.jmx.trace.Trace.initDestination(Trace.java:46) at com.sun.jmx.trace.Trace.(Trace.java:25) at javax.management.MBeanServerFactory.debug(MBeanServerFactory.java:543) at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:502) at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:530)#

  1. An unexpected error has been detected by HotSpot Virtual Machine: #
  2. Internal Error (455843455054494F4E530E4350500112), pid=4244, tid=4240 #
  3. Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)

at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:304) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:219) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:180) at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:264) at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:512) at com.sun.tools.profiler.server.system.HeapDump.initialize(HeapDump.java:33) at com.sun.tools.profiler.server.ProfilerInterface.initProfilerInterface(ProfilerInterface.java:98) at com.sun.tools.profiler.server.ProfilerServer.initSupportingFunctionality(ProfilerServer.java:189) at com.sun.tools.profiler.server.ProfilerServer.doActivate(ProfilerServer.java:414) at com.sun.tools.profiler.server.ProfilerServer.activate(ProfilerServer.java:365)

  1. An error report file with more information is saved as hs_err_pid4244.log #
  2. If you would like to submit a bug report, please visit:
  3. http://java.sun.com/webapps/bugreport/crash.jsp # Profiler Agent: Initializing...
glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: I expect to commit a fix for this today. It's not specifically for this bug, but I believe it will fix it.

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: Many files, messy commit. 19:45 PST Jan 11, 2006.

Quicklook EE passes (many times) over past week.

AMX unit tests as good or better than before.

glassfishrobot commented 17 years ago

@glassfishrobot Commented fhanik said: Created an attachment (id=783) Domain file that still doesnt work, build 37

glassfishrobot commented 17 years ago

@glassfishrobot Commented vitaly_pimenov said: This bug is not fixed. It is reopened as https://glassfish.dev.java.net/issues/show_bug.cgi?id=2549

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said:

glassfishrobot commented 17 years ago

@glassfishrobot Commented vitaly_pimenov said: Can you inform me when the fix is available in new builds? We are looking forward to test it.

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: Vitaly, no I can't say I'll do so. Add your email to the bug so you can be notified of changes.

glassfishrobot commented 17 years ago

@glassfishrobot Commented gfbugbridge said:

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: Fix in progress....testing.

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: Fix has been sitting around for review for 2 weeks now, with multiple reminders. It has passed QL EE as follows:

Windows: 2 different developers/machines Solaris 10: multiple times Mac OS X: 2 different machines, multiple times

glassfishrobot commented 17 years ago

@glassfishrobot Commented llc said: After 15 days of waiting for code review, and multiple reminders/requests which resulted in no action, including cc'ing of manager multiple times, nothing has been done.

Checking in admin/mbeanapi-impl/src/java/com/sun/enterprise/management/support/ LoaderRegThread.java; /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/enterprise/management/support/ LoaderRegThread.java,v <-- LoaderRegThread.java new revision: 1.8; previous revision: 1.7 done Checking in admin/mbeanapi-impl/src/java/com/sun/enterprise/management/support/ LoaderBase.java; /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/enterprise/management/support/ LoaderBase.java,v <-- LoaderBase.java new revision: 1.9; previous revision: 1.8 done Checking in admin-core/admin/src/java/com/sun/enterprise/admin/meta/MBeanRegistry.java; /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/admin/meta/MBeanRegistry.java,v <-- MBeanRegistry.java new revision: 1.12; previous revision: 1.11 done Checking in admin-core/admin/src/java/com/sun/enterprise/interceptor/ DynamicInterceptorHook.java; /cvs/glassfish/admin-core/admin/src/java/com/sun/enterprise/interceptor/ DynamicInterceptorHook.java,v <-- DynamicInterceptorHook.java new revision: 1.2; previous revision: 1.1 done Checking in admin-ee/admin/src/java/com/sun/enterprise/ee/admin/ AppServerMBeanServerBuilder.java; /cvs/glassfish/admin-ee/admin/src/java/com/sun/enterprise/ee/admin/ AppServerMBeanServerBuilder.java,v <-- AppServerMBeanServerBuilder.java new revision: 1.4; previous revision: 1.3 done Checking in admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/NodeAgentMain.java; /cvs/glassfish/admin-ee/nodeagent/src/java/com/sun/enterprise/ee/nodeagent/ NodeAgentMain.java,v <-- NodeAgentMain.java new revision: 1.7; previous revision: 1.6 done Checking in appserv-addons/impl/src/java/com/sun/enterprise/addons/AddonController.java; /cvs/glassfish/appserv-addons/impl/src/java/com/sun/enterprise/addons/AddonController.java,v <-- AddonController.java new revision: 1.5; previous revision: 1.4 done Checking in appserv-commons/src/java/com/sun/enterprise/util/FeatureAvailability.java; /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/util/FeatureAvailability.java,v <-- FeatureAvailability.java new revision: 1.8; previous revision: 1.7 done Checking in appserv-core/src/java/com/sun/enterprise/admin/common/MBeanServerFactory.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/admin/common/MBeanServerFactory.java,v <-- MBeanServerFactory.java new revision: 1.7; previous revision: 1.6 done Checking in appserv-core/src/java/com/sun/enterprise/admin/server/core/AdminService.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/admin/server/core/AdminService.java,v <-- AdminService.java new revision: 1.25; previous revision: 1.24 done Checking in appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ AppServerMBeanServerBuilder.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ AppServerMBeanServerBuilder.java,v <-- AppServerMBeanServerBuilder.java new revision: 1.6; previous revision: 1.5 done Checking in appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ AppServerMBeanServerFactory.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ AppServerMBeanServerFactory.java,v <-- AppServerMBeanServerFactory.java new revision: 1.7; previous revision: 1.6 done Checking in appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ FlushConfigHook.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ FlushConfigHook.java,v <-- FlushConfigHook.java new revision: 1.2; previous revision: 1.1 done Checking in appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ SunoneInterceptor.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/admin/server/core/jmx/ SunoneInterceptor.java,v <-- SunoneInterceptor.java new revision: 1.11; previous revision: 1.10 done Checking in appserv-core/src/java/com/sun/enterprise/server/PEMain.java; /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/server/PEMain.java,v <-- PEMain.java new revision: 1.17; previous revision: 1.16 done Checking in appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/diagnostics/collect/ HadbInfoCollector.java; /cvs/glassfish/appserv-core-ee/appserv-core/src/java/com/sun/enterprise/ee/diagnostics/collect/ HadbInfoCollector.java,v <-- HadbInfoCollector.java new revision: 1.4; previous revision: 1.3 done

glassfishrobot commented 17 years ago

@glassfishrobot Commented File: domain.xml Attached By: fhanik

glassfishrobot commented 18 years ago

@glassfishrobot Commented Was assigned to llc

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-1409

glassfishrobot commented 18 years ago

@glassfishrobot Commented Reported by vitaly_pimenov

glassfishrobot commented 17 years ago

@glassfishrobot Commented Marked as fixed on Thursday, May 17th 2007, 4:05:53 am