Unified processing method and system for abnormity of platform system

By building a unified exception handling framework for the platform system and utilizing global exception handlers and XML configuration files, the problem of decentralized exception handling in the software system is solved, unified management and rapid location of exception information are achieved, maintenance costs are reduced, and the flexibility and adaptability of the system are enhanced.

CN120631684AInactive Publication Date: 2025-09-12SHANDONG INSPUR CLOUD GOVERNMENT INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510690825.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing technology, exception handling of software systems is scattered among various modules and lacks a centralized management and response mechanism, which makes it difficult for developers to quickly locate and solve problems, increasing maintenance costs.

Method used

Build a unified exception handling framework for the platform system, capture and handle all exceptions through the global exception handler class, combine XML configuration files and exception libraries to achieve centralized monitoring and classified processing of exceptions, support dynamic updates, and provide clear feedback and logging.

Benefits of technology

It realizes the unified management and rapid location of abnormal information, reduces maintenance costs, enhances the flexibility and adaptability of the system, and ensures the accuracy and consistency of abnormal information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631684A_ABST
    Figure CN120631684A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software engineering, in particular to a platform system exception unified processing method and system.The method comprises the following steps that a platform exception rendering page is formulated, a unified exception page is customized according to common exceptions in a platform, a series of friendly prompts of different language versions corresponding to common HTTP state codes are preset, and the exception rendering page is obtained; the processing scheme of the common exceptions is displayed; the method has the beneficial effects that through a Spring Boot global capture mechanism, the exceptions thrown by the Controller control layer are captured, uniform exception output is formed, and a public module is abstracted to serve each application system. The abnormal page is formulated according to a business scene and can be customized through a configuration file to adapt to different requirements. And the exception library is stored by adopting an XML configuration file or a database, so that centralized management is realized. The global exception processor class captures and processes system exceptions and displays exception information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and in particular to a method and system for unified processing of platform system exceptions. Background Art

[0002] With the development of internet technology, users' expectations for software systems are growing, demanding not only comprehensive functionality but also smooth usability. Any unhandled exceptions can negatively impact user experience and even cause business interruptions. Traditionally, exception handling has been decentralized across modules, lacking a centralized management and response mechanism. This makes it difficult for developers to quickly identify and resolve issues, increasing maintenance costs. Therefore, establishing a comprehensive and manageable exception handling mechanism is essential. Summary of the Invention

[0003] The present invention aims to provide a method and system for unified platform system exception handling, aiming to build a complete platform system exception handling framework that centrally monitors and categorizes all exceptions, providing clear user feedback. Furthermore, the framework supports dynamic updates to the exception library without requiring application restarts, further enhancing the system's flexibility and adaptability. This approach addresses the issues raised in the background art above.

[0004] To achieve the above objectives, the present invention provides the following technical solution: a method for uniformly handling platform system anomalies, comprising the following steps:

[0005] Develop platform exception rendering pages, customize unified exception pages based on common exceptions in the platform, preset friendly prompts in different languages ​​corresponding to a series of common HTTP status codes, and display solutions for common exceptions;

[0006] Develop a common platform exception library, sort out the problems often encountered in platform system applications, formulate exception codes and exception information according to certain rules, and use XML configuration files to uniformly define exception codes, exception information, log levels, exception descriptions and solutions, so as to achieve real-time updates of the exception library;

[0007] Exception handling class development: Create a global exception handler class that implements the HandlerExceptionResolver interface to capture and handle all exceptions that occur in the system, and perform different processing logic based on the exception type.

[0008] Exception capture and throwing: In the business logic code, an exception is thrown by calling a predefined exception throwing method. The global exception handler class is responsible for capturing and handling the exception.

[0009] Record the logs and print the abnormal information for analysis by operation and maintenance personnel.

[0010] Preferably, in the platform exception rendering page formulation step, the customized unified exception page is placed in the common module, and each application system uniformly references it. When an exception occurs, the exception response style of each system remains unified, and the page content is customized through the configuration file to adapt to different customer needs.

[0011] Preferably, in the step of formulating the platform common problem exception library, an XML configuration file is used for centralized management. <xxx-exception>A tag represents a specific exception, including the exception code and exception information visible on the front end; the log level, exception description, and solution visible in the log, making it easy for developers to quickly find and modify exception information while ensuring the accuracy and consistency of exception information.

