How do I investigate and resolve HTTP status 500 errors?

Asked 2 years ago, Updated 2 years ago, 74 views

I have little experience with Java.
I looked at the log just below Apache Tomcat/6.0.20, but there seems to be nothing wrong.
Could you tell me how to resolve the error below?

HTTP Status

500 -

type exception report message

description

The server encountered an internal error() that preempted it from filling this request.

Exception

java.lang.StringIndexOutOfBoundsException: String index out of range:-9
java.lang.String.substring (String.java:1938)
java.lang.String.substring (String.java:1905)
pds. document.provider.PosFile.parseTag (PosFile.java:104)
pds.document.provider.PatentDocument.init (PatentDocument.java:66)
pds.servlet.ShowPatentDocument.showPatentDocumentImpl (ShowPatentDocument.java:116)
pds.servlet.ShowPatentDocument.doPost (ShowPatentDocument.java:74)
pds.servlet.ShowPatentDocument.doGet (ShowPatentDocument.java:38)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Note

All stack traces of the cause are logged in Apache Tomcat/6.0.20

java apache tomcat

2022-09-30 19:32

4 Answers

When using Tomcat, the HTTP status 500 error is usually either a bug in the deployed web app or some configuration is incorrect.

The output log needs to be parsed to know the specific cause.
The stack traces for this question should include:

java.lang.StringIndexOutOfBoundsException: String index out of range:-9
java.lang.String.substring (String.java:1938)
 :
pds. document.provider.PosFile.parseTag (PosFile.java:104)
pds.document.provider.PatentDocument.init (PatentDocument.java:66)

The direct cause of the error is

java.lang.StringIndexOutOfBoundsException: String index out of range:-9
java.lang.String.substring (String.java:1938)

As you can see, when you try to reference the string with substring(), you specify a negative value.
Java API String substring

Now, where did you specify a negative value?

pds. document.provider.PosFile.parseTag (PosFile.java:104)

The 104th line of PosFile.java is likely.
Perhaps there is some bug in the PosFile.parseTag() method.Or the argument passed to the parseTag() method is incorrect.You can't tell the details until you look at the relevant source.
The pos file itself may not meet the conventions and standards that should be met, as it seems to be analyzing the contents of the pos file from the class name and method name.

For more information on how to view stack traces, please refer to the following links:


2022-09-30 19:32

Please contact your manufacturer's support representative as this error appears to be caused by the use of some software product.


2022-09-30 19:32

If you can't modify the application after using it for a long time, there is a possibility that there is a problem with how to use it.You can infer from the stack trace information that the number of characters entered is too short or that the subscripts are calculated incorrectly.

If this error is reproducible, compare the abnormal and normal data and
You may find out if there is anything different from the usual usage.

Also, did you lose the only one that has JAR?
Or are you not authorized to access the source code?
I think it would be better to check that area and contact the owner of the product.


2022-09-30 19:32

The comment says that there is only jar, but
If you are running an application in Tomcat, you will always find a folder in the directory below with the application war expanded.
There is a high possibility that war files exist before deployment.

$tomcat_home/webapps

If the tomcat directory is Apache Tomcat/6.0.20, it should be the following directory.
Apache Tomcat/6.0.20/webapps

Also, there is one thing that bothered me.
"The question says ""I saw the log just below Apache Tomcat/6.0.20"", but
" Typically, Tomcat logs are printed in the following directory with the filename catalina.out.
$tomcat_home/logs

Apache Tomcat/6.0.20/logs/catalina.out
Do you have a file called


2022-09-30 19:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.