[SOLVED] Trouble running HelloCollision with maven artifacts (form SBT)

Hi All,

I’ve been working my way through the jme3 beginner tutorials and arrived at the HelloCollision tutorial. Trying to run it, I get the below stracktrace:

[info] Running tutorial.HelloCollision 
[error] Jun 28, 2017 7:17:39 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
[error] WARNING: Pausing audio device not supported.
[error] Jun 28, 2017 7:17:39 PM com.jme3.app.LegacyApplication handleError
[error] SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
[error] java.lang.NoClassDefFoundError: com/bulletphysics/collision/dispatch/CollisionObject
[error]         at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:164)
[error]         at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:211)
[error]         at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:133)
[error]         at tutorial.HelloCollision.simpleInitApp(HelloCollision.scala:57)
[error]         at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
[error]         at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
[error]         at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] Caused by: java.lang.ClassNotFoundException: com.bulletphysics.collision.dispatch.CollisionObject
[error]         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)

I’m using maven dependencies for version 3.1.0 as well as the jar for jme3-testdata (as it isn’t on maven). I’ve tried using the jbullet or the bullet + bullet-native (or both! - probably a bad idea) libraries from JCenter or Bintray, but to no avail. Furthermore, apparently there is no CollisionObject in jme3 these days, unless IntelliJ search is failing me. … So, what is happening

1 Like

It’s definitely wrong to use jbullet + bullet at the same time. Make sure you’re using only one or the other. Have you done a clean build and ran from that?

1 Like

Hmm, good point, but regardless of which I choose, I seem to get the same error, after reloading the build system and running ‘clean’ each time.

I’m still a bit confused about where in the source code CollisionObject is defined.

I see a few references for the class in the jmonkeyengine repo by running the following command:

find ./ -name '*.java' | xargs grep "com.bulletphysics.collision.dispatch"

However, if I also search for a package definition … nothing:

find ./ -name '*.java' | xargs grep "com.bulletphysics.collision.dispatch" | grep package
1 Like

My project starts and runs with the following lines:

compile 'org.jmonkeyengine:jme3-bullet:3.1.0-stable'
compile 'org.jmonkeyengine:jme3-bullet-native:3.1.0-stable'

This sounds like your build tool isn’t fetching dependencies of the bullet packages. What build tool are you using?

1 Like

Hmm, could be - I’m using the “simple” (scary) build tool: SBT.

1 Like

Looks like I have them all in my local ivy cache though:

brandon@brandon-750-170se:~/.ivy2$ find ./ -name '*bullet*'
./cache/org.jmonkeyengine/jme3-bullet
./cache/org.jmonkeyengine/jme3-bullet/jars/jme3-bullet-3.1.0-stable.jar
./cache/org.jmonkeyengine/jme3-bullet/srcs/jme3-bullet-3.1.0-stable-sources.jar
./cache/org.jmonkeyengine/jme3-bullet-native
./cache/org.jmonkeyengine/jme3-bullet-native/jars/jme3-bullet-native-3.1.0-stable.jar
./cache/org.jmonkeyengine/jme3-bullet-native/srcs/jme3-bullet-native-3.1.0-stable-sources.jar
./cache/org.jmonkeyengine/jme3-jbullet
./cache/org.jmonkeyengine/jme3-jbullet/jars/jme3-jbullet-3.1.0-stable.jar
./cache/org.jmonkeyengine/jme3-jbullet/srcs/jme3-jbullet-3.1.0-stable-sources.jar
brandon@brandon-750-170se:~/.ivy2$ 
1 Like

We can’t debug your dependency list unless we can see the dependency list.

1 Like
lazy val jmonkeyDeps = Seq(
      "org.jmonkeyengine" % "jme3-core" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
      ,"org.jmonkeyengine" % "jme3-examples" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
/*      ,"org.jmonkeyengine" % "jme3-bullet" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
      ,"org.jmonkeyengine" % "jme3-bullet-native" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")*/
      ,"org.jmonkeyengine" % "jme3-jbullet" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
//    ,"org.jmonkeyengine" % "jme3-testdata" % "3.1.0-stable" from "file://lib/jme3-testdata-3.1.0.jar"
      ,"org.lwjgl.lwjgl" % "lwjgl_util" % "2.9.3"
//    ,"org.specs2" %% "specs2-core" % "3.8.9" % "it,test"
)

I have a few commented out in this configuration; but I had the same result when I swap in the two bullet libs in place of jbullet.

1 Like

@pspeed can correct me if I’m wrong, but I do not believe that the jBullet version has been developed recently - always use the bullet and bullet-native dependencies. You’ll get much better performance anyway. Can you re-enable those and then do a clean build and run of your project?

1 Like

Maybe I can try on a different system later, but this is what I’m getting on the system I’ve been working on:

