java.lang.NullPointerException at Slice Assembly


#1

I was calling my python code for 2017 S1 data, and it worked fine. Then I started doing it for 2018 and it did well for first few months but then it started to have this problem:

target_4 = GPF.createProduct(“SliceAssembly”, parameters, products)
RuntimeError: org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException

The strange thing is that when I do the call in PyCharm it works fine, but when I call the batch file in Anaconda prompt I started getting this error.
I created batch file because I had memory problems when processing many images; this way I was doing it one at a time. I used this batch call already for successfully processed 2017 and 2018 data. I wonder what has happened because no change was made. Any solution, any idea?


#2

Still having this issue!
Additional information is that the single call in Anaconda prompt is doing fine, like the call in PyCharm.
But the batch call in Anaconda is throwing error, although in the past it was working fine with batch as well.
No changes were made in the code however.


#3

Hey, I may have a work-around for your memory problems.


#4

Hey, thanks, but I am not sure I am getting it.
Can you make a parallel between the two? What do you suggest to try?


#5

Parallel post:

had a solution for me.


#6

Didn’t work for me, but thanks.


#7

Did the updating of SNAP6.0 not work?


#8

I tried with >> snap64 --nosplash --nogui --modules --update-all
and also to update in SNAP GUI.
Is there any other way to try to update?


#9

If you are already on the version 6 track, these are the right ways to update the installation.
Only if you are still on version 5, then you need to reinstall SNAP. But I think you use since quite some time version 6. So you have the most recent version if nothing comes in.

But the problem you have described initially sounds like a problem with the environment settings. Maybe you have two SNAP installation one is used from PyCharm and the other from the command line. Might also depend on which Anaconda environment is activated. Maybe there is an old environment active?
However, a NullPointerException is always the fault of the developer and not of the user.
Unfortunately, the exception output from with snappy is not satisfying and does not allow identifying where the exception happens.
Could you adjust the debug property in the snappy.ini.
Set it to True and remove the comment char.
–> debug: True
Maybe the output will be more helpful in this case.


#10

Here is the new output:

Invalid maximum heap size: -Xmx11G
debug: True
Traceback (most recent call last):
File “C:\Users\Milos\PycharmProjects\SAR\SAR_process_all.py”, line 1, in
import snappy
File “C:\Users\Milos\Anaconda3\envs\SAR\lib\site-packages\snappy_init_.py”, line 235, in
jpy.create_jvm(options=_get_snap_jvm_options())
RuntimeError: jpy: failed to create Java VM

Strange for me is that exactly the same code is working perfectly fine with 2017 data. I take care when selecting and processing the appropriate environment, in this case called “SAR”.


#11

Now, something with the snappy.ini seems to be wrong.
That’s strange.
“Invalid maximum heap size” means that you can’t use 11 Gigs as memory.
Do you have less?


#12

I got 16 GB RAM on my computer.

Edited:
Having this changed in snappy.ini (debug: True), code is not working in PyCharm either. It gives the same error about Java VM.
Commenting it out again, code is working as before in PyCharm.


#13

That’s what I thought., that you have 16GB.
Is maybe the formatting of the file screwed up?

Sorry, it’s just wild guessing.
I’ve no clue.