I’ve been using a java maven project I developed in NetBeans which calls on the operators I need from SNAP and S1TBX to do the processing I need. I usually run it from the IDE with no problems, but I’m trying to use it on another computer (specifically a HPC system).
The program is here : https://gitlab.com/sdufourbeausejour/java-snap , in branch AddMultiTemporalClassif.
I’ve succeeded in building a jar file containing all dependencies by adding the maven-assembly-plugin to the pom file.
All operations which run on librairies like java.io or java.utils succeed, as well as reading a .dim product, but we run into a problem with the first call to CreateProduct :
$ java -jar java-snap-jar-with-dependencies.jar "input.txt" Input
... (info on the products that have been read)
Exception in thread "main" org.esa.snap.core.gpf.OperatorException : Unkown operator 'Subset'. Note that operator aliases are case-sensitive.
Your help would be greatly appreciated, I’m participating in a hackathon and hope to get it working before tomorrow !
I fixed this by adding references to all the SNAP operators I use in my project’s META-INF.services/org.esa.snap.core.gpf.OperatorSpi file :
I hope this can be of use to someone !
Good to hear that you found a solution, though this does not look like the ideal way. I’ve seen that you do not have a dependency to snap-gpf set. Maybe including it would fix the problem, too.
Thank you for your answer !
I tried to use your solution. SNAP GPF is already included as a dependency in the project; it is listed under the Dependency folder in Netbeans. However, it doesn’t appear in the pom.xml (why ?). So I added it like this :
and removed the lines I had added to the MAIN-INF.services/org.esa.snap.core.gpf.OperatorSpi file.
This configuration gives me the same error as before.
I’d be eager to correct it properly, particulary since I’m running into other issues that may be caused by the same fundamental missing link.
Any suggestion ?
The problem here seems to be mainly maven-related. You could try to set up a descriptor ( https://maven.apache.org/guides/mini/guide-assemblies.html ) or have a look at this solution: https://stackoverflow.com/a/4323501 .
Thank you for your help @TonioF, I’ve got it working now. I used the maven-dependency-plugin with the maven-jar-plugin; I chose to have a light executable jar with all the dependencies in a lib/ directory. This post shows a relevent excerpt from my pom.xml file. I only kept the two lines referencing my new operators in my OperatorSpi file. The complete files can be found in the project on gitlab.
Good to hear, thanks for sharing your solution!