[0012] Preferably, in the exception handling class formulation step, the global exception handler class jumps to the specified error page according to the exception type in the resolveException method, adds the exception information to the ModelAndView object for display on the front-end page, obtains the parameters of the request through HttpServletRequest and processes them, obtains the object from the exception Exception to obtain the exception information and processes it and passes it to the page for display, and prints out the complete information on the back end for operation and maintenance personnel to troubleshoot the problem.

[0013] Preferably, in the exception capture and throwing steps, an XXXExceptionRepository class is created in the business logic code to parse the exception library XML file, and a predefined exception is thrown by calling the XXXExceptionRepository.getXXXException("system-01001").exception() method. When the exception is thrown, the global exception handler class is responsible for capturing and handling the exception, jumping to the corresponding error page according to the exception type, and displaying the exception information.

[0014] A system for a unified platform system exception handling method, comprising:

[0015] The subsystem exception capture module implements local exception capture logic for independent service units under the microservice architecture, distinguishes custom exceptions from system-level exceptions, and forwards them to the global processor;

[0016] The global exception capture module implements an exception interceptor based on the middleware pattern, displays the corresponding user interface according to different types of exceptions, and generates a detailed log entry for each captured exception;

[0017] The exception library module uses XML to store exception records to ensure data consistency and accessibility. Each exception record contains the error code, message text, severity indicator, detailed description and recommended measures. It uses hot loading technology to enable newly added or modified exception rules to take effect immediately during operation.

[0018] Exception library parsing module, develops service classes specifically for managing and querying exception information, and creates exception entity classes to encapsulate all necessary attributes;

[0019] The exception logging module adopts an asynchronous logging strategy to ensure stable performance in high-concurrency scenarios. It saves logs into a dedicated log folder and separates them by date.

[0020] The exception page response module presets a series of friendly prompts in different languages ​​corresponding to common HTTP status codes, allowing administrators to adjust the prompt content through configuration files.

[0021] Preferably, the global exception capture module uses springboot to define the HandlerExceptionResolver interface. By implementing this interface, exceptions thrown by all control layers in the application can be intercepted. This module is implemented as a public module and packaged into a JAR file and uploaded to the Maven repository for use by various application modules.

[0022] Preferably, the exception library module defines a <xxx-exceptions>Total tags, each <xxx-exception>A tag represents a specific exception, including the exception code and exception information visible to the front end; the log level, exception description, and solution visible to the log.

[0023] Preferably, the exception library parsing module uses a DOM parser or SAX parser in Java, or uses a third-party library such as JAXB to map the XML exception library to a Java object, so as to simplify the process of developers finding specific exceptions and facilitate the internal transmission and use of exception information in the program.

[0024] Preferably, the exception logging module uses a log framework to record exception information. When an exception is captured, the exception description information and exception stack information are recorded by calling the error log method of the logger;

[0025] The exception page response module uses FreeMarker to define the exception page as a template file, and uses webjar to package the page as a static resource into a JAR file and upload it to the Maven repository for use by various application modules. It can also realize the personalized needs of different project scenarios through internationalization configuration.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The platform system exception unified processing method and system proposed in the present invention captures the exceptions thrown by the Controller control layer through the Spring Boot global capture mechanism, forms a unified exception output, and abstracts the common modules to serve each application system. The exception page is formulated according to the business scenario and can be customized through the configuration file to meet different needs. The exception library adopts XML configuration files or database storage to realize centralized management. The global exception handler class captures and processes system exceptions and displays exception information. The device includes exception page acquisition, global exception capture, exception library, exception library parsing, subsystem exception capture and exception log recording modules to realize unified management, parsing, capture and logging of exception information. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 Flow chart of the method of the present invention;

[0029] Figure 2 This is a system block diagram of the present invention. DETAILED DESCRIPTION

[0030] In order to clearly and completely describe the objectives and technical solutions of the present invention and make the advantages more clearly understood, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are part of the embodiments of the present invention, not all of them, and are only used to explain the embodiments of the present invention, not to limit the embodiments of the present invention. All other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0031] For example 1, please refer to Figure 1 The present invention provides a technical solution: a method for uniformly handling platform system exceptions, comprising the following steps:

