Sen2cor RuntimeError: java.lang.NullPointerException

Hello,

I am trying to apply the sen2cor operator to Sentinel-2 L1C data in snappy. The process starts well until “Progress[%]: 50.93 : PID-9728, L2A_Tables: stop export, elapsed time[s]: 0.764, total: 1:12:00.783000”. Then I get the following error:

INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Syntax error in metadata, see report file for details.
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Parsing error:
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-2A_Tile_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Details: Element ‘PVI_FILENAME’: This element is not expected. Expected is ( L2A_Pixel_Level_QI ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-2A_Tile_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-2A_Tile_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 121 Details: Element ‘PVI_FILENAME’: This element is not expected. Expected is ( L2A_Pixel_Level_QI ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 121 Details: Element ‘PVI_FILENAME’: This element is not expected. Expected is ( L2A_Pixel_Level_QI ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Syntax error in metadata, see report file for details.
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_User_Product_Level-2A_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_User_Product_Level-2A_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 121 Details: Element ‘FORMAT_CORRECTNESS_FLAG’: This element is not expected. Expected is ( SENSOR_QUALITY_FLAG ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 121 Details: Element ‘FORMAT_CORRECTNESS_FLAG’: This element is not expected. Expected is ( SENSOR_QUALITY_FLAG ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Parsing error:
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_User_Product_Level-2A_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Details: Element ‘FORMAT_CORRECTNESS_FLAG’: This element is not expected. Expected is ( SENSOR_QUALITY_FLAG ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Syntax error in metadata, see report file for details.
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-2A_Datastrip_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-2A_Datastrip_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 121 Details: Element ‘Image_Display_Order’: This element is not expected. Expected is ( Spectral_Information_List ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: [ERROR] L2A_XmlParse: 121 Details: Element ‘Image_Display_Order’: This element is not expected. Expected is ( Spectral_Information_List ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Parsing error:
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema\S2_PDI_Level-2A_Datastrip_Metadata.xsd
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Details: Element ‘Image_Display_Order’: This element is not expected. Expected is ( Spectral_Information_List ).
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Progress[%]: 100.00 : Application terminated successfully.
INFO: org.esa.snap.core.gpf.operators.tooladapter.DefaultOutputConsumer: Finished tool execution in 1323 seconds
Traceback (most recent call last):
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\ptvsd_launcher.py”, line 45, in
main(ptvsdArgs)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_main_.py”, line 265, in main
wait=args.wait)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_main_.py”, line 258, in handle_args
debug_main(addr, name, kind, *extra, **kwargs)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_local.py”, line 45, in debug_main
run_file(address, name, *extra, **kwargs)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_local.py”, line 79, in run_file
run(argv, addr, **kwargs)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_local.py”, line 140, in _run
_pydevd.main()
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_vendored\pydevd\pydevd.py”, line 1934, in main
globals = debugger.run(setup[‘file’], None, None, is_module)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_vendored\pydevd\pydevd.py”, line 1283, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_vendored\pydevd\pydevd.py”, line 1290, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File “c:\Users\Student.vscode\extensions\ms-python.python-2018.12.1\pythonFiles\lib\python\ptvsd_vendored\pydevd_pydev_imps_pydev_execfile.py”, line 25, in execfile
exec(compile(contents+"\n", file, ‘exec’), glob, loc)
File “d:\Emma_Data\thesis\scripts\cloudmasking.py”, line 78, in
product=sen2cor(product) #enable this to run sen2cor athmospheric correction
File “d:\Emma_Data\thesis\scripts\cloudmasking.py”, line 55, in sen2cor
sen2cor_prod=GPF.createProduct(‘Sen2Cor’, parameters, product)
RuntimeError: java.lang.NullPointerException

Can anyone help me please? I went through this and other forums but I can not find a solution. :frowning:

Thank You!

1 Like

I’m having similar issue while running bare sen2cor process using Python:

|—Progress[%]: 11.65 : PID-32112, L2A_Tables: band WVP exported, elapsed time[s]: 74.085, total: 1:47:52.877987
|—Progress[%]: 19.72 : PID-32112, L2A_Tables: band TCI exported, elapsed time[s]: 141.048, total: 1:50:13.925817
|—Progress[%]: 19.73 : PID-32112, L2A_Tables: stop export, elapsed time[s]: 0.550, total: 1:50:14.476092
|—Syntax error in metadata, see report file for details.
|—[ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema/S2_PDI_Level-2A_Tile_Metadata.xsd
|—[ERROR] L2A_XmlParse: 120 Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema/S2_PDI_Level-2A_Tile_Metadata.xsd
|—[ERROR] L2A_XmlParse: 121 Details: Element ‘PVI_FILENAME’: This element is not expected. Expected is ( L2A_Pixel_Level_QI ).
|—[ERROR] L2A_XmlParse: 121 Details: Element ‘PVI_FILENAME’: This element is not expected. Expected is ( L2A_Pixel_Level_QI ).
|—Parsing error:
|—Schema file: S2-PDGS-TAS-DI-PSD-V14.2_Schema/S2_PDI_Level-2A_Tile_Metadata.xsd
|—Details: Element ‘PVI_FILENAME’: This element is not expected. Expected is ( L2A_Pixel_Level_QI ).
|—Progress[%]: 100.00 : Application terminated successfully.

Hello aedhu,

I recommend you running Sen2Cor outside SNAP. If it is running there, then it is a problem of SNAP. I also get sometimes a java…NullPointerException using SNAP displaying data. If it is not running outside SNAP, then the Null-Pointer message can be caused by the error in Sen2Cor. But then we have a more detailed error message to locate the problem.

Hello lgbkb,

did you already tried running another product?