[Solved] Sim-Ethereal-1.2.1 and Sim-Math-1.1.1 compatibility issue

Has anyone seen this error before in SiO2 1.1.0 ?

Exception in thread "StateCollectionThread" java.lang.NoSuchMethodError: com.simsilica.mathd.Vec3d.set(Lcom/simsilica/mathd/Vec3d;)V
	at com.simsilica.ethereal.NetworkStateListener.stateChanged(NetworkStateListener.java:345)
	at com.simsilica.ethereal.zone.StateCollector.publish(StateCollector.java:184)
	at com.simsilica.ethereal.zone.StateCollector.publishFrame(StateCollector.java:210)
	at com.simsilica.ethereal.zone.StateCollector.collect(StateCollector.java:246)
	at com.simsilica.ethereal.zone.StateCollector$Runner.run(StateCollector.java:301)

I decided to update from 1.0.3 and got that error. I’ve reported it on github as an issue:

You have to upgrade mathd also. I haven’t pushed another release of SiO2 just for that… sorry.

Do you mean Sim-Math? Do I need to build it locally and gradle install it ? Not sure where to look. I’ve already updated to 1.1.1 of SimMath :slight_smile:

Yes, I meant sim-math. 1.1.1 should be enough. I have projects that seem to build ok without using any of the SNAPSHOT releases.

Also note: your issue is with SimEthereal and not SiO2. They are different things.

Note: there is a SimEthereal 1.2.1… maybe it’s not an issue with moving forward but an issue with trying to use something older?

Else I will need to know what versions of things you are using.

99% sure that the sim-ethereal examples (sim-eth-es, etc.) build “out of the box” now if you want to look at them.

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'groovy'

mainClassName='example.Main'

repositories {
    mavenLocal()
    jcenter()
    maven { url "https://jitpack.io" }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots"}
}

ext.jmeVersion = "[3.1,)" 

project(":assets") {
    apply plugin: "java"
    
    buildDir = rootProject.file("build/assets")
    
    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }    
}


dependencies {
 
    // Need at least basic JME
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
 
    // We definitely want a UI
    //compile "com.simsilica:lemur:[1.8,)"
    compile "com.simsilica:lemur:1.9.1-SNAPSHOT"
    //compile "com.simsilica:lemur-proto:[1.6,)"
    compile "com.simsilica:lemur-proto:1.7.2-SNAPSHOT"

    // And our base code for sim-etheral, SiO2, etc.
    // (many of these need to be built locally and 'gradle install'ed as of this writing)
    compile "com.simsilica:sio2:1.1.0"
    compile "com.simsilica:sim-math:1.1.1"
    //compile "com.simsilica:sim-ethereal:[1.1,)"    
    compile "com.simsilica:sim-ethereal:1.2.1-SNAPSHOT"

    //Mapeditor format support
    compile 'org.mapeditor:libtiled:0.17-SNAPSHOT'
    // Standard utility stuff
    compile 'com.google.guava:guava:19.0'
    compile 'org.slf4j:slf4j-api:1.7.13'
    runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.5'
    
    //HSQLDB
    runtime 'org.hsqldb:hsqldb:2.3.4'
    
    //Groovy
    compile 'org.codehaus.groovy:groovy-all:2.4.7'
    
    runtime project(':assets')    
    
    compile 'junit:junit:4.12'
}

task wrapper(type: Wrapper) {
}

/*
This actually exits immediately since there is no standard input stream
task runServer(type: JavaExec) {
    classpath sourceSets.main.runtimeClasspath
    main = "example.net.server.GameServer"
    jvmArgs '-Dlog4j.configurationFile=server-log4j2.xml'
}
*/

// Create a custom server start script in the distribution
task serverStartScript(type: CreateStartScripts) {
    mainClassName = "example.net.server.GameServer"
    applicationName = "server"
    outputDir = new File(project.buildDir, 'scripts')
    classpath = jar.outputs.files + project.configurations.runtime
    defaultJvmOpts = ['-Dlog4j.configurationFile=server-log4j2.xml']
}


/*applicationDistribution.into("bin") {
    from(serverStartScript)
    fileMode = 0755
}*/

// I think this is ultimately clearer than the above
distributions {
    main {
        contents {
            from(serverStartScript) {
                into "bin"
            }
        }
    }
}

// Either way we end up with dupes if we don't do this
distZip {
    duplicatesStrategy = 'exclude'
}

I’ve also tried with

// And our base code for sim-etheral, SiO2, etc.
// (many of these need to be built locally and 'gradle install'ed as of this writing)
compile "com.simsilica:sio2:1.1.0"
compile "com.simsilica:sim-math:1.1.1"
//compile "com.simsilica:sim-ethereal:[1.1,)"    
compile "com.simsilica:sim-ethereal:1.2.1"

The Vec3d.class I’m seeing in my dependencies (inside the sim-math-1.1.2.jar) is revision 3951 (same as on github).

This is the line that throws the error. When I deep dive into it, the method is there and the vec3d.class has the method as indicated.

Some version of some library may still be expecting the void set() version of the method. I’m not sure.

It seems like you are using the latest versions of everything:

Not sure why stuff depending on this builds for me but maybe I will try it on a clean machine tonight.

In the sim-eth-es example project, I’ve attempted to upgrade the libraries to the latest version until something broke.

I got as far as this:

…everything but sim-math was upgraded just fine. That build file works for me.

I did a dependencyreport in html and can see that Sim-Ethereal-1.2.1 depends on Sim-Math-1.0.2 and not Sim-Math-1.1.1. Gradle resolves this with the newest version, so if the error happens through reflection, could this be the source of the error?

I can see that you did this commit:

after the release of Sim-Ethereal-1.2.1, so it wouldn’t be in the release. (I registered it as a serializable class in my game though to get around that issue).

Just digging

If I go with

compile "com.simsilica:sim-ethereal:1.2.2-SNAPSHOT"

then it works. The commit earlier mentioned is also where you change the dependency from sim-math-1.0.2 to sim-math-1.1.1

So right now I have:

// And our base code for sim-etheral, SiO2, etc.
// (many of these need to be built locally and 'gradle install'ed as of this writing)
compile "com.simsilica:sio2:1.1.0"
compile "com.simsilica:sim-math:1.1.1"
compile "com.simsilica:sim-ethereal:1.2.2-SNAPSHOT"

It shouldn’t do this automatically unless something is depending on the bracketed version and not the specific version.

I checked out sim-eth-es on a system that has never built any JME-related or Sim-related code ever before… and was able to compile and run with the build.gradle currently checked in for sim-eth-es. The only difference was that I depend on a slightly older version of sim-math.

So is there a reason you depend on the newer sim-math?

I had the same issue,

The reason was next:
I had the sim-eth-es example project with older sim-math lib.
I planned to add mphys lib. and it depends on newer version of sim-math.
Since sim-tool is taken from local repositories, Sim-math update starts versions conflict.
as the result, old versions were used.

Nope. I just prefer to stay updated. I think if Gradle encounters a lib that is to be loaded multiple times in different versions, it takes the newer version by default (i dont know gradle very well though).

And as I wrote, I can get it work as well if I choose the older Sim-Math-1.0.2, so we are aligned there.

What is the mphys lib?

Yes, it uses the newest version specified.

It is @pspeed 's physic library. He drop it somewhere on WIP threads.

I haven’t published it yet. I think I made a demo people could run that included it but if you try to use it then it’s still in a “use at your own risk” sort of state.