[0032] S01, platform abnormal rendering page formulation

[0033] S02, establish a common problem exception database for the platform and implement real-time updates of the exception database

[0034] S03, exception handling class development, can capture global exceptions in the system

[0035] S04, exception capture and throwing

[0036] S05, record the log

[0037] The disclosed embodiments provide a method and apparatus for unified platform system exception handling. Because Spring is a relatively mature architectural concept within Java programming, this solution leverages Spring Boot's global capture mechanism to capture exceptions thrown by the controller layer. By defining and categorizing exceptions, a unified exception output is generated. Common modules are abstracted to serve various application systems within the platform. XML (Extensible Markup Language) custom tags and content are used to record common exceptions.

[0038] In S01, a unified exception page can be customized based on common exceptions in the platform. This can be placed in a common module and referenced uniformly by all application systems, ensuring a consistent response style across all systems when an exception occurs. Specifically, friendly prompts in different languages ​​corresponding to a series of common HTTP status codes can be preset. Page content can be customized through configuration files to meet diverse customer needs. Solutions for common exceptions can also be displayed, whether as a link, a line of text, or a file.

[0039] In S02, a custom common exception library was created. First, common issues encountered in platform system applications were identified, and exception codes and messages were defined using specific rules. An XML configuration file was used to uniformly define exception codes, messages, log levels, descriptions, and solutions. This centralized management approach facilitated rapid retrieval and modification of exception information, while ensuring its accuracy and consistency. Dynamic loading and display were achieved through the use of this static resource.

[0040] In S03, a global exception handler class is created to capture and handle exceptions that occur in the system. This top-level exception handler captures and handles exceptions that occur in the system. Exceptions thrown outwards by submodules after capture, as well as uncaught exceptions, are all captured by this global exception handler. Exceptions are then categorized and processed using exception detection, locating the page for each exception type and returning processed exception information to the page. Logs can also be printed for analysis by operations and maintenance personnel.

[0041] In S04, common errors in each subsystem of the platform are captured using try / catch, generating status codes and exception information, which are then thrown to the global exception capture mechanism or returned to the front-end. Common errors are summarized and enriched in the exception library.

[0042] In some embodiments, the platform exception rendering page formulation can include common http exceptions such as 404 (resource not found), 403 (server understands the request, but refuses to execute), 500 (system internal error), etc.; it can also include some exception errors customized by the application itself; and render them in different styles to give users an intuitive feeling. The display of exception information content can be made in the form of variables. After processing in the background, it is returned to the front end. FreeMarker (template engine) can be used, and marked as a variable through the ${} symbol. For other content on the page, such as: some jump links displayed "Homepage", "Operation and Maintenance Team Contact Information", etc., they can be processed through the internationalization integrated by springboot, so that some personalized prompts can be met.

[0043] In some embodiments, the platform common problem exception library is formulated, and the real-time update of the exception library can include using an XML configuration file (such as <xxx-exceptions>Tags) to uniformly define exception codes, exception information, log levels, exception descriptions, and solutions. This centralized management method makes it easy for developers to quickly find and modify exception information while ensuring the accuracy and consistency of exception information. In the XML configuration file, each <xxx-exception>The tag represents a specific exception and contains the exception code visible to the front end ( <code>)、Exception information( <message>); the log level at which the log is visible ( <level>), exception description ( <description>) and the solution ( <solution>).

[0044] In some embodiments, a common problem exception database is established in a business system, and real-time updates of the exception database can also be achieved by using a database to store the exception database. The required fields are the exception code, exception information, log level, exception description, and solution, with the exception code serving as the primary key to ensure data uniqueness.

[0045] In some embodiments, the formulation of an exception handling class that can capture global exceptions in the system may include creating a global exception handler class GlobalExceptionHandler and implementing the HandlerExceptionResolver interface to capture and handle all exceptions that occur in the system. In the resolveException method, different processing logic is performed according to the exception type (such as XXXException). For business exceptions, jump to the specified error page; for unexpected exceptions, jump to the 500 error page. The resolveException method is also responsible for adding the exception information to the ModelAndView object for display on the front-end page. The parameters of the request are obtained through HttpServletRequest and processed; the exception information is obtained from the exception object, and the processing is passed to the page display. The back-end prints out the complete information for operation and maintenance personnel to troubleshoot the problem.

