[SOLVED] NoSuchMethodException when creating TerrainQuad

This suddenly started cropping up, at first I thought it was from attempting to multi-thread my asset loading, but now my basic terrain test is failing!

Exception in thread "main" java.lang.NoSuchMethodError: com.jme3.scene.mesh.IndexBuffer.put(II)V
	at com.jme3.terrain.geomipmap.LODGeomap$VerboseBuffer.put(LODGeomap.java:931)
	at com.jme3.terrain.geomipmap.LODGeomap.writeIndexArrayLodDiff(LODGeomap.java:175)
	at com.jme3.terrain.geomipmap.LODGeomap.createMesh(LODGeomap.java:85)
	at com.jme3.terrain.geomipmap.LODGeomap.createMesh(LODGeomap.java:77)
	at com.jme3.terrain.geomipmap.TerrainPatch.<init>(TerrainPatch.java:190)
	at com.jme3.terrain.geomipmap.TerrainQuad.createQuadPatch(TerrainQuad.java:722)
	at com.jme3.terrain.geomipmap.TerrainQuad.split(TerrainQuad.java:567)
	at com.jme3.terrain.geomipmap.TerrainQuad.<init>(TerrainQuad.java:223)
	at com.jme3.terrain.geomipmap.TerrainQuad.createQuad(TerrainQuad.java:611)
	at com.jme3.terrain.geomipmap.TerrainQuad.split(TerrainQuad.java:569)
	at com.jme3.terrain.geomipmap.TerrainQuad.<init>(TerrainQuad.java:223)
	at com.jme3.terrain.geomipmap.TerrainQuad.<init>(TerrainQuad.java:176)
	at com.jme3.terrain.geomipmap.TerrainQuad.<init>(TerrainQuad.java:157)
	at bogie.test.phys.TQTest.main(TQTest.java:24)
:run FAILED

Here’s the absolute minimum to reproduce

    public static void main(String... args){
        HeightMap hm;
        try {
            hm = new HillHeightMap(64,1,16,64);
            hm.load();
            TerrainQuad tq = new TerrainQuad("Quad", 17,65, hm.getHeightMap());
        } catch (Exception ex) {
            Logger.getLogger(TQTest.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }

using 3.2.4 stable
I’ll note that a week ago this wasn’t happening, I am not sure what changed. I tried clearing the netbeans gradle cache at “c:users/user/.gradle/caches” and I am still getting the error after reloading the project.

Possible cause: After digging around I noticed that my gradle buildscript reads

ext.jmeVersion = "3.2.4-stable"
dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.10'
    
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
    compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
    compile "org.jmonkeyengine:jme3-networking:$jmeVersion"
    compile "org.jmonkeyengine:jme3-terrain:$jmeVersion"
    compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
    ...
}

but netbeans is reporting

jme3-core-3.3.0-alpha5.jar

any idea on what is causing this?

This can be closed, I found the solution
ParticleMonkey was forcing the jme version to 3.3, sorry for any confusion

1 Like

But yet issue remains in 3.3?

I think we have that issue also reported here
https://github.com/jMonkeyEngine/jmonkeyengine/pull/1147#issuecomment-544169500

only jme3-core was 3.3, everything else was 3.2.4 so I cannot confirm the issue is inherently 3.3 related. The method was changed but I have not tested anything compiled against.

Ok, just tried your test with both 3.3.0-alpha-5 and master and I could not reproduce that error. So I am changing this topic to SOLVED.

For the record, the issue was mismatched versions. NoSuchMethodException only happens because a method signature changed to something different than compiled code expects. So if A calls B and were compiled together… then later B changes and A is not recompiled also, you get that exception.

From prebuilt libraries, it’s almost always a sign of mismatched versions… and even just reading the title of this post I was all set to start asking which versions of what, etc… But it was already solved. :slight_smile:

2 Likes