orbisgis / geoclimate

Geospatial processing toolbox for environmental and climate studies
GNU Lesser General Public License v3.0
59 stars 15 forks source link

Issue using GeoClimate in an other IntelliJ project #966

Closed j3r3m1 closed 2 months ago

j3r3m1 commented 2 months ago

I am currently using the last snapshot of geoclimate in an IntelliJ project and I am facing a strange issue.

When I run the code I have developped which call the WorkflowGeoindicator function, I am facing the following issue when the code runs the typeProportion function (https://github.com/orbisgis/geoclimate/blob/68082073e8dbed6f71d9477dbc33ebbc4a76fb9d/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/WorkflowGeoIndicators.groovy#L594). The error happen at this line in the function (https://github.com/orbisgis/geoclimate/blob/68082073e8dbed6f71d9477dbc33ebbc4a76fb9d/geoindicators/src/main/groovy/org/orbisgis/geoclimate/geoindicators/GenericIndicators.groovy#L717).

The error log is the following:

Caught: java.lang.NoSuchMethodError: 'java.util.List org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createRange(java.lang.Object, java.lang.Object, boolean, boolean)'
java.lang.NoSuchMethodError: 'java.util.List org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createRange(java.lang.Object, java.lang.Object, boolean, boolean)'
    at org.orbisgis.geoclimate.geoindicators.GenericIndicators.typeProportion(GenericIndicators.groovy:720)
    at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators.computeRSUIndicators(WorkflowGeoIndicators.groovy:596)
    at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators.computeGeoclimateIndicators(WorkflowGeoIndicators.groovy:1693)
    at org.orbisgis.geoclimate.geoindicators.WorkflowGeoIndicators.computeAllGeoIndicators(WorkflowGeoIndicators.groovy:1498)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.orbisgis.geoclimate.geoindicators.Main$_main_closure1.doCall(Main.groovy:60)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.orbisgis.data.jdbc.JdbcDataSource.eachRow(JdbcDataSource.java:522)
    at org.orbisgis.data.jdbc.JdbcDataSource$eachRow.call(Unknown Source)
    at org.orbisgis.geoclimate.geoindicators.Main.main(Main.groovy:51)
    at org.orbisgis.geoclimate.geoindicators.Main$main.callStatic(Unknown Source)
    at org.orbisgis.geoclimate.geoindicators.Main.run(Main.groovy:20)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Any idea what can be the source of the error ? If I debug and execute the line in an "evaluate expression" field it seems to work properly. Same if I run it in a SQL query within DBeaver and same when I isolate a test for the typeProportion function.

To test the problem, here are:

j3r3m1 commented 2 months ago

@Jukjuk-boop just as you know that the project has been started but still meets some bugs @ebocher if you have any idea

ebocher commented 2 months ago

Tested on my side it returns

Caught: org.h2.jdbc.JdbcSQLSyntaxErrorException: Duplication du nom de colonnes "ID_RSU"
Duplicate column name "ID_RSU"; SQL statement:
  DROP TABLE IF EXISTS building_rsu2_rsu_join [42121-224]
org.h2.jdbc.JdbcSQLSyntaxErrorException: Duplication du nom de colonnes "ID_RSU"
Duplicate column name "ID_RSU"; SQL statement:
j3r3m1 commented 2 months ago

OK solved with an update of the pom (probably some Java dependency troubles...)

Jukjuk-boop commented 1 month ago

I tried to use your groovy script but i'm stuck on an issue : image

I'm on windows 10, I installed WSL (windows subsysteme for linux) and SDK. My java version is 21.0.3 and groovy is 4.0.17.

In the Main.groovy script I modified the path as asked : image

I must have done something wrong as I'm not used to work with cmd, sdk or other programing tools.

j3r3m1 commented 1 month ago

Did you install WSL for a specific purpose ? Because you can directly use your windows machine to run the script. It seems the path you put are "linux-written" while it should be windows. First try replacing your / by \ and if not sufficient you can use the double \ version (\).