Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Double click on any Live Beans Graph node yields to NullPointerException #300

Closed
jhartotr opened this issue Jul 13, 2018 · 9 comments
Closed

Comments

@jhartotr
Copy link

I'm using Spring IDE Version: 3.9.5.201807030714-RELEASE. Please find the generated error log below:

eclipse.buildId=4.8.0.I20180611-0500
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product

This is a continuation of log file /home/user/workspace/.metadata/.bak_0.log
Created Time: 2018-07-13 22:48:27.759

org.eclipse.jface
Error
Sat Jul 14 00:30:54 CEST 2018
Problems occurred when invoking code from plug-in: "org.eclipse.jface".

java.lang.NullPointerException
at org.springframework.ide.eclipse.beans.ui.live.utils.JdtUtils.getJavaProject(JdtUtils.java:41)
at org.springframework.ide.eclipse.beans.ui.live.utils.JdtUtils.getJavaType(JdtUtils.java:65)
at org.springframework.ide.eclipse.beans.ui.live.model.TypeLookupImpl.findType(TypeLookupImpl.java:65)
at org.springframework.ide.eclipse.beans.ui.live.actions.AbstractOpenResourceAction.openInEditor(AbstractOpenResourceAction.java:54)
at org.springframework.ide.eclipse.beans.ui.live.actions.OpenBeanClassAction.run(OpenBeanClassAction.java:52)
at org.springframework.ide.eclipse.beans.ui.livegraph.views.LiveBeansGraphView$1.doubleClick(LiveBeansGraphView.java:131)
at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:830)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:44)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:827)
at org.eclipse.zest.core.viewers.GraphViewer.access$2(GraphViewer.java:1)
at org.eclipse.zest.core.viewers.GraphViewer$2.mouseDoubleClick(GraphViewer.java:104)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:197)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5686)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1370)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4940)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4518)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
at org.eclipse.equinox.launcher.Main.main(Main.java:1471)

@kdvolder
Copy link
Contributor

It seems to work fine for me. This is what I did step by step:

  • Create a new spring boot app using 'New Spring Starter' wizard. Selecting 'web' and 'actuator' as dependencies.
  • launch the app from the boot dash
  • Right-click the project in package explorer and select "Spring Tools >> Open Live Beans Graph'.
  • Pick some nodes in the graph view and double-click => opens a editor, no errors.
  • Also tried the tree view and double-clicking beans nodes in it also works.

I also tried double-clicking on the 'class' and 'resource' nodes in the tree viewer. These didn't open anything, perhaps they should, but I never got an NPE in the error log.

I also tired opening the beans view from boot dash. I.e. via its 'properties page' by selecting the 'beans' tab. Double-click there doesn't seem to do anything (again, perhaps it should), but it didn't cause any errors.

I think we should probably look into why some of the double-click actions I tested don't actually open anything. We'd probably focus on fixing this in the view opend via boot dash as the other view is a 'legacy' view which is meant to be phased out and replaced with the boot-dash-integrated view.

However, since I've never seen any errors like the one you describe I'm not sure this has anything to do with your reported problem. So it would be nice if you can add further details that might help reproduce this error (e.g a detailed sequence of steps just like the one I posted here and/or a sample project (if you don't use a easy to recreate sample like a fresh app created from the wizard).

@sonpth
Copy link

sonpth commented Apr 2, 2019

So my setup is different: I have a Spring application deployed on Tomcat 8.5 and is connected to "Live Beans Graph" via JMX. As you can see from the screenshot below, the graph presents correctly what I have in my context. However when I double-click any node (say filterChains in the screenshot), it will yields a NullPointerException.

Selection_077

My STS
Selection_078

My OS

Linux 4.20.0-042000-generic #201812232030 SMP Mon Dec 24 01:32:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

My log
tail -f /home/user/workspace/bitbucket/.metadata/.log

!ENTRY org.eclipse.jface 4 2 2019-04-02 10:51:49.808
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
	at org.springframework.ide.eclipse.beans.ui.live.utils.JdtUtils.getJavaProject(JdtUtils.java:41)
	at org.springframework.ide.eclipse.beans.ui.live.utils.JdtUtils.getJavaType(JdtUtils.java:65)
	at org.springframework.ide.eclipse.beans.ui.live.model.TypeLookupImpl.findType(TypeLookupImpl.java:65)
	at org.springframework.ide.eclipse.beans.ui.live.actions.AbstractOpenResourceAction.openInEditor(AbstractOpenResourceAction.java:54)
	at org.springframework.ide.eclipse.beans.ui.live.actions.OpenBeanClassAction.run(OpenBeanClassAction.java:52)
	at org.springframework.ide.eclipse.beans.ui.livegraph.views.LiveBeansGraphView$1.doubleClick(LiveBeansGraphView.java:131)
	at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:833)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.internal.JFaceUtil.lambda$0(JFaceUtil.java:47)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:176)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:830)
	at org.eclipse.zest.core.viewers.GraphViewer.access$2(GraphViewer.java:1)
	at org.eclipse.zest.core.viewers.GraphViewer$2.mouseDoubleClick(GraphViewer.java:104)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:200)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5797)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5051)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4583)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:628)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:563)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:151)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:199)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:391)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:246)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1474)

