Report this

What is the reason for this report?

Java EE encounters a strange error during operation

Posted on July 31, 2025

1.Server environment 1.1JDK1.8 1.2Tomcat9 1.3Ubuntu 20.04.6 LTS 2 Problem screenshot 2.1.Screenshot of the API call system error log is shown in Figure 1

image alt text http://static.haou8.cn/question_1.png Figure 1 error log of system 2.2 Erroneous program code is shown in Figure 2

image alt text http://static.haou8.cn/question_2.png Figure 2 error of program

3 Questions 3.1 Description of problem In Figure 2, there are no issues with the program code on line 372 (checking if JSON is empty) and line 376 (executing normally if JSON is not empty), but there is an error on line 392 (JSON object is empty). Could you please tell me the reason for the error. 3.2 Cause of program exception The JSON object is released when the program executes to line 392.

3.3 Problem? Please analyze the reasons for this issue from the perspective of server operation and maintenance。



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey!

Looks like your JSON object is getting released or set to null somewhere between line 376 and 392. If that JSON is shared across threads (like a class-level or static variable), it’s possible another request or thread is overwriting or clearing it.

Also worth checking if you’re hitting memory pressure or GC is aggressively cleaning up under load, especially if the object isn’t strongly referenced.

Make sure the JSON object is scoped to the current request and not reused across threads. If it’s already request-scoped, try logging the object or its hash at different points to see where it changes.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.