WEB application running method and device, equipment and medium
By creating an application-layer class loader for WEB applications in the application server and determining the whitelist of class file loading using the deployment description file, the class loading conflict problem is solved and the normal operation of WEB applications is ensured.
Patent Information
- Application Number
- CN202411867363.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-28
AI Technical Summary
In the application server, the version difference of the same jar file leads to class loading conflicts, affecting the normal operation of the WEB application.
By deploying the target WEB application to the application server and creating an application-layer class loader, use the deployment description file to determine the whitelist of the class file loading. If the application layer does not find the target class file, it is determined whether it is in the whitelist. If it is not there, it is prohibited to look up at the application server layer to avoid class loading conflicts.
It effectively avoids class loading conflicts, ensures the normal operation of WEB applications, and uses the isolation mechanism of class file loading whitelists to prevent class file conflicts between the application server layer and the application layer.
Smart Images

Figure CN119719551A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a WEB application running method, device, equipment and medium. Background Art
[0002] For application servers, the importance of ensuring the normal operation of applications is self-evident. Being compatible with applications developed with various frameworks is the development trend of application servers. During the deployment and access phases of WEB (Web Application) applications, the application layer class loader will search and load the class files required by the WEB application. Different WEB applications may load different class files.
[0003] Some of the same jar files (a software package file format) exist in the application server layer and the web application at the same time, but the versions of the jar files are different, that is, the number and content of class files in the same jar file in the application server layer and the web application are not exactly the same. In this scenario, when the web application is running, the class file is loaded through the application layer class loader, and the class file is searched from the application layer first. If the relevant class is not found, the program logic of the web application itself should continue to be executed. However, during the actual operation, if the application layer does not find the relevant class, it continues to search for the class file from the application server layer, and finds the relevant class file, and then executes the program logic of the application server layer, resulting in a series of class loading conflicts and abnormal application operation.
[0004] In summary, it can be seen that how to ensure the normal operation of WEB applications and avoid class loading conflicts is a problem to be solved in this field. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a method, device, equipment and medium for running a web application, so as to ensure the normal running of the web application and avoid the class loading conflict problem. The specific scheme is as follows:
[0006] In a first aspect, the present application discloses a method for running a WEB application, comprising:
[0007] Deploy the target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application that has been configured with a deployment description file;
[0008] Using the application layer class loader to read the deployment description file to determine a class file loading whitelist for the target WEB application;
[0009] If the target class file currently to be loaded by the application layer class loader is not found in the application layer, determining whether the target class file is located in the class file loading whitelist;
[0010] If the target class file is not in the class file loading whitelist, searching for the target class file at the application server layer is prohibited, and the program logic of the target WEB application is prohibited from running.
[0011] Optionally, before deploying the target WEB application to the application server, the process further includes:
[0012] After adding various loading whitelist configuration tags in the deployment description file, the deployment description file is deployed in the security directory of the initial WEB application to obtain the target WEB application with the deployment description file configured.
[0013] Optionally, the using the application layer class loader to read the deployment description file to determine a class file loading whitelist for the target WEB application includes:
[0014] Parsing the deployment description file using the application layer class loader to obtain each class loading whitelist configuration tag;
[0015] Each of the class loading whitelist configuration tags is added to the whitelist attribute set of the application layer class loader, and the whitelist attribute set is determined as the class file loading whitelist of the target WEB application.
[0016] Optionally, the WEB application running method further includes:
[0017] Monitor whether there is a class loading conflict;
[0018] If there is currently a class loading conflict, uninstall the target WEB application;
[0019] Adjust various loading whitelist configuration tags in the deployment description file, and redeploy the adjusted deployment description file in the target WEB application, and then jump to the step of deploying the target WEB application to the application server.
[0020] Optionally, the WEB application running method further includes:
[0021] If the target class file to be loaded by the application layer class loader is found in the application layer, the target class file returned by the application layer is obtained, and the target class file is loaded by the application layer class loader to run the program logic of the target WEB application.
[0022] Optionally, the determining whether the target class file is in the class file loading whitelist includes:
[0023] Calling the traversal algorithm of the software development kit to traverse the various types of files in the class file loading whitelist, and comparing the first name of each class file with the second name of the target class file to determine whether there is a target first name in each first name that meets a preset matching condition with the second name; wherein the preset matching condition is that the starting part of the character string of the second name is the same as the character string of the target first name;
[0024] If the target first name exists in each of the first names, determining that the target class file is in the class file loading whitelist;
[0025] If the target first name does not exist in each of the first names, it is determined that the target class file is not in the class file loading whitelist.
[0026] Optionally, the WEB application running method further includes:
[0027] If the target class file is in the class file loading whitelist, the target class file is searched at the application server layer to obtain the target class file returned by the application server layer, and the target class file is loaded using the application layer class loader to run the program logic of the target WEB application.
[0028] In a second aspect, the present application discloses a WEB application running device, comprising:
[0029] A loader creation module, used to deploy the target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application for which a deployment description file has been configured;
[0030] A whitelist determination module, configured to use the application layer class loader to read the deployment description file to determine a class file loading whitelist for the target WEB application;
[0031] A class file determination module, configured to determine whether the target class file to be currently loaded by the application layer class loader is located in the class file loading whitelist if the target class file to be currently loaded by the application layer class loader is not found in the application layer;
[0032] The WEB application running module is used to prohibit searching for the target class file at the application server layer and run the program logic of the target WEB application if the target class file is not in the class file loading whitelist.
[0033] In a third aspect, the present application discloses an electronic device, comprising:
[0034] Memory, used to store computer programs;
[0035] The processor is used to execute the computer program to implement the steps of the aforementioned disclosed WEB application running method.
[0036] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned disclosed WEB application running method are implemented.
[0037] The beneficial effects of the present application are as follows: the present application deploys a target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application for which a deployment description file has been configured; the deployment description file is read by the application layer class loader to determine a class file loading whitelist for the target WEB application; if the target class file currently to be loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is located in the class file loading whitelist; if the target class file is not located in the class file loading whitelist, it is prohibited to search for the target class file at the application server layer, and the program logic of the target WEB application is run. It can be seen that the present application deploys the target WEB application that has been configured with the deployment description file to the application server. The application server creates an application layer class loader corresponding to the target WEB application, and then uses the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application. First, the target class file to be loaded by the application layer class loader is searched in the application layer. If it is not found, it is determined whether the target class file is located in the class file loading whitelist. If the target class file is not located in the class file loading whitelist, it is prohibited to search for the target class file in the application server layer. In other words, the class files located in the class file loading whitelist can be searched in the application server layer, while the class files not located in the class file loading whitelist cannot be searched in the application server layer. That is, the class file loading whitelist can isolate the class files of the application server layer and the application layer, so that when the present application does not find the target class file in the application layer, it can continue to execute the program logic of the WEB application itself. In this way, class loading conflicts are avoided and the normal operation of the WEB application is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0039] Figure 1 A flow chart of a WEB application operation method disclosed in this application;
[0040] Figure 2 A flowchart of a specific WEB application operation method disclosed in this application;
[0041] Figure 3 This is a schematic diagram of the structure of a WEB application running device disclosed in this application;
[0042] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] For application servers, the importance of ensuring the normal operation of applications is self-evident. Being compatible with applications developed with various frameworks is the development trend of application servers. During the deployment and access phases of WEB (Web Application) applications, the application layer class loader will search and load the class files required by the WEB application. Different WEB applications may load different class files.
[0045] Some of the same jar files (a software package file format) exist in the application server layer and the web application at the same time, but the versions of the jar files are different, that is, the number and content of class files in the same jar file in the application server layer and the web application are not exactly the same. In this scenario, when the web application is running, the class file is loaded through the application layer class loader, and the class file is searched from the application layer first. If the relevant class is not found, the program logic of the web application itself should continue to be executed. However, during the actual operation, if the application layer does not find the relevant class, it continues to search for the class file from the application server layer, and finds the relevant class file, and then executes the program logic of the application server layer, resulting in a series of class loading conflicts and abnormal application operation.
[0046] To this end, this application provides a WEB application running solution to ensure the normal running of the WEB application and avoid class loading conflicts.
[0047] See also Figure 1 As shown, the embodiment of the present application discloses a method for running a WEB application, including:
[0048] The step is S11: deploying the target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application for which a deployment description file has been configured.
[0049] In this embodiment, before deploying the target WEB application to the application server, it also includes: adding various loading whitelist configuration tags in the deployment description file, and deploying the deployment description file in the security directory of the initial WEB application to obtain the target WEB application with the configured deployment description file.
[0050] Currently, the application server itself already includes the class loading whitelist function. You only need to enable this function in the configuration file. The specific operations are as follows:
[0051] 1) Define a deployment description file and add a class loading whitelist configuration tag to it. The deployment description file can be inforsuite-web.xml file, and the class loading whitelist configuration tag can be <whitelist-package> javax< / whitelist-package> It should be noted that the content here is currently configured as javax, which needs to be adjusted according to the actual application scenario, that is, temporarily configuring some core APIs (Application Programming Interface) that the application layer relies on;
[0052] 2) Place the configured inforsuite-web.xml in the security directory of the target WEB application. The security directory can be the WEB-INF directory (that is, the standard folder under the WEB application) so that the application server can recognize this configuration during subsequent deployment.
[0053] In this way, the target WEB application configured with the deployment description file is deployed to the application server, and the application server creates an application layer class loader corresponding to the target WEB application.
[0054] Step S12: using the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application.
[0055] In this embodiment, the use of the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application includes: using the application layer class loader to parse the deployment description file to obtain each class loading whitelist configuration tag; adding each class loading whitelist configuration tag to the whitelist attribute set of the application layer class loader, and determining the whitelist attribute set as the class file loading whitelist of the target WEB application.
[0056] At the very beginning of deployment, the application server first creates a corresponding application layer class loader for the application. The application layer class loader parses the deployment description file, that is, parses the inforsuite-web.xml file, to obtain the configuration status tag returned by the isWhitelistEnabled algorithm based on the deployment description file. If the configuration status tag is the first preset tag, it is determined that various types of loading whitelist configuration tags have been added to the deployment description file, and various types of loading whitelist configuration tags are obtained; wherein the first preset tag is a true tag (true); if the configuration status tag is the second preset tag, it is determined that various types of loading whitelist configuration tags have not been added to the deployment description file, and jumps back to the step after adding various types of loading whitelist configuration tags in the deployment description file; wherein the second preset tag is a true tag (false); in this way, it is avoided that the process of adding various types of loading whitelist configuration tags is still executed because various types of loading whitelist configuration tags are not added to the deployment description file.
[0057] Because various whitelist-package tags have been added to the deployment description file of the target WEB application before the target WEB application is deployed to the application server in this embodiment, the isWhitelistEnabled algorithm of the application layer class loader will return the first preset tag true, and then read various loading whitelist configuration tags, and read the values of all class loading whitelist configuration tags into the whitelist collection attribute of the application layer class loader. This attribute is a collection class of JDK (Java language software development kit) used to store the values of all configured whitelist tags. At this stage, the application layer class loader has completed reading the class loading whitelist configuration.
[0058] It is understandable that the isWhitelistEnabled algorithm is an algorithm used by the application layer class loader to determine whether the class loading whitelist is enabled. If inforsuite-web.xml exists <whitelist-package>Tag, it is regarded as turning on the class loading whitelist function, so the first preset tag true is returned. If it does not exist, the second preset tag false is returned.
[0059] Step S13: if the target class file to be currently loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is located in the class file loading whitelist.
[0060] In this embodiment, it also includes: if the target class file to be loaded by the application layer class loader is found in the application layer, the target class file returned by the application layer is obtained, and the target class file is loaded by the application layer class loader to run the program logic of the target WEB application.
[0061] It can be understood that the target class file to be currently loaded by the application layer class loader is first searched in the application layer. If the target class file to be currently loaded by the application layer class loader is found in the application layer, the target class file returned by the application layer is obtained, and the target class file is loaded by the application layer class loader to run the program logic of the target WEB application. If the target class file to be currently loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is in the class file loading whitelist.
[0062] In this embodiment, the determination of whether the target class file is located in the class file loading whitelist includes: calling the traversal algorithm of the software development kit to traverse the various types of files in the class file loading whitelist, and comparing the first name of each class file with the second name of the target class file to determine whether there is a target first name in each of the first names that meets a preset matching condition with the second name; wherein the preset matching condition is that the starting part of the character string of the second name is the same as the character string of the target first name; if the target first name exists in each of the first names, it is determined that the target class file is located in the class file loading whitelist; if the target first name does not exist in each of the first names, it is determined that the target class file is not located in the class file loading whitelist.
[0063] The traversal algorithm of the software development kit is called to traverse various files in the class file loading whitelist to determine whether the target class file is in the class file loading whitelist. Specifically, the isWhiteListed algorithm can be called to determine whether the target class file to be loaded is in the configured class file loading whitelist. The loading process is as follows: First, the whitelist collection attribute of the application layer class loader is traversed by calling the JDK traversal algorithm. The first name of each class file in the collection is compared with the second name of the target class file by calling the name comparison method of the JDK string class. If the name of the target class file starts with this element name, it is in the whitelist. For example, the second name of the target class file is com.cvicse.MyClass, and the first name of the class file configured in the class loading whitelist is com.cvicse. Then com.cvicse.MyClass starts with com.cvicse, which is considered to be in the whitelist.
[0064] Step S14: if the target class file is not in the class file loading whitelist, it is prohibited to search for the target class file at the application server layer, and the program logic of the target WEB application is run.
[0065] It should be noted that if the target class file is not in the class file loading whitelist, it is prohibited to search for the target class file at the application server layer. That is to say, when the target class file is not in the class file loading whitelist, it means that the target file cannot be searched at the application server layer and the program logic of the target WEB application cannot be run.
[0066] In this embodiment, it also includes: monitoring whether there is a class loading conflict; if there is a class loading conflict, uninstalling the target WEB application; adjusting various loading whitelist configuration tags in the deployment description file, and redeploying the adjusted deployment description file in the target WEB application, and then jumping to the step of deploying the target WEB application to the application server. If there is a class loading conflict, it means that the deployment description file needs to be adjusted, so it is necessary to uninstall the target WEB application, adjust various loading whitelist configuration tags in the deployment description file, and redeploy the adjusted deployment description file in the target WEB application, and then jump to the step of deploying the target WEB application to the application server.
[0067] In this embodiment, it also includes: if the target class file is in the class file loading whitelist, the target class file is searched at the application server layer to obtain the target class file returned by the application server layer, and the target class file is loaded by the application layer class loader to run the program logic of the target WEB application. If the target class file is in the class file loading whitelist, the target class file can be searched at the application server layer to obtain the target class file returned by the application server layer, and the target class file is loaded by the application layer class loader to run the program logic of the target WEB application.
[0068] The beneficial effects of the present application are as follows: the present application deploys a target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application for which a deployment description file has been configured; the deployment description file is read by the application layer class loader to determine a class file loading whitelist for the target WEB application; if the target class file currently to be loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is located in the class file loading whitelist; if the target class file is not located in the class file loading whitelist, it is prohibited to search for the target class file at the application server layer, and the program logic of the target WEB application is run. It can be seen that the present application deploys the target WEB application that has been configured with the deployment description file to the application server. The application server creates an application layer class loader corresponding to the target WEB application, and then uses the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application. First, the target class file to be loaded by the application layer class loader is searched in the application layer. If it is not found, it is determined whether the target class file is located in the class file loading whitelist. If the target class file is not located in the class file loading whitelist, it is prohibited to search for the target class file in the application server layer. In other words, the class files located in the class file loading whitelist can be searched in the application server layer, while the class files not located in the class file loading whitelist cannot be searched in the application server layer. That is, the class file loading whitelist can isolate the class files of the application server layer and the application layer, so that when the present application does not find the target class file in the application layer, it can continue to execute the program logic of the WEB application itself. In this way, class loading conflicts are avoided and the normal operation of the WEB application is guaranteed.
[0069] Below Figure 2 Taking the specific WEB application operation process diagram shown in the figure as an example, the WEB application operation process of this application is described accordingly:
[0070] 1) Preparation, configure the class loading whitelist file: After adding various loading whitelist configuration tags in the deployment description file, deploy the deployment description file in the security directory of the initial WEB application to obtain the target WEB application with the configured deployment description file.
[0071] 2) Deploy the application, create an application layer class loader, and read the class loading whitelist configuration: deploy the target WEB application to the application server so that the application server can create an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application that has been configured with a deployment description file; use the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application.
[0072] 3) In the deployment phase, the WEB application loads class files: if the target class file to be loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is in the class file loading whitelist; if the target class file is not in the class file loading whitelist, it is prohibited to search for the target class file in the application server layer, and the program logic of the target WEB application is run.
[0073] 4) In the access phase, the WEB application loads class files: if the target class file to be loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is in the class file loading whitelist; if the target class file is not in the class file loading whitelist, it is prohibited to search for the target class file in the application server layer, and the program logic of the target WEB application is run.
[0074] It should be noted that if the deployment fails or the access fails, the class loading whitelist is reconfigured, that is, whether there is a class loading conflict at present is monitored; if there is a class loading conflict at present, the target WEB application is uninstalled; the various loading whitelist configuration tags in the deployment description file are adjusted, and the adjusted deployment description file is redeployed in the target WEB application, and then jumps to the step of deploying the target WEB application to the application server. By continuously adjusting the various loading whitelist configuration tags, the target WEB application is adapted, so that the target WEB application is deployed successfully and accessed successfully.
[0075] See also Figure 3 As shown, the embodiment of the present application discloses a WEB application running device, including:
[0076] The loader creation module 11 is used to deploy the target WEB application to the application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application that has been configured with a deployment description file;
[0077] A whitelist determination module 12, configured to use the application layer class loader to read the deployment description file to determine a class file loading whitelist for the target WEB application;
[0078] The class file determination module 13 is used to determine whether the target class file to be loaded by the application layer class loader is located in the class file loading whitelist if the target class file to be loaded by the application layer class loader is not found in the application layer;
[0079] The WEB application running module 14 is used to prohibit searching for the target class file at the application server layer and run the program logic of the target WEB application if the target class file is not in the class file loading whitelist.
[0080] The beneficial effects of the present application are as follows: the present application deploys a target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application for which a deployment description file has been configured; the deployment description file is read by the application layer class loader to determine a class file loading whitelist for the target WEB application; if the target class file currently to be loaded by the application layer class loader is not found in the application layer, it is determined whether the target class file is located in the class file loading whitelist; if the target class file is not located in the class file loading whitelist, it is prohibited to search for the target class file at the application server layer, and the program logic of the target WEB application is run. It can be seen that the present application deploys the target WEB application that has been configured with the deployment description file to the application server. The application server creates an application layer class loader corresponding to the target WEB application, and then uses the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application. First, the target class file to be loaded by the application layer class loader is searched in the application layer. If it is not found, it is determined whether the target class file is located in the class file loading whitelist. If the target class file is not located in the class file loading whitelist, it is prohibited to search for the target class file in the application server layer. In other words, the class files located in the class file loading whitelist can be searched in the application server layer, while the class files not located in the class file loading whitelist cannot be searched in the application server layer. That is, the class file loading whitelist can isolate the class files of the application server layer and the application layer, so that when the present application does not find the target class file in the application layer, it can continue to execute the program logic of the WEB application itself. In this way, class loading conflicts are avoided and the normal operation of the WEB application is guaranteed.
[0081] Furthermore, an embodiment of the present application also provides an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0082] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the WEB application running method executed by the electronic device disclosed in any of the aforementioned embodiments.
[0083] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0084] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0085] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0086] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the WEB application running method executed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data received by the electronic device and transmitted from an external device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0087] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the aforementioned disclosed WEB application operation method is implemented. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0088] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0089] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable EPROM (Erasable Programmable Read Only Memory), electrically erasable programmable EEPROM (Electrically Erasable Programmable read only memory), register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0090] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0091] The above is a detailed introduction to a WEB application running method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for running a WEB application, characterized in that: include: Deploy the target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application that has been configured with a deployment description file; Using the application layer class loader to read the deployment description file to determine a class file loading whitelist for the target WEB application; If the target class file currently to be loaded by the application layer class loader is not found in the application layer, determining whether the target class file is located in the class file loading whitelist; If the target class file is not in the class file loading whitelist, searching for the target class file at the application server layer is prohibited, and the program logic of the target WEB application is prohibited from running.
2. The WEB application running method according to claim 1, characterized in that: Before deploying the target WEB application to the application server, the method further includes: After adding various loading whitelist configuration tags in the deployment description file, the deployment description file is deployed in the security directory of the initial WEB application to obtain the target WEB application with the deployment description file configured.
3. The WEB application running method according to claim 2, characterized in that: The using the application layer class loader to read the deployment description file to determine the class file loading whitelist of the target WEB application includes: Parsing the deployment description file using the application layer class loader to obtain each class loading whitelist configuration tag; Each of the class loading whitelist configuration tags is added to the whitelist attribute set of the application layer class loader, and the whitelist attribute set is determined as the class file loading whitelist of the target WEB application.
4. The WEB application running method according to claim 2, characterized in that: Also includes: Monitor whether there is a class loading conflict; If there is currently a class loading conflict, uninstall the target WEB application; Adjust various loading whitelist configuration tags in the deployment description file, and redeploy the adjusted deployment description file in the target WEB application, and then jump to the step of deploying the target WEB application to the application server.
5. The WEB application running method according to claim 1, characterized in that: Also includes: If the target class file to be loaded by the application layer class loader is found in the application layer, the target class file returned by the application layer is obtained, and the target class file is loaded by the application layer class loader to run the program logic of the target WEB application.
6. The WEB application running method according to any one of claims 1 to 5, characterized in that: The determining whether the target class file is located in the class file loading whitelist includes: Calling the traversal algorithm of the software development kit to traverse the various types of files in the class file loading whitelist, and comparing the first name of each class file with the second name of the target class file to determine whether there is a target first name in each first name that meets a preset matching condition with the second name; wherein the preset matching condition is that the starting part of the character string of the second name is the same as the character string of the target first name; If the target first name exists in each of the first names, determining that the target class file is in the class file loading whitelist; If the target first name does not exist in each of the first names, it is determined that the target class file is not in the class file loading whitelist.
7. The WEB application running method according to claim 6, characterized in that: Also includes: If the target class file is in the class file loading whitelist, the target class file is searched at the application server layer to obtain the target class file returned by the application server layer, and the target class file is loaded using the application layer class loader to run the program logic of the target WEB application.
8. A WEB application running device, characterized in that: include: A loader creation module, used to deploy the target WEB application to an application server so that the application server creates an application layer class loader corresponding to the target WEB application; wherein the target WEB application is a WEB application for which a deployment description file has been configured; A whitelist determination module, configured to use the application layer class loader to read the deployment description file to determine a class file loading whitelist for the target WEB application; A class file determination module, configured to determine whether the target class file to be currently loaded by the application layer class loader is located in the class file loading whitelist if the target class file to be currently loaded by the application layer class loader is not found in the application layer; The WEB application running module is used to prohibit searching for the target class file at the application server layer and run the program logic of the target WEB application if the target class file is not in the class file loading whitelist.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the WEB application running method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the WEB application running method according to any one of claims 1 to 7 are implemented.