[0046] In some embodiments, exception handling and throwing can be included in the business logic code. This involves creating an XXXExceptionRepository class to parse the exception repository XML file and calling the XXXExceptionRepository.getXXXException("system-01001").exception() method to throw predefined exceptions. This approach not only simplifies the exception throwing process but also ensures the accuracy of the exception information. When an exception is thrown, the GlobalExceptionHandler class is responsible for catching and handling it, redirecting to the corresponding error page based on the exception type, and displaying the exception information.

[0047] Example 2, based on Example 1, proposes a platform system exception unified processing system, which is characterized by: including:

[0048] It includes a subsystem exception capture module 201, a global exception capture module 202, an exception library module 203, an exception library analysis module 204, an exception log recording module 205, and an exception page response module 206.

[0049] The subsystem exception capture module 201 implements local exception capture logic for independent service units under the microservice architecture, distinguishes custom exceptions from system-level exceptions, and forwards them to the global processor;

[0050] The global exception capture module 202 implements an exception interceptor based on the middleware model, which displays a corresponding user interface according to different types of exceptions; for each captured exception, a detailed log entry is generated to facilitate subsequent analysis;

[0051] The exception library module 203 uses XML to store exception records to ensure data consistency and accessibility. Each exception record includes but is not limited to the error code, message text, severity indicator, detailed description, and recommended measures. It uses hot loading technology to enable newly added or modified exception rules to take effect immediately during operation.

[0052] The exception library parsing module 204 develops a service class specifically for managing and querying exception information, simplifying the process of developers finding specific exceptions; creates an exception entity class that encapsulates all necessary attributes to facilitate internal transfer and use within the program;

[0053] The exception logging module 205 adopts an asynchronous logging strategy to ensure stable performance even in high-concurrency scenarios. At the same time, the logs will be saved in a dedicated log folder and separated by date for easy management and retrieval;

[0054] The abnormal page response module 206 presets a series of friendly prompts in different languages ​​corresponding to common HTTP status codes; and allows administrators to adjust the prompt content through configuration files to meet the needs of different markets;

[0055] In some embodiments, the global exception capture module 202 can use the HandlerExceptionResolver interface defined by springboot. By implementing this interface, exceptions thrown by all control layers in the application can be intercepted. This module is a public module that is packaged into a JAR file and uploaded to the Maven repository for use by various application modules.

[0056] In some embodiments, the exception library module 203 can define a <xxx-exceptions>Total tags, each <xxx-exception>The tag represents a specific exception and contains the exception code visible to the front end ( <code>)、Exception information( <message>); the log level at which the log is visible ( <level>), exception description ( <description>) and the solution ( <solution>)

[0057] In some embodiments, the exception library parsing module 204 can use the DOM (Document Object Model) parser in Java or the more modern SAX (Simple API for XML) parser, or use a third-party library such as JAXB (Java Architecture for XML Binding) to map the XML exception library to Java objects.

[0058] In some embodiments, the logging module 205 may include using a logging framework (such as Log4j, SLF4J, etc.) to record exception information. When an exception is caught, the error log method (such as log.error()) of the logger is called to record the exception description information, exception stack information, etc.

[0059] In some embodiments, the abnormal page response module 206 can use FreeMarker (template engine) to define the abnormal page as a template file, and then use webjar (a tool for managing web front-end dependencies) to package the page as a static resource into a JAR (Java Archive) file and upload it to the Maven warehouse for use by various application modules.

[0060] In some embodiments, the exception page response module 206 can also implement personalized requirements of different project scenarios through international configuration, such as the contact information of the operation and maintenance team.

[0061] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.< / solution> < / description> < / level> < / message> < / code> < / solution> < / description> < / level> < / message> < / code>

Claims

1. A method for unified handling of platform system exceptions, characterized by: The following steps are involved: Develop platform exception rendering pages, customize unified exception pages based on common exceptions in the platform, preset friendly prompts in different languages ​​corresponding to a series of common HTTP status codes, and display solutions for common exceptions; Develop a common platform exception library, sort out the problems often encountered in platform system applications, formulate exception codes and exception information according to certain rules, and use XML configuration files to uniformly define exception codes, exception information, log levels, exception descriptions and solutions, so as to achieve real-time updates of the exception library; Exception handling class development: Create a global exception handler class that implements the HandlerExceptionResolver interface to capture and handle all exceptions that occur in the system, and perform different processing logic based on the exception type. Exception capture and throwing: In the business logic code, an exception is thrown by calling a predefined exception throwing method. The global exception handler class is responsible for capturing and handling the exception. Record the logs and print the abnormal information for analysis by operation and maintenance personnel.

