CN106909498A - A kind of java applet injects the method and system of failure - Google Patents

A kind of java applet injects the method and system of failure Download PDF

Info

Publication number
CN106909498A
CN106909498A CN201510975340.0A CN201510975340A CN106909498A CN 106909498 A CN106909498 A CN 106909498A CN 201510975340 A CN201510975340 A CN 201510975340A CN 106909498 A CN106909498 A CN 106909498A
Authority
CN
China
Prior art keywords
class files
master control
virtual machine
control end
java
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510975340.0A
Other languages
Chinese (zh)
Other versions
CN106909498B (en
Inventor
王帅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510975340.0A priority Critical patent/CN106909498B/en
Publication of CN106909498A publication Critical patent/CN106909498A/en
Application granted granted Critical
Publication of CN106909498B publication Critical patent/CN106909498B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the present application discloses the method and system that a kind of java applet injects failure.Methods described includes:Client receives the failure code of input, and the failure code is sent into master control end;After Java Virtual Machine starts, original Class files are loaded;The master control end monitors the ruuning situation of Java processes where the Java Virtual Machine, fetches the original Class files of the Java Virtual Machine loading;The original Class files that the master control end is fetched according to the failure code editor, the Class files after generation editor;Master control end is by the Class files passes after the editor to the Java Virtual Machine replacing the original Class files;The Java Virtual Machine explains the Class files after performing the editor.Using the embodiment of the present application, it is possible to achieve the direct fault location after Java Virtual Machine startup.

Description

A kind of java applet injects the method and system of failure
Technical field
The application is related to computer software technical field, more particularly to a kind of method that java applet injects failure And system.
Background technology
In software development process, generally require to carry out reliability demonstration to the program developed.Can typically pass through Introduce failure to detect whether program to be verified produces abnormal conditions to program to be verified.By introducing failure, Can be failed with acceleration system, so that simulation system mistake within a short period of time, and obtain the fail data of system, The fault freedom and stability of program to be verified are evaluated and tested so as to reach.Failure Injection Technique is generally comprised and is based on The direct fault location of hardware, the direct fault location based on software and the direct fault location based on emulation.
During the general fault filling method based on software can use register by dynamic modification process Data realize.In computer system, process is one has the program of standalone feature on certain data set The once operation activity closed.It can apply for and possess system resource, be a dynamic concept.It is not only It is the code of program, also including current activity, is represented by the content of processing register.When process just Operationally, state is commonly stored in register.Prior art in order in evaluating software system for some The restorability of whole system, fault-tolerance and availability after process failure, there is provided a set of based on department of computer science The direct fault location instrument of system register, the module can be applied to the linux system of x86 and x64 series.
The multiple processes of operation are generally required in operating system, sharing CPU resource is needed between process and process. And operating system then be responsible for process between scheduling with switching, when system needs to be scheduled process, it is necessary to Ensure there can not be the damage of data during process switching.Therefore, operating system will first can need to swap out The current state (mainly content of registers) of process is preserved into internal memory, and recovery needs to change to process State.However, these operations are required to be completed in the presence of system tick interrupt request.Tick interrupt please Task scheduling, the resource occupation of process switching count foundation in operating system during Seeking Truth, are whole operation systems The pulse of Core Operational.That is, when system tick interrupt occurs, operating system may carry out process Handover operation, subsequently complete in-situ FTIR spectroelectrochemitry operation.Therefore, when system tick interrupt, carried out in system Before in-situ FTIR spectroelectrochemitry operation, the register data backed up in internal memory can be changed by way of software, then The content of registers that operating system will can be changed is recovered into process register, so as to reach software fault The purpose of injection.
For java applet, aforesaid way cannot realize direct fault location.Because, compiled with Java language The software systems write are performed, it is necessary to be explained by Java Virtual Machine, and operating system cannot be performed directly.
In java applet development process, after programmer has write Java source code, Java source code can The byte code files (Class files) for being compiled as to be performed by Java Virtual Machine by Java compiler.And then, Explained by Java Virtual Machine and perform the byte code files, it is possible to achieve the operation of program.It is virtual in Java After machine starts, explain that before performing Class files, Java Virtual Machine also needs to complete to Class files Load, verify, prepare, parse and initialize this 5 stages.Under normal circumstances, Class files By Java Virtual Machine loading once.
In the prior art for a kind of direct fault location instrument of java applet, before Java Virtual Machine startup, Software is changed using bytecode to modify the Class files for having compiled, so as to reach static injection Java The purpose of program mal.The instrument is needed to collect corresponding fault message in advance, and class files are carried out Scan matching, is then injected into corresponding failure code, starts Java Virtual Machine and performs corresponding bytecode text Part.
However, the instrument is only applicable to modify class byte code files before Java Virtual Machine starts, After Java Virtual Machine starts, the direct fault location instrument cannot complete direct fault location.In test environment, survey If examination personnel want the fault scenes that have occurred of reproduction, it is necessary to the Java Virtual Machine in being carrying out is closed, Then byte code files are changed, Java Virtual Machine is restarted, at this moment, Java Virtual Machine cannot recovers Original failure contextual information.Particularly break down when system report an error, need reappear this it is wrong when, Due to restarting Java Virtual Machine, various parameters and phenomenon when reporting an error before may not reappear again .
The content of the invention
The purpose of the embodiment of the present application is to provide the method and system that a kind of java applet injects failure, to realize Direct fault location after Java Virtual Machine startup.
In order to solve the above technical problems, what the embodiment of the present application was realized in:
A kind of method that java applet injects failure, including:
Client receives the failure code of input, and the failure code is sent into master control end;
After Java Virtual Machine starts, original Class files are loaded;
The master control end monitors the ruuning situation of Java processes where the Java Virtual Machine, fetches the Java The original Class files of virtual machine loading;
The original Class files that the master control end is fetched according to the failure code editor, generation editor Class files afterwards;
Master control end is described original to replace by the Class files passes after the editor to the Java Virtual Machine Class files;
The Java Virtual Machine explains the Class files after performing the editor.
The system that a kind of java applet injects failure, including:
Client, for receiving the failure code of input, and is sent to master control end by the failure code;
Master control end, the ruuning situation for monitoring Java processes where the Java Virtual Machine is fetched described The original Class files of Java Virtual Machine loading;That is fetched according to the failure code editor is original Class files, the Class files after generation editor;By the Class files passes after the editor to described Java Virtual Machine is replacing the original Class files;
Java Virtual Machine, is used to load original Class files, and perform the editor for explaining after startup Class files afterwards.
The technical scheme provided from above the embodiment of the present application, the embodiment of the present application is by virtual in Java After machine starts, monitor the Java Virtual Machine ruuning situation and fetch the original Class files of the loading, Class files after editing generation editor are to replace the original Class files, it is possible to achieve in Java Virtual machine need not restart the failure of such as specified type in the case of Java Virtual Machine after starting, and can To keep context data when reporting an error.
Brief description of the drawings
In order to illustrate more clearly of the embodiment of the present application or technical scheme of the prior art, below will be to implementing Example or the accompanying drawing to be used needed for description of the prior art are briefly described, it should be apparent that, describe below In accompanying drawing be only some embodiments described in the application, for those of ordinary skill in the art, Without having to pay creative labor, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is the JVMTI interaction models of the application one embodiment;
Fig. 2 is the embodiment of the method that a kind of java applet of the application injects failure;
Fig. 3 is the system embodiment that a kind of java applet of the application injects failure.
Specific embodiment
The embodiment of the present application provides the method and system that a kind of java applet injects failure.
In order that those skilled in the art more fully understand the technical scheme in the application, below in conjunction with this Accompanying drawing in application embodiment, is clearly and completely described to the technical scheme in the embodiment of the present application, Obviously, described embodiment is only some embodiments of the present application, rather than whole embodiments.Base Embodiment in the application, those of ordinary skill in the art are obtained under the premise of creative work is not made The every other embodiment for obtaining, should all belong to the scope of the application protection.
After programmer has write Java source code, Java source code can be compiled as by Java compiler can quilt Java Virtual Machine explains the bytecode (Class files) for performing.After Java Virtual Machine startup, Class is completed The work such as loading, checking, preparation, parsing and the initialization of file, and then explain execution Class files. Under normal circumstances, after Java Virtual Machine starts, a Class file can only be loaded.
In the embodiment of method one of the application java applet injection failure, including JVMTI as shown in Figure 1 Interaction models.
As shown in figure 1, including client, master control end and target Java processes.Wherein, target Java enters Journey can include agency (Agent), JVM tool interfaces (JVM (Java Virtual Machine) Tool Interface, JVMTI), java applet (Java Application).
JVMTI can be operated together in same Java Virtual Machine with java applet, and JVMTI is responsible for monitoring Safeguard java applet.When other programs need to be communicated with JVMTI, JVMTI agencies can be created, That is Agent.The Agent of establishment can be performed with target Java Virtual Machine in same process, and Agent can As JVMTI and the extraneous medium for interacting.
Client is the interface of user mutual, and all of operation behavior of user can be completed in client.User By that after client-side editing direct fault location code, failure code can also be uploaded into master control end by client.
Master control end can be communicated with client, and the command information from client is parsed, and be obtained Parameter in failure code.On the other hand, master control end can monitor the execution state of Java processes, it is possible to Interacted with Agent, and then control information can be sent to the JVMTI in Java processes.Specifically, Java Virtual Machine completes the loading to Class files after starting after, master control end can take from Java Virtual Machine The Class files of loading are returned, then Class files are modified, Java is back to after modification empty Plan machine, and replace original Class files.In this process, on the one hand, master control end can be entered with client Row communication, the command information from client is parsed, and obtains failure code.On the other hand, master control End can fetch the Class files loaded after Java Virtual Machine starts.And then, master control end can be according to failure Code enters edlin, the Class files after generation editor to the Class files fetched.After generation editor After Class files, master control end can by the Class files passes after editing to Java Virtual Machine, with Replace original Class files.
Fig. 2 shows that the application java applet injects an embodiment of the method for failure, as shown in Fig. 2 including:
S210:Client receives the failure code of input, and the failure code is sent into master control end.
As it was previously stated, client is the interface of user mutual, all of operation behavior of user can be in client Complete.Specifically, client can include operating console and and communication module.Wherein, the operation control Platform processed can submit the interactive interface of failure code to as user, receive the operational order that user assigns.It is described Failure code can be uploaded to master control end by communication module.
The operating console can include script-editor.The script-editor can provide the user event Hinder the editting function of injection script, editor's failure code in the way of aiding in user to edit direct fault location script. Specifically, the script-editor can provide modification Class titles, method name and operation behavior Operation;So, user can utilize the script-editor to be intended to Class titles, the method name of modification And operation behavior is made as injection script.
The client can also include script correction verification module, for verifying whether the script that user edits meets Specification.
The master control end can be communicated using Socket modes with the client, will be from the client The command information at end is parsed, and obtains the failure code.Using Socket programming techniques, at master control end Open listening port, it is possible to achieve repeatedly change the Class files of the same Java Virtual Machine being currently running. So, when there is new direct fault location to ask, client is by way of Socket is connected by direct fault location pin To master control end, master control end can parse the direct fault location script submitted to from client for this transmission.
S220:Java Virtual Machine starts and loads original Class files.
This step similarly to the prior art, is repeated no more.
It should be noted that S220 and S210 does not exist strict sequencing, S220 can be in S210 Before or after perform, certain S220 can also be with S210 executed in parallel.
S230:The master control end monitors the ruuning situation of Java processes where the Java Virtual Machine, fetches The original Class files of the Java Virtual Machine loading.
As it was previously stated, Java processes can include agency and Java Virtual Machine.In other words, the Agent Can be performed in same process with the Java Virtual Machine.JVMTI can be operated together with java applet In the Java Virtual Machine.The JVMTI can monitor the maintenance java applet.The Agent Can be as JVMTI and the extraneous medium for interacting.JVMTI related interface interchange information can be sent to The Agent.
Master control end can be designed as servo progress, monitor the execution state of the Java processes, and with it is described Agent is interacted.By the Agent, master control end can send the control related to the JVMTI Information.
Specifically, in this step, the master control end can monitor the Java Virtual Machine by JVMTI Ruuning situation, and monitoring after the Java Virtual Machine loads original Class files, fetch the original Beginning Class file.Further, the master control end can fetch module including bytecode, by the module, The original Class files of the Java Virtual Machine loading can be fetched.More specifically, can determine in the application One abstract class Transformer of justice, such can realize ClassFileTransformer interfaces, its Transform methods give the editing process of Class bytecodes.In Transform methods, word is used Section code fetches module and fetches the Class files.By using the get methods of ClassPool classes, can obtain Fetching determines the byte code files corresponding to class name, and returns to the CtClass classes of the classification class of the byte code files The reference of type.CtClass classes provide modification class titles, increase member variable, increase case method, Obtain a series of interfaces such as designation method.
S240:The original Class files that the master control end is fetched according to the failure code editor, it is raw Into the Class files after editor.
The original Class that the master control end can fetch according to the failure code editor received in S210 File.Specifically, the master control end can include bytecode editor module, by calling Javassit softwares To realize the editor to the original Class files.Javassist is an analysis increased income, editor and creates The class libraries of Java bytecode is built, is the Shigeru of mathematics by Tokyo Institute of Technology and computer science department Chiba (Chiba taste) is created.It has added open source code JBoss application server projects, passes through Bytecode is operated for JBoss realizes dynamic " AOP " framework using Javassist.
Treatment on Java bytecode, also contains some other similar means, such as BCEL, ASM at present. For example, Javassist contrasts as follows with ASM features:
1st, javassist is based on the API of source-code level, simpler than the ASM based on bytecode;
2nd, developed based on javassist, it is not necessary to understand some knowledge of bytecode, and its encapsulation one A little tool-class can be with some Premium Features of simple realization, such as HotSwaper.
3rd, than javassist performance faster, flexible row is also higher for ASM.
Failure code according to receiving enters edlin to original Class files, the Class after being edited File.Class files after the editor already have the failure code of injection.
More specifically, the abstract class Transformer according to defined in above-mentioned S230, need to such When certain method is modified, getMethod methods can be called to obtain the corresponding example of CtMethod classes method.CtMethod classes provide a series of amending methods function, such as nominated bank insertion code, Method inserts code, increases exception handling information, addition local variable, remapping method body etc. before performing.When After having edited the corresponding bytecode of Class files, the toBytecode methods of CtClass classes are called to give birth to again Into such byte code files, you can to complete the modification of bytecode.
Instrumentation interfaces are the cores of java.lang.instrumentation bags, and the interface is given The methods such as the conversion of class and operation.AddTransformer methods can register ClassFileTransformer, And redefineClasses methods can then redefine Class.Master control end can preserve Instrumentation The reference of interface, so, as the Class changed the need for having newly, it is necessary to instantiate such correspondence again Transformer subclasses, and register the Transformer, retransformClasses methods are called therewith.
Agent can set a static method:Agentmain methods.This static method is broken into Jar bags, and the value of Agent-Class is set to Agent class names in MANIFEST.MF, and will The value of Can-Redefine-Classes and Can-Retransform-Classes is set to true.Held in program Class byte code files are changed during row, it is necessary to by Agent attach to specified Java processes.Need By calling the attache methods of VirtualMachine classes, and to return to process correspondence Java Virtual Machine The instance objects of VirtualMachine classes, call the loadAgent methods of the instance objects to complete therewith The attach tasks of Agent.After attach successes, Java Virtual Machine can call correspondence agentmain methods, Reach the purpose that Java Virtual Machine bytecode is changed in program process.
S250:Master control end is by the Class files passes after the editor to the Java Virtual Machine to replace State original Class files.
In this step, specifically, master control end can call the Agent in Java processes, after editor Class files are uploaded to Java Virtual Machine by Agent, and so, original Class files can be replaced It is the Class files after editor.
Further, Transform classes can be quoted in JVMTI communication modules, master control end uses the reference, Communicated with the JVMTI in Java Virtual Machine by Agent, bytecode editor module can be generated Class files passes to Java Virtual Machine.
S260:The Java Virtual Machine explains the Class files after performing the editor.
The Class files after editor, contain the failure code of injection, so as to virtual in the Java Machine explains the Class files after performing the editor, can complete direct fault location, and then can realize evaluation and test Try the fault freedom and stability or reliability of program to be verified.
After above-mentioned steps are performed, the embodiment of the present application can also include:
S270:The master control end is by fail result data back to the client.
After the completion of direct fault location, the master control end can by fail result data back to the client, with Prompting user.Specifically, master control end can define a data transfer class TransferProtocol, the transmission Class can by target class name (targetClass), goal approach (targetMethod), insertion script (codes), Fault type (faultType), fail result (faultResult) etc. are constituted.
Also, the application is by after Java Virtual Machine starts, monitoring the Java Virtual Machine ruuning situation And the original Class files of the loading are fetched, the Class files after editing generation editor are to replace The original Class files, it is possible to achieve Java Virtual Machine need not restart Java Virtual Machine after starting Please in the case of inject the failure of specified type, it is possible to keep context data when reporting an error.
Further, using the above embodiments of the present application, can be inserted in java applet bytecode specified location Code segment, adjustment control statement execution logic, amending method parameter, force method to return in advance, dish out it is different Often.
In addition, a kind of direct fault location instrument in the prior art for java applet, it is necessary to collect corresponding in advance Fault message, set up corresponding fault database, so as to class files are scanned matching after, injection Corresponding failure code, starts Java Virtual Machine and performs corresponding byte code files.Prior art needs pre- First scan Java files, it is impossible to meet to the purpose that Arbitrary Fault code is injected in byte code files.The instrument It is unable to reach the purpose that failure is injected to the Java Virtual Machine in being currently running.Relative to above-mentioned prior art, Because the application need not set up fault database, can be to injection Arbitrary Fault code in byte code files.
The embodiment of the present application is provided and also provides a kind of system, it is possible to achieve above-mentioned method and step, and the system Can be realized by software, it is also possible to realized by way of hardware or software and hardware combining.It is implemented in software As a example by, as the system on logical meaning, be by the CPU of server (Central Process Unit, Central processing unit) corresponding computer program instructions are read run in internal memory what is formed.
Specifically, the system that a kind of java applet of the application injects failure, can with as shown in figure 3, including:
Client 31, for receiving the failure code of input, and is sent to master control end by the failure code;
Master control end 32, the ruuning situation for monitoring Java processes where the Java Virtual Machine, fetches institute State the original Class files of Java Virtual Machine loading;That is fetched according to the failure code editor is original Class files, the Class files after generation editor;By the Class files passes after the editor to described Java Virtual Machine is replacing the original Class files;
Java Virtual Machine 33, is used to load original Class files, and perform the volume for explaining after startup Class files after volume.
In one embodiment, it is preferred that, the client can include operating console and and communication module, Wherein:
The operating console submits the interactive interface of failure code to as user, receives the operation that user assigns Instruction;
Failure code is uploaded to master control end by the communication module.
In one embodiment, it is preferred that, the master control end can use Socket modes and the client Communicated.
In one embodiment, it is preferred that, the client can also include script correction verification module, for testing Whether the script that card user edits meets specification.
In one embodiment, it is preferred that, it is empty that the master control end can monitor the Java by JVMTI The ruuning situation of plan machine, and after the original Class files of the Java Virtual Machine loading are monitored, fetch The original Class files.
In one embodiment, it is preferred that, the master control end is designed as servo progress.
In one embodiment, it is preferred that, the master control end is realized to institute by calling following any software State the editor of original Class files:
Javassit, BCEL, ASM.
In one embodiment, it is preferred that, the master control end, will by calling the Agent in Java processes Class files after editor are uploaded to Java Virtual Machine by Agent, to replace the original Class texts Part.
In one embodiment, it is preferred that, the master control end can also include passback module, for by failure Result data is back to the client.
In the nineties in 20th century, it is changing on hardware that can clearly be distinguished for the improvement of a technology The improvement entered on (for example, the improvement to circuit structures such as diode, transistor, switches) or software is (right In the improvement of method flow).However, with the development of technology, the improvement of current many method flows is Through directly improving for hardware circuit can be considered as.Designer is nearly all by by improved method flow It is programmed into hardware circuit to obtain corresponding hardware circuit.Therefore, it cannot be said that method flow Improvement cannot be realized with hardware entities module.For example, PLD (Programmable Logic Device, PLD) (for example field programmable gate array (Field Programmable Gate Array, FPGA it is exactly)) such a integrated circuit, its logic function is determined by user to device programming.By setting Meter personnel are voluntarily programmed a digital display circuit " integrated " on a piece of PLD, without asking chip manufacturing Manufacturer designs and makes special IC chip.And, nowadays, substitution manually makes integrated electricity Road chip, this programming also uses " logic compiler (logic compiler) " software instead to realize mostly, it Software compiler used is similar when being write with program development, and the source code before compiling is also handy Specific programming language is write, and this is referred to as hardware description language (Hardware Description Language, HDL), and HDL is also not only a kind of, but have many kinds, such as ABEL (Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、 Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL (Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL (Ruby Hardware Description Language) etc., that most commonly use at present is VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art also will be apparent to the skilled artisan that only need to by method flow with above-mentioned several hardware description languages slightly Programming in logic is simultaneously programmed into integrated circuit, it is possible to be readily available the hardware for realizing the logical method flow Circuit.
Controller can be implemented in any suitable manner, for example, controller can take such as microprocessor Or processor and storage can be by computer readable program code (such as softwares of (micro-) computing device Or firmware) computer-readable medium, gate, switch, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), the form of programmable logic controller (PLC) and embedded microcontroller, controller Example include but is not limited to following microcontroller:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20 and Silicone Labs C8051F320, Memory Controller is also implemented as depositing A part for the control logic of reservoir.It is also known in the art that except with pure computer-readable program Code means are realized beyond controller, can cause to control by the way that method and step is carried out into programming in logic completely Device is with the shape of gate, switch, application specific integrated circuit, programmable logic controller (PLC) and embedded microcontroller etc. Formula realizes identical function.Therefore this controller is considered a kind of hardware component, and to bag in it The structure that the device for realizing various functions for including can also be considered as in hardware component.Or even, can be with To be used to realizing that the device of various functions is considered as not only being the software module of implementation method but also can be hardware Structure in part.
System, device, module or unit that above-described embodiment is illustrated, specifically can be by computer chip or reality Body is realized, or is realized by the product with certain function.
For convenience of description, it is divided into various units with function during description apparatus above to describe respectively.Certainly, The function of each unit can be realized in same or multiple softwares and/or hardware when the application is implemented.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or meter Calculation machine program product.Therefore, the present invention can be using complete hardware embodiment, complete software embodiment or knot Close the form of the embodiment in terms of software and hardware.And, the present invention can be used and wherein wrapped at one or more Containing computer usable program code computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) on implement computer program product form.
The present invention is produced with reference to method according to embodiments of the present invention, equipment (system) and computer program The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions realize flow chart and / or block diagram in each flow and/or the flow in square frame and flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions to all-purpose computer, special-purpose computer, insertion can be provided The processor of formula processor or other programmable data processing devices is producing a machine so that by calculating The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device of the function of being specified in individual flow or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or the treatment of other programmable datas to set In the standby computer-readable memory for working in a specific way so that storage is in the computer-readable memory Instruction produce include the manufacture of command device, the command device realization in one flow of flow chart or multiple The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and series of operation steps is performed on computer or other programmable devices to produce computer implemented place Reason, so as to the instruction performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple one square frame of flow and/or block diagram or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/output Interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM).It is interior Deposit be computer-readable medium example.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be by appointing What method or technique realizes information Store.Information can be computer-readable instruction, data structure, program Module or other data.The example of the storage medium of computer include, but are not limited to phase transition internal memory (PRAM), It is static RAM (SRAM), dynamic random access memory (DRAM), other kinds of random Access memory (RAM), read-only storage (ROM), Electrically Erasable Read Only Memory (EEPROM), Fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), digital multi light Disk (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus Or any other non-transmission medium, can be used to store the information that can be accessed by a computing device.According to herein Define, computer-readable medium does not include temporary computer readable media (transitory media), such as modulates Data-signal and carrier wave.
Also, it should be noted that term " including ", "comprising" or its any other variant be intended to non-row His property is included, so that process, method, commodity or equipment including a series of key elements not only include Those key elements, but also other key elements including being not expressly set out, or also include for this process, Method, commodity or the intrinsic key element of equipment.In the absence of more restrictions, by sentence " including One ... " key element that limits, it is not excluded that in the process including the key element, method, commodity or set Also there is other identical element in standby.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer journey Sequence product.Therefore, the application can using complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.And, the application can be used and wherein include calculating at one or more Machine usable program code computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, Optical memory etc.) on implement computer program product form.
The application can be described in the general context of computer executable instructions, example Such as program module.Usually, program module includes performing particular task or realizes particular abstract data type Routine, program, object, component, data structure etc..This can also in a distributed computing environment be put into practice Application, in these DCEs, by the remote processing devices connected by communication network come Execution task.In a distributed computing environment, program module may be located at including local including storage device In remote computer storage medium.
Each embodiment in this specification is described by the way of progressive, identical phase between each embodiment As part mutually referring to what each embodiment was stressed is the difference with other embodiment. For especially for system embodiment, because it is substantially similar to embodiment of the method, so the comparing of description Simply, the relevent part can refer to the partial explaination of embodiments of method.
Embodiments herein is the foregoing is only, the application is not limited to.For this area skill For art personnel, the application can have various modifications and variations.All institutes within spirit herein and principle Any modification, equivalent substitution and improvements of work etc., within the scope of should be included in claims hereof.

