"No SPI found for operator name" when trying an example plugin

I have a problem with developing plugins in Python and Java.
After building and installing the plugins supplied as examples, when trying to launch them, the following exception occurs:

java.lang.IllegalArgumentException: No SPI found for operator name 'MyOp'
	at org.esa.snap.core.gpf.ui.DefaultSingleTargetProductDialog.<init>(DefaultSingleTargetProductDialog.java:78)
	...

This happens for both the Java and the Python example operator plugins.
(Actually, the Python plugin works as long as no other example plugins are installed).

I have downloaded the code for the examples from https://github.com/senbox-org/snap-examples/archive/master.zip .
I used NetBeans 8.1 to build the plugins. I used the IDE “Build” command, which launched the Maven build and produced the .nbm file in the “Target” folder.
I have tried with both the binary version of SNAP Desktop (4.1.0) and one I built from the current sources (5.0.0).

error1

Is this a known problem, or am I doing something wrong?

Answered in https://github.com/senbox-org/snap-engine/issues/65

I am experiencing the same issue now, but the provided github link is unfortunately not available. Could someone please provide some information on this?
Thank you

Can you tell a bit more?
I assume you have configured snap to use python.
Have you followed the Guide What to consider when writing an Operator in Python

Do you get the same error for the defaul NDVI example?
Maybe you need to edit the META-INF/services/org.esa.snap.python.gpf.PyOperatorSpi file and enter the name of your operator.

Yes, the issues in github have been closed to limit the number of sources where issue reports come from.

My problem is actually with Java Operator, not python.

I have downloaded the template https://github.com/senbox-org/snap-examples/tree/master/snap-engine-java-operator, built it and add to SNAP as plugin. It appears in the menu and it could be added to Graph Builder as a tool. So far everything looks good.

After that I have copied the project, make modification, like plugin name, tool name, and implementing my own tool login, debugged it with unit tests and build Maven package.

After that I went to SNAP, uninstall the template plugin, restarted SNAP, removed template plugin from downloaded plugins and install my customized plugin. Installation run without errors, I could see my operator in menu, but I could not see it in Graph Builder tools. When I click it in the menu, the error appers - java.lang.IllegalArgumentException: No SPI found for operator name 'TestOperator'

So far I would guess, that something went wrong with my customization. But strangely, when I try to uninstall my plugin, restart, etc., and install back the plugin template I have got exactly the same error, except the operator name is ‘MyOp’, which is operator name in template.

In this case please check:
If the annotation @OperatorMetadata has the correct alias, and that this is also used in the layer.xml for the action definition as value for the attribute operatorName.
Check also that the file META-INF/services/org.esa.snap.core.gpf.OperatorSpi contains the correct reference to your SPI.

If this does not help, please share your code

I have checked the files you mentioned, but I couldn’t see anything wrong there. If you wouldn’t mind to have a look on my code, I would be very grateful.

Here it is:
snap-engine-java-operator.zip (50.8 KB)

I’ve built your project and installed without changes (I only disabled the tests) and it works:

Could be that something went wrong wen uninstalling the first test plugin.
Delete the folder SNAP module update related directories in appdata.
I’ve explained it here.


Afterwards you will need to install other updates again but your plugin should work.

For an easier development cycle and not needing to install the plugin after every change you can follow this guide:
How to develop an extension module - SNAP - SNAP Wiki (atlassian.net)

It tells you how you can make a SNAP installation pickup your project output.

I have done everything suggested, but it did not work. I have also went through this multiple times with machine restarts and manual file deleting with no success.

After all that I realized that every time I got that error message I am trying to uninstall that plugin and try it again. So I have tried to ignore the error, restart snap and try to check that operator in menu again and to my surprise (and joy) it worked. I was able to run it from the menu and add it to graph builder as well. No error complaints. So I guess that it just needed application restart after plugin installation. Hard won knowledge :-).

Anyway, thank you very much for your help and suggestions. I will definitely give a try to that debugging suggestion.

1 Like