Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with creating a JFR recording #3

Open
mbazos opened this issue Nov 8, 2023 · 4 comments
Open

Issue with creating a JFR recording #3

mbazos opened this issue Nov 8, 2023 · 4 comments

Comments

@mbazos
Copy link

mbazos commented Nov 8, 2023

@skarsaune Thanks for creating this plugin for Jolokia. I was getting it setup with the versions you stated but when I start a JFR recoding via eclipse I get the following exception. I am not sure what I did wrong or if I have the incorrect/incompatible versions but I am using

Jolokia JVM agent is 1.7.2
Eclipse + JMC - 8.1

I am able start the JMX console but I am unable to do a flight recoding I get this error in Eclipse JFR when I attempt to start a recording:

java.lang.RuntimeException: java.lang.ClassCastException: class org.json.simple.JSONArray cannot be cast to class [Ljavax.management.openmbean.CompositeData; (org.json.simple.JSONArray is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6cddafb6; [Ljavax.management.openmbean.CompositeData; is in module java.management of loader 'bootstrap')
	at org.openjdk.jmc.ui.wizards.WizardAdapterFactory.getAdapter(WizardAdapterFactory.java:47)
	at org.eclipse.core.internal.adapter.AdapterFactoryProxy.lambda$5(AdapterFactoryProxy.java:111)
	at java.base/java.util.Optional.map(Optional.java:260)
	at org.eclipse.core.internal.adapter.AdapterFactoryProxy.getAdapter(AdapterFactoryProxy.java:111)
	at org.eclipse.core.internal.runtime.AdapterManager.lambda$7(AdapterManager.java:248)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1685)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:261)
	at org.openjdk.jmc.ui.common.util.AdapterUtil.getAdapter(AdapterUtil.java:79)
	at org.openjdk.jmc.browser.wizards.ActionWizardPage.getNextPage(ActionWizardPage.java:132)
	at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:915)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:469)
	at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4646)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1325)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4413)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3989)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at org.eclipse.jface.window.Window.open(Window.java:799)
	at org.openjdk.jmc.ui.misc.DialogToolkit.openWizardWithHelp(DialogToolkit.java:176)
	at org.openjdk.jmc.browser.wizards.ConnectionWizard.openConnectWizard(ConnectionWizard.java:81)
	at org.openjdk.jmc.browser.wizards.OpenConnectionWizardHandler.execute(OpenConnectionWizardHandler.java:46)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:300)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:234)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
	at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4646)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1325)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4413)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3989)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:342)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:645)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:342)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:552)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:651)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:588)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1459)
Caused by: java.lang.ClassCastException: class org.json.simple.JSONArray cannot be cast to class [Ljavax.management.openmbean.CompositeData; (org.json.simple.JSONArray is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @6cddafb6; [Ljavax.management.openmbean.CompositeData; is in module java.management of loader 'bootstrap')
	at org.openjdk.jmc.rjmx.services.jfr.internal.FlightRecorderServiceV2.getAvailableRecordings(FlightRecorderServiceV2.java:297)
	at org.openjdk.jmc.flightrecorder.controlpanel.ui.wizards.RecordingWizardModel.getDescriptors(RecordingWizardModel.java:320)
	at org.openjdk.jmc.flightrecorder.controlpanel.ui.wizards.RecordingWizardModel.findUniqueName(RecordingWizardModel.java:287)
	at org.openjdk.jmc.flightrecorder.controlpanel.ui.wizards.RecordingWizardModel.<init>(RecordingWizardModel.java:164)
	at org.openjdk.jmc.flightrecorder.controlpanel.ui.actions.StartRecordingAction.doCreateWizard(StartRecordingAction.java:68)
	at org.openjdk.jmc.ui.wizards.AbstractWizardUserAction.createWizard(AbstractWizardUserAction.java:65)
	at org.openjdk.jmc.ui.wizards.WizardAdapterFactory.getAdapter(WizardAdapterFactory.java:45)
	... 76 more

Any information on this would be helpful.

@skarsaune
Copy link
Owner

Hey @mbazos :-) . I might have seen this one before, but I struggle a little bit to remember what. To be honest this side project is lagging a bit behind, and I´m struggling to keep up with a busy "day job". In the meantime you could try to build Java mission control from this branch and see whether it works better: https://github.com/skarsaune/jmc/tree/jolokia-support
I do have an open PR for mission control, but I struggle with some test pipeline issues, that I focus on fixing first. It is no problem to build and run it though.

@mbazos
Copy link
Author

mbazos commented Nov 8, 2023

Thanks @skarsaune I will give that a try.

@mbazos
Copy link
Author

mbazos commented Nov 13, 2023

@skarsaune finally got the build working for jmc and in fact that branch does work and I am able to record a a JFR recording. For anyone else seeing this to get this to work with JMC you need to use this modified branch:

https://github.com/skarsaune/jmc/tree/jolokia-support

Once built you can run an app using Jolokia in my case I used the Java Agent 1.7.0 and once JMC started up created a new connection using the following:
service:jmx:jolokia://127.0.0.1:7777/jolokia/

While this does work and is pretty awsome, JMC 9.x is pretty out of date and I wonder if there is anyway to get this working with the latest version of JMC that's built from the mainline sources (not a forked branch). I will let the Jolokia team know this works not sure if they could take a look at your commits to help with support for JFR & JMC in general.

Thanks for the help @skarsaune

@skarsaune
Copy link
Owner

Great find @mbazos . Now I can look a bit on both jolokia and jmc for where the solution lies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants