BinaryImporter throwing an ArrayIndexOutOfBounds [RESOLVED]


I had a working program that could import a .jme model into StandardGame. However, I decided to update to jME 2.0.

After fixing all the broken code, I ran the program and this is what i got:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 16
   at com.jme.util.export.binary.BinaryImporter.readObject(
   at com.jme.util.export.binary.BinaryInputCapsule.resolveIDs(
   at com.jme.util.export.binary.BinaryInputCapsule.readSavableArray(
   at com.jme.util.export.binary.BinaryInputCapsule.readSavableArrayList(
   at com.jme.util.export.binary.BinaryImporter.readObject(
   at com.jme.util.export.binary.BinaryImporter.load(
   at com.jme.util.export.binary.BinaryImporter.load(
   at jmectftest.jmectfGameState.buildPlayer(
   at jmectftest.jmectfGameState.<init>(
   at jmectftest.jmectfTest.start(
   at jmectftest.jmectfTest.main(

the code worked before:

Spatial model = null;
      try {
         File file = new File("data/tank.jme");
         URL path = file.toURI().toURL();
         BinaryImporter importer = new BinaryImporter();
         model = (Spatial)importer.load(path.openStream());
         model.setModelBound(new BoundingBox());
         model.rotateUpTo(new Vector3f(0.0f, 0.0f, -1.0f));
         model.rotateUpTo(new Vector3f(.5f , 0.0f, 0.0f));
      } catch (IOException e) {
         System.out.println("Could not load model.");

You'll need to re-export the binary model from your new jME version.

LordOfChaos said:

However, I decided to update to jME 1.0.

I suppose you updated to jME 2.0?

and yes, that is quite expected.

models converted from format .xyz to .jme with jme1.0 are not loading in jme2.0, you have to convert them again with jme2.0.

so long,

Thanks for the replies!

I think I already did - I used ModelLoader to write it again and then replaced the old tank.jme with the new one.


I copied it into the wrong workspace (I had two copies of my project)

It works perfectly now, thanks