Claims (18)

1. a kind of method that java applet injects failure, it is characterised in that including:
Client receives the failure code of input, and the failure code is sent into master control end;
After Java Virtual Machine starts, original Class files are loaded;
The master control end monitors the ruuning situation of Java processes where the Java Virtual Machine, fetches the Java The original Class files of virtual machine loading;
The original Class files that the master control end is fetched according to the failure code editor, generation editor Class files afterwards;
Master control end is described original to replace by the Class files passes after the editor to the Java Virtual Machine Class files;
The Java Virtual Machine explains the Class files after performing the editor.
2. the method for claim 1, it is characterised in that the client includes operating console With and communication module, wherein:
The operating console submits the interactive interface of failure code to as user, receives the operation that user assigns Instruction;
Failure code is uploaded to master control end by the communication module.
3. the method for claim 1, it is characterised in that the master control end uses Socket modes Communicated with the client.
4. the method for claim 1, it is characterised in that the client is also verified including script Module, for verifying whether the script that user edits meets specification.
5. the method for claim 1, it is characterised in that it is empty that the master control end monitors the Java The ruuning situation of Java processes where plan machine, fetches the original Class files of the Java Virtual Machine loading, Including:
The master control end monitors the ruuning situation of the Java Virtual Machine by JVMTI, and is monitoring After the Java Virtual Machine loads original Class files, the original Class files are fetched.
6. the method for claim 1, it is characterised in that the master control end is designed as servo progress.
7. the method for claim 1, it is characterised in that appointed below by calling at the master control end One software realizes the editor to the original Class files:
Javassit, BCEL, ASM.
8. the method for claim 1, it is characterised in that the master control end is by after the editor Class files passes to the Java Virtual Machine replacing the original Class files, including:
The master control end is passed through the Class files after editor by calling the Agent in Java processes Agent is uploaded to Java Virtual Machine, to replace the original Class files.
9. the method for claim 1, it is characterised in that methods described also includes:
The master control end is by fail result data back to the client.
10. the system that a kind of java applet injects failure, it is characterised in that including:
Client, for receiving the failure code of input, and is sent to master control end by the failure code;
Master control end, the ruuning situation for monitoring Java processes where the Java Virtual Machine is fetched described The original Class files of Java Virtual Machine loading;That is fetched according to the failure code editor is original Class files, the Class files after generation editor;By the Class files passes after the editor to described Java Virtual Machine is replacing the original Class files;
Java Virtual Machine, is used to load original Class files, and perform the editor for explaining after startup Class files afterwards.
11. systems as claimed in claim 10, it is characterised in that the client includes operational control Platform and and communication module, wherein:
The operating console submits the interactive interface of failure code to as user, receives the operation that user assigns Instruction;
Failure code is uploaded to master control end by the communication module.
12. systems as claimed in claim 10, it is characterised in that the master control end uses Socket side Formula is communicated with the client.
13. systems as claimed in claim 10, it is characterised in that the client also includes script school Module is tested, for verifying whether the script that user edits meets specification.
14. systems as claimed in claim 10, it is characterised in that supervised by JVMTI at the master control end The ruuning situation of the Java Virtual Machine is controlled, and original Class is loaded the Java Virtual Machine is monitored After file, the original Class files are fetched.
15. systems as claimed in claim 10, it is characterised in that the master control end is designed as servo and enters Journey.
16. systems as claimed in claim 10, it is characterised in that the master control end is following by calling Any software realizes the editor to the original Class files:
Javassit, BCEL, ASM.
17. systems as claimed in claim 10, it is characterised in that the master control end is by calling Java Agent in process, is uploaded to Java Virtual Machine, to replace by the Class files after editor by Agent Change the original Class files.
18. systems as claimed in claim 10, it is characterised in that the master control end also includes passback mould Block, for by fail result data back to the client.
CN201510975340.0A 2015-12-22 2015-12-22 Method and system for injecting fault into Java program Active CN106909498B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510975340.0A CN106909498B (en) 2015-12-22 2015-12-22 Method and system for injecting fault into Java program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510975340.0A CN106909498B (en) 2015-12-22 2015-12-22 Method and system for injecting fault into Java program

