Blender Wavefront export file causes java.lang.NullPointerException

Hi all,

My configuration:

Windows XP

Latest JMonkeySDK, updated.

Blender 2.56 Beta

To reproduce what I experience try the following:

1- Create a new scene in Blender. Remove everything.

2- Create a cylinder mesh.

3- Export it using Wavefront format under /assets/models.

4- Right click on the obj file from inside JMonkeySDK and try “View Model”.

At this point you should see the error message and the following details:

at com.jme3.scene.plugins.OBJLoader.readFace(
at com.jme3.scene.plugins.OBJLoader.readLine(
at com.jme3.scene.plugins.OBJLoader.load(
at com.jme3.asset.DesktopAssetManager.loadAsset(
at com.jme3.asset.DesktopAssetManager.loadModel(
at com.jme3.asset.DesktopAssetManager.loadModel(
[catch] at com.jme3.gde.core.assets.SpatialAssetDataObject.loadAsset(
at com.jme3.gde.core.assets.actions.OpenModel$

I get the same behavior in Blender 2.49.

Any help/comment?

EDIT: Try the same procedure with a cube instead of a cylinder and all is fine...

Thank you,


Triangularize the model before exporting. A game model should only consist of triangles.

Thanks for the suggestion…

I did triangulate the cylinder (Edit Mode → Select All Faces → Ctrl-T)…

Did not help…Still slapped by the Exception…


You should be using OgreXML anyway, obj doesn’t support game compatible animation.

I prefer OBJ format to export my complex static scene. No animations. It is convenient for me since I only deal with 2 files as opposed to OgreXML’s 1 file per mesh.

Anyway, I found the problem source:

In the exported OBJ file, if the mesh has no material:

usemtl (null)

AND if the OBJ file references to an MTL file:

mtllib untitled.mtl

then JME throws NullPointerException.

If the mesh has no material AND the OBJ file does NOT reference to an MTL file then all is fine...

This to me looks like a bug in the JME OBJ importer...

What do you think?

EDIT: By the way, you guys did an exceptional job with JME SDK. It truly is amazing. I came from Ogre and Panda3D and it seems like I will hang out with JME for a long time...Hats off...


Thanks, also for the detailed bug report. I guess @Momoko_Fan will be interested in this.

have a try to assign a material to your mesh in blender and export again.

“(null)” is not a valid value for “usemtl”. I checked the spec.

If no material named “(null)” is defined in the MTL file, then this is a parsing error. I have committed a fix to SVN that displays a better error message when this occurs.

Make sure all meshes in Blender3D have a material assigned, or alternatively you can request the authors of the OBJ exporter to follow the spec.

Momoko_fan, what about the difference between ogre, obj and assetManager uv coordinates? Did you choose UV-flipping standard? I’m just curious about such an issue of UV difference importers.


I imported this model through jMP, using the defaults where OgreXML will not flip textures while for OBJ it will. I cannot see any issue.

Cool test! I’ve got another results.

Uploaded with

Guy model -

I tried just view ogre/obj and assign lighting material. Result is the same.

I loaded your models, and they appear fine!

Take a look at this screenshot:

:o :o :o

I just did right click on ogre/obj and chosed: Concert to j3o binary, or View model. And i got such a result.

It means that importing function(right click) for obj works incorrectly. Will that function be fixed or removed?

Anyway, THANKS! You saved my life!

Huh? It uses the same way to load the asset and convert it… :?

as you see something is different.