JmePhysics failing when running in headless mode?


There seems to be a problem with jmephysics because when I run in headless mode my program hangs in the following line:

staticNode = physicsSpace.createStaticNode();

When I say that 'my program hangs' I mean that the problematic thread somehow fails. The debugger says it is running (or stepping, if I was debugging) but I cannot get the stacktrace. The lines following the problematic call don't get executed.

I think this is related to the fact that I'm running headless, because in graphical mode, the same code works fine. The problem could also be related to the fact that I'm calling that inside a Callable, but I don't think that's the problem and anyway, when running in graphics mode It works ok.

When I debug the application I can reach the place where the application actually hangs:

Thread [Thread-1] (Suspended (breakpoint at line 318 in OdePhysicsSpace))   
   OdePhysicsSpace.<init>() line: 318   
   OdePhysicsSpace$OdeFactory.create() line: 195   
   PhysicsSpace.create() line: 317   
   Level.<init>(String) line: 95   
   TestLevelLoader.loadLevel() line: 89 line: 49   
   GameTask<V>.invoke() line: 91   
   GameTaskQueue.execute() line: 113   
   StandardGame.update(float) line: 261 line: 169 line: not available   

I guess that it is hanging in the static initialization phase of the Odejava class, but in some way I think that the class is even not entering its static constructor. But I know nothing about JNI.

Any help on this or at least on how to debug something as strange would be welcome.

I still don't believe it.

The cause why it is hanging is that I'm have a BufferedReader on running in another thread.

However, when I press 'enter' in the console, the first thread (which hang when initializing Odejava)  resumes its execution.

I don't find a reason why Odejava should stop waiting for the application input stream.

This is the run() method of the thread that is causing Odejava to wait:

   public void run() {
      BufferedReader reader = new BufferedReader(new InputStreamReader(;
      try {
         while (true) {
            prompt = reader.readLine();
      } catch (IOException e) {
         java.lang.System.out.println ("IOException while reading the console");

Sorry for the spam today 

That's a really strange behavior. No idea what's causing this :expressionless:

I can provide a project with that behavior if you feel like debugging it.

By now, I'm just pressing ENTER in the console each time I start the server. In the future, I'll try to workaround it by creating the thread after Ode has initialized.