Publications (2)

Publication Number Publication Date
CN106909498A true CN106909498A (en) 2017-06-30
CN106909498B CN106909498B (en) 2020-12-22

Family

ID=59200285

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510975340.0A Active CN106909498B (en) 2015-12-22 2015-12-22 Method and system for injecting fault into Java program

Country Status (1)

Country Link
CN (1) CN106909498B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182120A (en) * 2017-12-08 2018-06-19 广州视源电子科技股份有限公司 Interface call method and system, storage medium and computer equipment
CN108804271A (en) * 2018-06-28 2018-11-13 北京潘达互娱科技有限公司 Interface tolerating measure method and device
CN108964993A (en) * 2018-06-29 2018-12-07 郑州云海信息技术有限公司 Failure simulation method, device, equipment and readable storage medium storing program for executing based on dynamic proxy
CN110196790A (en) * 2018-02-24 2019-09-03 北京京东尚科信息技术有限公司 The method and apparatus of abnormal monitoring
CN110865919A (en) * 2019-11-04 2020-03-06 苏宁云计算有限公司 Java process-based monitoring method and device and computer equipment
CN111538665A (en) * 2020-04-27 2020-08-14 北京奇艺世纪科技有限公司 Program testing method and device, storage medium, and electronic device
CN111738543A (en) * 2020-05-13 2020-10-02 浙江口碑网络技术有限公司 Object making system and information processing method for object making
CN111786823A (en) * 2020-06-19 2020-10-16 中国工商银行股份有限公司 Fault simulation method and device based on distributed service
CN111797015A (en) * 2020-06-30 2020-10-20 中国工商银行股份有限公司 Testing method and device based on dynamic byte codes
CN111986707A (en) * 2020-08-21 2020-11-24 苏州浪潮智能科技有限公司 Disk link error injection method, exception handling test method and device
CN112445706A (en) * 2020-11-27 2021-03-05 深圳前海微众银行股份有限公司 Program abnormal code acquisition method and device, electronic equipment and storage medium
CN113535532A (en) * 2020-04-14 2021-10-22 ***通信集团浙江有限公司 Fault injection system, method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130007720A1 (en) * 2011-06-30 2013-01-03 International Business Machines Corporation Dynamic Isolated Debugging via Class Instrumentation
CN103699480A (en) * 2013-11-29 2014-04-02 杭州安恒信息技术有限公司 WEB dynamic security flaw detection method based on JAVA
CN103870383A (en) * 2012-12-11 2014-06-18 航天信息股份有限公司 Test coverage statistical method and system based on JVM
CN104657258A (en) * 2013-11-21 2015-05-27 腾讯科技(深圳)有限公司 Method and device for injecting Java bit codes into target process

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130007720A1 (en) * 2011-06-30 2013-01-03 International Business Machines Corporation Dynamic Isolated Debugging via Class Instrumentation
CN103870383A (en) * 2012-12-11 2014-06-18 航天信息股份有限公司 Test coverage statistical method and system based on JVM
CN104657258A (en) * 2013-11-21 2015-05-27 腾讯科技(深圳)有限公司 Method and device for injecting Java bit codes into target process
CN103699480A (en) * 2013-11-29 2014-04-02 杭州安恒信息技术有限公司 WEB dynamic security flaw detection method based on JAVA

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182120B (en) * 2017-12-08 2020-11-24 广州视源电子科技股份有限公司 Interface calling method and system, storage medium and computer equipment
CN108182120A (en) * 2017-12-08 2018-06-19 广州视源电子科技股份有限公司 Interface call method and system, storage medium and computer equipment
CN110196790A (en) * 2018-02-24 2019-09-03 北京京东尚科信息技术有限公司 The method and apparatus of abnormal monitoring
CN108804271A (en) * 2018-06-28 2018-11-13 北京潘达互娱科技有限公司 Interface tolerating measure method and device
CN108964993A (en) * 2018-06-29 2018-12-07 郑州云海信息技术有限公司 Failure simulation method, device, equipment and readable storage medium storing program for executing based on dynamic proxy
CN110865919A (en) * 2019-11-04 2020-03-06 苏宁云计算有限公司 Java process-based monitoring method and device and computer equipment
CN110865919B (en) * 2019-11-04 2023-11-28 苏宁云计算有限公司 Monitoring method and device based on java process and computer equipment
CN113535532A (en) * 2020-04-14 2021-10-22 ***通信集团浙江有限公司 Fault injection system, method and device
CN113535532B (en) * 2020-04-14 2023-11-10 ***通信集团浙江有限公司 Fault injection system, method and device
CN111538665A (en) * 2020-04-27 2020-08-14 北京奇艺世纪科技有限公司 Program testing method and device, storage medium, and electronic device
CN111738543A (en) * 2020-05-13 2020-10-02 浙江口碑网络技术有限公司 Object making system and information processing method for object making
CN111786823A (en) * 2020-06-19 2020-10-16 中国工商银行股份有限公司 Fault simulation method and device based on distributed service
CN111797015A (en) * 2020-06-30 2020-10-20 中国工商银行股份有限公司 Testing method and device based on dynamic byte codes
CN111797015B (en) * 2020-06-30 2024-02-09 中国工商银行股份有限公司 Dynamic byte code based test method and device
CN111986707A (en) * 2020-08-21 2020-11-24 苏州浪潮智能科技有限公司 Disk link error injection method, exception handling test method and device
CN111986707B (en) * 2020-08-21 2021-12-21 苏州浪潮智能科技有限公司 Disk link exception handling test method and device
CN112445706A (en) * 2020-11-27 2021-03-05 深圳前海微众银行股份有限公司 Program abnormal code acquisition method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN106909498B (en) 2020-12-22

