The invention discloses an LLM
root cause analysis method and
system based on a
Java exception stack chain, and the method comprises the following steps: S1, collecting a
Java exception log in real time, and extracting the key information of the stack chain; s2, obtaining a corresponding
code snippet through a GitLab API (Application Program Interface) according to a file path and a line number analyzed by the
Java exception log; s3, performing
root cause analysis by using LLM to generate a
root cause analysis report and a repair suggestion; s4, performing report structured display on the
root cause analysis report, the code snippets and the repair suggestions, and pushing the results to the problem owners through the enterprise
collaboration tool
robot; and S5, realizing abnormal
noise reduction by using a time window de-duplication
algorithm, configuring an alarm white
list, and counting a frequency trend to realize risk pre-judgment. The method is suitable for online anomaly positioning, root cause diagnosis and repair guidance of the distributed Java application, root cause positioning can be completed and repair suggestions can be pushed within one minute after the anomaly occurs, and the research, development, operation and maintenance efficiency is remarkably improved.