brandon@brandon-750-170se:~/workspace/SME$ cat build.sbt | grep bullet
      ,"org.jmonkeyengine" % "jme3-bullet" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
      ,"org.jmonkeyengine" % "jme3-bullet-native" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
//      ,"org.jmonkeyengine" % "jme3-jbullet" % "3.1.0-stable" exclude("org.jmonkeyengine", "jme3-testdata")
brandon@brandon-750-170se:~/workspace/SME$ sbt
[info] Loading global plugins from /home/brandon/.sbt/0.13/plugins
[info] Loading project definition from /media/brandon/portadrive/projects/SME/project
[info] Set current project to SME (in build file:/media/brandon/portadrive/projects/SME/)
> clean
[warn] Binary version (0.2.0-bin-20170624-281416b-NIGHTLY) for dependency ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY
[warn]  in sme#sme_0.2;0.1 differs from Scala binary version in project (0.2).
[success] Total time: 0 s, completed Jun 28, 2017 8:57:34 PM
> reload
[info] Loading global plugins from /home/brandon/.sbt/0.13/plugins
[info] Loading project definition from /media/brandon/portadrive/projects/SME/project
[info] Set current project to SME (in build file:/media/brandon/portadrive/projects/SME/)
> runHelloCollision
[info] Updating {file:/media/brandon/portadrive/projects/SME/}root...
[warn] Binary version (0.2.0-bin-20170624-281416b-NIGHTLY) for dependency ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY
[warn]  in sme#sme_0.2;0.1 differs from Scala binary version in project (0.2).
[info] Resolving ch.epfl.lamp#dotty-library_0.2;0.2.0-bin-20170624-281416b-NIGHTLY ...
[warn] circular dependency found: ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY->ch.epfl.lamp#dotty-library_0.2;0.2.0-bin-20170624-281416b-NIGHTLY->...
[warn] circular dependency found: ch.epfl.lamp#dotty-library_0.2;0.2.0-bin-20170624-281416b-NIGHTLY->ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY->...
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.1 ...
[info] Done updating.
[info] Copying files for linux64
[info] Compiling 24 Scala sources to /media/brandon/portadrive/projects/SME/target/scala-0.2/classes...
[info] Compiling 1 Scala source to /media/brandon/portadrive/projects/SME/target/scala-0.2/test-classes...
[info] Running tutorial.HelloCollision 
[error] Jun 28, 2017 8:58:14 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
[error] WARNING: Pausing audio device not supported.
[error] Jun 28, 2017 8:58:14 PM com.jme3.app.LegacyApplication handleError
[error] SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
[error] java.lang.NoClassDefFoundError: com/bulletphysics/collision/dispatch/CollisionObject
[error]         at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:164)
[error]         at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:211)
[error]         at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:133)
[error]         at tutorial.HelloCollision.simpleInitApp(HelloCollision.scala:57)
[error]         at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
[error]         at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
[error]         at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] Caused by: java.lang.ClassNotFoundException: com.bulletphysics.collision.dispatch.CollisionObject
[error]         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]         ... 8 more
[error] 
> clean
[warn] Binary version (0.2.0-bin-20170624-281416b-NIGHTLY) for dependency ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY
[warn]  in sme#sme_0.2;0.1 differs from Scala binary version in project (0.2).
[success] Total time: 0 s, completed Jun 28, 2017 8:57:34 PM
> reload
[info] Loading global plugins from /home/brandon/.sbt/0.13/plugins
[info] Loading project definition from /media/brandon/portadrive/projects/SME/project
[info] Set current project to SME (in build file:/media/brandon/portadrive/projects/SME/)
> runHelloCollision
[info] Updating {file:/media/brandon/portadrive/projects/SME/}root...
[warn] Binary version (0.2.0-bin-20170624-281416b-NIGHTLY) for dependency ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY
[warn]  in sme#sme_0.2;0.1 differs from Scala binary version in project (0.2).
[info] Resolving ch.epfl.lamp#dotty-library_0.2;0.2.0-bin-20170624-281416b-NIGHTLY ...
[warn] circular dependency found: ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY->ch.epfl.lamp#dotty-library_0.2;0.2.0-bin-20170624-281416b-NIGHTLY->...
[warn] circular dependency found: ch.epfl.lamp#dotty-library_0.2;0.2.0-bin-20170624-281416b-NIGHTLY->ch.epfl.lamp#scala-library;0.2.0-bin-20170624-281416b-NIGHTLY->...
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.1 ...
[info] Done updating.
[info] Copying files for linux64
[info] Compiling 24 Scala sources to /media/brandon/portadrive/projects/SME/target/scala-0.2/classes...
[info] Compiling 1 Scala source to /media/brandon/portadrive/projects/SME/target/scala-0.2/test-classes...
[info] Running tutorial.HelloCollision 
[error] Jun 28, 2017 8:58:14 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
[error] WARNING: Pausing audio device not supported.
[error] Jun 28, 2017 8:58:14 PM com.jme3.app.LegacyApplication handleError
[error] SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
[error] java.lang.NoClassDefFoundError: com/bulletphysics/collision/dispatch/CollisionObject
[error]         at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:164)
[error]         at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:211)
[error]         at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:133)
[error]         at tutorial.HelloCollision.simpleInitApp(HelloCollision.scala:57)
[error]         at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
[error]         at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
[error]         at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] Caused by: java.lang.ClassNotFoundException: com.bulletphysics.collision.dispatch.CollisionObject
[error]         at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
[error]         at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]         ... 8 more
[error] 
1 Like

Oh, and here is the complete project: GitHub - bbarker/SME: Wrappers and examples for using JME3 (JMonkeyEngine 3) in Scala

Edit: - getting a bit off topic … though I doubt anyone cares, I inherited the GPL from the repo I cloned this from. IMO, I don’t see how it is GPL as it is just Scala-ported versions of the Java examples, but maybe translating to another language allows relicensing … in any case, I guess I can keep the examples as GPL and put the other stuff under a more permissive license.

1 Like

[quote=“bbarker, post:11, topic:38875, full:true”]but maybe translating to another language allows relicensing …
[/quote]

Off-Topic but since you asked: It might, depending on if it is considered a ‘new work’ or not. But even if it is not, the original code probably (should) have a license and that license may allow you to distribute the original code with another license.

The argument is: I find some software that for example has the BSD license. This gives me a license to redistribute and modify that software given I comply with the BSD requirements of including the disclaimer et c. So if I use my licensed rights of modifying and redistributing the software I can modify it by adding a GPL license header and redistribute it as such and I have not violated anything in the BSD license (I must also include the disclaimer required et c.). That is why BSD is considered compatible with GPL.

The other way around is not possible, if I find some software that has the GPL license I am licensed to modify and redistribute the software but ONLY if the software retains the GPL license.

1 Like

This actually is not the case. Everything in jME is released under a BSD-style license, which contains no provisions for relicensing. GPL requires that a project and ALL derivative works be released under the terms of the GPL. Since BSD-style licenses do not make that requirement, derivative works (such as a translation to another language) can be released under any license.

That said, the GPL doesn’t make much sense for an examples project. I’m guessing that whoever did the translation wasn’t super license-savvy and just slapped the GPL on because it’s a well-known open source license.

1 Like

@danielp That was my take on the situation for BSD; makes sense. I wasn’t sure what derivative work would encompass for GPL (though I agree you are probably right), and I agree about your guess to the circumstance that led up to this…

Anyway, I’m more worried about the technical issues for this :slight_smile: Will try to look into it more soon, but I’m not sure what to try next. I’ve given it a good college try of trying to locate the definition of CollisionObject in both C++ and Java, but haven’t succeeded!

1 Like

For GPL, a “derivative work” (a) definitely covers any alterations of the original source, further developments of the source, etc., and (b) almost certainly covers any and all use of the code in another project. If you use a GPL library in a project and release that project, your project must be GPL licensed and the source must be made available. The one and only exception (that I’m aware of) is the GNU Classpath Exception, which allows using a GPL library without any restrictions on your code’s license or distribution. This gives strong copyleft protection for the original code without “infecting” codebases that use GPL code. A notable example of a codebase using this license is the OpenJDK class library - it’s GPL, but because of the classpath exception anyone can use the OpenJDK class library without the GPL “infecting” their code. With other GPL-ish licenses, such as the LGPL, the rules are slightly different and I’m not sure of the details.

Anyway, all that is a bit of an aside - just thought I’d toss that in there. GPL can be confusing, and it’s hard to get good information on it without quickly getting buried under mountains of legalese.

As far as the original problem… I admit that I’m stumped. I’m sure you already looked here, but have you looked at the lines of the BulletAppState that are pointed to by the stack trace?

2 Likes

Thanks again for info on licensing.

The relevant bit of BulletAppState calls the constructor for PhysicsSpace - all references to dispatch.CollisionObject seem to be commented out !

1 Like

Sorry for being away from this for a while - I’d like to get back into JME after overcoming this hurdle (had a few life hurdles to get over recently).

Anyway, if anyone has a project using only maven artifacts with the working collision example, i’d love to see it - that might provide me a reference point where I could debug this and understand what is going on.

1 Like

I got HelloCollision working in Gradle. Would that help?

@sgold Sure - I’ve used it a little before! Thanks

1 Like

Here you go:

GitHub - stephengold/HelloCollision-on-Gradle: jMonkeyEngine's HelloCollision tutorial implemented as a Gradle project