Similar Documents

Publication Publication Date Title
CN106909498A (en) A kind of java applet injects the method and system of failure
CN108287694B (en) Application program construction method, system, computer device and storage medium
US6941546B2 (en) Method and apparatus for testing a software component using an abstraction matrix
CN106970873A (en) Mock method of testings, apparatus and system on line
US20160378627A1 (en) Flexible configuration and control of a testing system
US9971672B2 (en) Using emulation to disassociate verification from stimulus in functional test
US8892386B2 (en) Method and apparatus for post-silicon testing
Balasubramanian et al. Polyglot: modeling and analysis for multiple statechart formalisms
US8990622B2 (en) Post-silicon validation using a partial reference model
Jones et al. The new CMS event data model and framework
US10156611B2 (en) Executing code on a test instrument in response to an event
CN107678938A (en) The adjustment method and equipment of a kind of application program
CN107329899A (en) A kind of application compatibility method of testing and device
US8868976B2 (en) System-level testcase generation
CN109871312B (en) Interface testing method, device, equipment and readable storage medium
WO2015130675A2 (en) Apparatus and method for testing computer program implementation against a design model
CN110532185A (en) Test method, device, electronic equipment and computer readable storage medium
Bouajjani et al. Analysis of recursively parallel programs
CN107273300A (en) A kind of applied program testing method and device
CN109284222B (en) Software unit, project testing method, device and equipment in data processing system
CN113590454A (en) Test method, test device, computer equipment and storage medium
CN107291623A (en) A kind of applied program testing method and device
Kerraoui et al. MATT: multi agents testing tool based nets within nets
CN108334313A (en) Continuous integrating method, apparatus and code management system for large-scale SOC research and development
CN114791885A (en) Interface test method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20200924

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200924

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant