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

Unable to run lcm-spy or bot-spy Due To java.lang.NoClassDefFoundError #3231

Closed
liangfok opened this issue Aug 23, 2016 · 19 comments · Fixed by #4680
Closed

Unable to run lcm-spy or bot-spy Due To java.lang.NoClassDefFoundError #3231

liangfok opened this issue Aug 23, 2016 · 19 comments · Fixed by #4680

Comments

@liangfok
Copy link
Contributor

The Error

The following errors were obtained on Ubuntu Linux 14.04.4 LTS.

lcm-spy Error

$ ./drake-distro/build/install/bin/lcm-spy 
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$4.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ITrace2D
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ObjectPanel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$MyMouseWheelListener.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$5.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/axis/AAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$3.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ZoomableChart
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$2.class
Found 0 LCM types
LCM: Disabling IPV6 support
LCM: TTL set to zero, traffic will not leave localhost.
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ZoomableChart
                 jar: /home/liang/dev/drake-distro-2/build/install/bin/../share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel.class
Found 0 plugins

bot-spy Error

$ ./drake-distro/build/install/bin/bot-spy
Checking /home/liang/dev/drake-distro-2/build/install/share/java
   Found /home/liang/dev/drake-distro-2/build/install/share/java/lcmtypes_bot2-core.jar
   Found /home/liang/dev/drake-distro-2/build/install/share/java/lcmtypes_bot2-param.jar
   Found /home/liang/dev/drake-distro-2/build/install/share/java/lcmtypes_bot2-procman.jar
   Found /home/liang/dev/drake-distro-2/build/install/share/java/lcmtypes_drake.jar
   Found /home/liang/dev/drake-distro-2/build/install/share/java/lcmspy_plugins_bot2.jar
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$4.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ITrace2D
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ObjectPanel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$MyMouseWheelListener.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$5.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/axis/AAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$3.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ZoomableChart
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$2.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$4.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ITrace2D
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ObjectPanel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$MyMouseWheelListener.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$5.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/axis/AAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$3.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ZoomableChart
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/IAxis
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel$2.class
Found 75 LCM types
LCM: Disabling IPV6 support
LCM: TTL set to zero, traffic will not leave localhost.
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ZoomableChart
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel.class
ClassDiscoverer: java.lang.NoClassDefFoundError: info/monitorenter/gui/chart/ZoomableChart
                 jar: /home/liang/dev/drake-distro-2/build/install/share/java/lcm.jar
                 class: lcm/spy/ZoomableChartScrollWheel.class
Found 4 plugins
 bot2_spy.ImagePlugin@4fc09423
 bot2_spy.PlanarLidarPlugin@6c3daebc
 bot2_spy.ImagePlugin@459af028
 bot2_spy.PlanarLidarPlugin@3f0cf5cb

Prognosis

The error message mentions packages named "info/monitorenter/gui". This appears to be part of JChart2d.

Searching in drake-distro, I see that JChart2d exists:

$ cd drake-distro
$ find . -name "*.jar" | grep jchart2d*
./externals/lcm/lcm-java/jchart2d-code/ext/xmlgraphics-commons-1.3.1.jar
./externals/lcm/lcm-java/jchart2d-code/ext/build/profile.jar
./externals/lcm/lcm-java/jchart2d-code/ext/build/junit-4.8.1.jar
./externals/lcm/lcm-java/jchart2d-code/ext/build/jipViewer.jar
./externals/lcm/lcm-java/jchart2d-code/ext/build/proguard-4.5.1.jar
./externals/lcm/lcm-java/jchart2d-code/ext/jide-oss-2.9.7.jar
./externals/lcm/lcm-java/jchart2d-code/doc/lib/jchart2d-applet.jar
./build/externals/lcm/lcm-java/jchart2d-code/jchart2d-3.2.2.jar
./build/install/share/java/jchart2d-3.2.2.jar

Thus, maybe there's a problem with the CLASSPATH?

@sammy-tri
Copy link
Contributor

16.04 fails in a similar fashion.

@jwnimmer-tri
Copy link
Collaborator

Do these tools still work for anyone? If not, seems like much worse that "medium" priority.

I am also seeing this errors, and unable to run the spy tool.