@kdvolder
Copy link
Contributor

kdvolder commented Apr 3, 2019

So my setup is different: I have a Spring application deployed on Tomcat 8.5 and is connected to "Live Beans Graph" via JMX. As you can see from the screenshot below, the graph presents correctly what I have in my context. However when I double-click any node (say filterChains in the screenshot), it will yields a NullPointerException.

Okay, the detailed info about OS and such is somewhat useful. But really, what I need to reproduce this is some rather precise steps to set things up exactly as you did. So something like:

  • a sample spring app configured in a similar way to yours.
  • steps to setup the tomcat server (I don't think STS 3 comes with Tomcat server out of the box, so you had to create the server instance somehow and start it up)
  • set of exact steps on how you deployed the app.
  • set of steps how you connected the app with JMX to livebean graph.

I am going to try to figure some of this out myself right now, but you are really making me guess a lot of the details here.

@kdvolder
Copy link
Contributor

kdvolder commented Apr 3, 2019

Here's how far I got:

  • started with a new blank workspace.
  • created new boot app using "New Spring Starter" project with:
    • dependencies web and actuator
    • war packaging
  • Used the Pivotal tc Server Developer Edition v4.0 that is automatically created in the new workspace
    • drag and drop my boot app onto it.
    • start the server

Not sure what to do next to get a live bean graph for the running app.

@kdvolder
Copy link
Contributor

kdvolder commented Apr 3, 2019

Next steps that I figured out:

  • Double click server in the 'servers view' to open server editor.
  • Find the 'live beans' section in the bottom right corner of the form-based editor.
  • Check the 'Enable Live Beans Indexing' option
  • Restart the server from the servers view.
  • Go back to the 'Server Editor' in the 'live beans' section.
  • Double-click the app name
    => Live bean view opens.
    Now when double-click any node in beans view I get the NPE with similar trace to this report.

@kdvolder
Copy link
Contributor

kdvolder commented Apr 3, 2019

The NPE is caused by TypeLookupImpl which has a 'null' value for project. So basically it has no idea which project it should use as the scope to lookup the type. The error could easily be avoided with a 'null' check, but this, of course, will not solve the real problem (the type lookup will still not work). Proper solution needs to make sure the TypeLookupImpl receives the project associated with the deployed app somehow.

kdvolder added a commit that referenced this issue Apr 3, 2019
... if not targeted to a specific project.

Relates to: #300
@spring-projects-issues
Copy link

(comment in Pivotal Tracker added by Kris De Volder:)

Fix pushed to master.

@sonpth
Copy link

sonpth commented Apr 3, 2019

I am going to try to figure some of this out myself right now, but you are really making me guess a lot of the details here.

Sorry, didn't plan to make your life more difficult. :(

I didn't mentioned that because it is quite standard, but here it is

a sample spring app configured in a similar way to yours.

It is just a standard Spring MVC with Spring security wrapping around it. The bean I clicked is the out-of-the box Spring security class. I will try to with a similar sample spring app when I have a chance.

steps to setup the tomcat server (I don't think STS 3 comes with Tomcat server out of the box, so you had to create the server instance somehow and start it up)

A standard tar version from Apache website, I added few additional options to setenv.sh

export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:MetaspaceSize=256m -Dlog4j.configuration=file:/home/user/tmp/log4j.xml"

export CATALINA_OPTS="-Dspring.liveBeansView.mbeanDomain -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false     -Djava.rmi.server.hostname=localhost -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

set of exact steps on how you deployed the app.

just drop the war file into the webapps folder

set of steps how you connected the app with JMX to livebean graph.

Selection_079

@kdvolder
Copy link
Contributor

kdvolder commented Apr 4, 2019

Thanks for extra details. Fortunately I was already able to reproduce the problem using the TcServer that is included by default in STS. Allthough the details of how I did things aren't quite the same as your description, I am fairly confident that the problem is fixed.

If you have the time you could confirm that the fix works for your situation by using a nightly distribution build, which you can download here:

http://dist.springsource.com/snapshot/STS/nightly-distributions.html

PS: For future reference, when it comes to 'sample' apps it best to actually attach a sample app rather than provide a general description. Yes, I could probably coble something together based on that description but, the point is, it will cost some time. Time I could otherwise spend on debugging and fixing the problem (or other problems). Also I would still be guessing about many details. These details may not matter... or they might. Anyhow... in the end, I think all is well since I think I was able to figure out and fix the problem already.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

5 participants