2. A platform system exception unified processing method according to claim 1, characterized in that: In the step of formulating the platform exception rendering page, the customized unified exception page is placed in the public module and referenced uniformly by various application systems. When an exception occurs, the exception response styles of each system remain unified, and the page content is customized through the configuration file to meet different customer needs.

3. A platform system exception unified processing method according to claim 2, characterized in that: In the process of developing the platform common problem exception library, XML configuration files are used for centralized management. <xxx-exception> A tag represents a specific exception, including the exception code and exception information visible on the front end; the log level, exception description, and solution visible in the log, making it easy for developers to quickly find and modify exception information while ensuring the accuracy and consistency of exception information.

4. A platform system exception unified processing method according to claim 3, characterized in that: In the exception handling class formulation step, the global exception handler class jumps to the specified error page in the resolveException method according to the exception type, adds the exception information to the ModelAndView object for display on the front-end page, obtains the parameters of the request through HttpServletRequest and processes them, obtains the exception information from the exception object, processes it and passes it to the page for display, and prints out complete information on the back end for operation and maintenance personnel to troubleshoot the problem.

5. A platform system exception unified processing method according to claim 4, characterized in that: In the exception capture and throwing steps, create an XXXExceptionRepository class in the business logic code to parse the exception repository XML file. Call the XXXExceptionRepository.getXXXException("system-01001").exception() method to throw a predefined exception. When an exception is thrown, the global exception handler class is responsible for capturing and handling the exception, jumping to the corresponding error page based on the exception type, and displaying the exception information.

6. A system for the platform system exception unified processing method according to claim 5, characterized in that: include: The subsystem exception capture module implements local exception capture logic for independent service units under the microservice architecture, distinguishes custom exceptions from system-level exceptions, and forwards them to the global processor; The global exception capture module implements an exception interceptor based on the middleware pattern, displays the corresponding user interface according to different types of exceptions, and generates a detailed log entry for each captured exception; The exception library module uses XML to store exception records to ensure data consistency and accessibility. Each exception record contains the error code, message text, severity indicator, detailed description and recommended measures. It uses hot loading technology to enable newly added or modified exception rules to take effect immediately during operation. Exception library parsing module, develops service classes specifically for managing and querying exception information, and creates exception entity classes to encapsulate all necessary attributes; The exception logging module adopts an asynchronous logging strategy to ensure stable performance in high-concurrency scenarios. It saves logs into a dedicated log folder and separates them by date. The exception page response module presets a series of friendly prompts in different languages ​​corresponding to common HTTP status codes, allowing administrators to adjust the prompt content through configuration files.

7. A system according to claim 6, characterized in that: The global exception capture module uses springboot to define the HandlerExceptionResolver interface. By implementing this interface, you can intercept exceptions thrown by all control layers in the application. This module is implemented as a public module and packaged into a JAR file and uploaded to the Maven repository for use by various application modules.

8. A system according to claim 7, characterized in that: The exception library module defines a <xxx-exceptions>Total tags, each <xxx-exception> A tag represents a specific exception, including the exception code and exception information visible to the front end; the log level, exception description, and solution visible to the log.< / xxx-exception> 9. A system according to claim 8, characterized in that: The exception library parsing module uses the DOM parser or SAX parser in Java, or uses a third-party library such as JAXB to map the XML exception library to Java objects to simplify the process of developers finding specific exceptions and facilitate the transmission and use of exception information within the program.

10. A system according to claim 9, characterized in that: The exception logging module uses the log framework to record exception information. When an exception is caught, the error log method of the logger is called to record the exception description information and exception stack information. The exception page response module uses FreeMarker to define the exception page as a template file, and uses webjar to package the page as a static resource into a JAR file and upload it to the Maven repository for use by various application modules. It can also realize the personalized needs of different project scenarios through internationalization configuration.