@jwnimmer-tri
Copy link
Collaborator

Adding more jars to my classpath seems to be a work-around:

java -server -Djava.net.preferIPv4Stack=true -Xincgc -Xmx128m -Xms64m -ea -cp `ls build/install/share/java/*.jar | xargs echo | perl -pe 's# #:#g;'` lcm.spy.Spy &

@liangfok
Copy link
Contributor Author

liangfok commented Sep 1, 2016

Thanks for the workaround! I was using a months old clone of Drake (one prior to placing the build in drake-distro/build) to launch bot-spy.

@jwnimmer-tri
Copy link
Collaborator

See also lcm-proj/lcm#97.

@jwnimmer-tri
Copy link
Collaborator

This is really fairly annoying. I'm going to work around it in my one shell script, but really we should get bot-spy working again. @david-german-tri can you escalate to kitware?

@jwnimmer-tri
Copy link
Collaborator

I've added some hack-arounds. Be sure to grep for this issue number and remove them, concurrently with fixing this issue.

@wxmerkt
Copy link
Member

wxmerkt commented Oct 17, 2016

@jwnimmer-tri Would you mind sharing your workaround (is it the bot_spy_that_actually_works?)? This is currently blocking for us as we move up

@jwnimmer-tri
Copy link
Collaborator

@wxmerkt Sure (and yes)!

Here is the bash version that we were using for a while:

function bot_spy_that_actually_works {
    JAR_DIR=${DRAKE_DIST_BUILD}/install/share/java
    CLASSPATH=$(echo ${JAR_DIR}/*.jar | sed -e 's# #:#g'):${CLASSPATH}
    java -cp "${CLASSPATH}" lcm.spy.Spy
}

Since then we've ported it to python instead:

def bot_spy_that_actually_works():

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Nov 28, 2016

@liangfok This is high priority, but apparently not getting any attention. I just re-tested and it's still broken. Should we reassign this to @mwoehlke-kitware or are you working on it?

@liangfok
Copy link
Contributor Author

I haven't started to work on it yet. I'll go ahead and assign it to @mwoehlke-kitware.

@mwoehlke-kitware
Copy link
Contributor

My guess is this is blocked / fixed by lcm-proj/lcm#143 and corresponding changes to libbot which I believe @wxmerkt was working on...

@wxmerkt
Copy link
Member

wxmerkt commented Nov 28, 2016

I've tested your fixes and fed back that they didn't work including output for both CMake-LCM and Autoconf-LCM(v1.3-lts), cf. lcm-proj/lcm#143 (comment). I'm not working on it/not blocking it. As far as I can tell it, @patmarion's hunch in lcm-proj/lcm#143 (comment) might have identified the issue that's causing this problem (i.e. dependent jars not being embedded?).

@jwnimmer-tri
Copy link
Collaborator

@mwoehlke-kitware I agree that finishing that PR is the answer (and then just bumping Drake's sha). Could I ask you to help push it through to a resolution?

@manuelli
Copy link
Contributor

Has there been any progress on this? Being able to run a bot-spy to inspect LCM traffic is a very basic and necessary functionality if you want to use Drake on an actual robot. I think it will end up being blocking for lots of people, or they will all have to implement this workaround. I have implemented the workaround for the moment but I am hoping this can be fixed in master soon.

@jwnimmer-tri
Copy link
Collaborator

I bumped up Drake's LCM sha recently. It's possible that everything just works now. @liangfok do you want to retest and report back?

@manuelli
Copy link
Contributor

I built drake master yesterday and it still didn't work. The bot-spy launches but you aren't able to actually inspect the messages.

@david-german-tri
Copy link
Contributor

@mwoehlke-kitware, sounds like the ball is still in your court on this one.

@mwoehlke-kitware
Copy link
Contributor

See RobotLocomotion/libbot2#2

mwoehlke-kitware added a commit to mwoehlke-kitware/drake that referenced this issue Jan 4, 2017
Update libbot to bring in RobotLocomotion/libbot2#2, which fixes the
last remaining bits of RobotLocomotion#3231. This also switches us to the new
repository which shares history with upstream. (The old repository was
separately copied from the old subversion repository, and had the same
content but not the same SHA's.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants