This topic explains how to configure monitoring for any Java application. When a properly-configured Event Monitor tool is placed in the beginning of a test suite that includes tests which invoke that Java application (directly or indirectly), it will receive and visualize the Java events that take place.
Sections include:
SOAtest provides Java runtime error detection and Java event monitoring capabilities via integration with Parasoft Jtest, which facilitates a broad range of test and analysis practices for Java. Before you use SOAtest’s runtime error detection and/or Java event monitoring capabilities, ensure that 1) Jtest is installed on your machine 2) SOAtest's "Jtest Connect" license option is enabled. To get Jtest, go to https://www.parasoft.com/jtest, then click the Download link at the top of the page. Note that this cross-product capability requires Jtest and SOAtest to be installed in one of the following ways:
|
By monitoring instrumented Java applications, you can gain visibility into the application’s internal behavior as functional tests execute. This allows you to better identify the causes of test failures as well as enrich the use case validation criteria in your regression tests. In addition to validating the messages returned by the system and the intermediate messages/steps monitored via the ESB, you can also validate events within the Java application being invoked. For example, you can validate that an EJB method call or a remote call to another system is taking place with the expected parameters.
To configure the application for monitoring, you need to instrument it with Parasoft’s monitoring agent. To do this:
insure.jar
and insureimpl.jar
from [Jtest_install_dir]/plugins/com.parasoft.xtest.jtest_[version]/resources/
to a directory on the server with the application you wish to instrument.-javaagent command
to the existing Java arguments.The server will start as usual, but with the specified package classes instrumented. Now, whenever instances of objects are created or methods within the specified package prefixes are invoked, SOAtest (which can be running from another developer/QA desktop machine) will be able to receive event notifications in Event Monitor.
The following invocation-time parameters are required in all situations:
Specifies which port should be used to communicate with the monitored program. Use 5050 to 5099.
Parameter | Description |
---|---|
soatest | Required for configuring monitoring. |
port=[port_number] | Specifies which port should be used to communicate with the monitored program. Use 5050 to 5099. |
instrument= [class_name.method_name(jni _sig)] | Specifies the prefixes of fully-qualified methods to check. For instance, given the See the note below for more details. |
trace=[class_name.method_na me(jni_sig)] | Specifies the filter for method calls to trace. See the note below for more details. |
Instrumentation of a class applies to all of its method bodies; it provides visibility, for example, into what methods that class calls and what values those methods return. Tracing is implemented by also instrumenting the caller of the code you want to visibility into. The called code is not instrumented. For example, assume you want to trace third-party methods called from your code, but not third-party methods called from other third-party code. In this case, you would instrument your own code, and trace the calls to the third-party code. More, specifically....
|
The following parameters are optional:
Parameter | Description |
---|---|
trace_to_xml | Tells the monitor to serialize complex Java object into an XML representation. If this option is omitted, only primitive and "toString()" values of Objects will be returned. This parameter is strongly recommended for use with Event Monitor. It is not applicable if you are performing only runtime error detection. |
xmlsizelimit=[integer_value] | Determines the maximum XML size limit in bytes. The default size is 100000 if this option is not specified. Applies only when trace_to_xml is used. |
xmlcolsizelimit=[integer_value] | When generating an XML representation of Java objects, determines the maximum number of elements shown for collections/maps/arrays. The first 100 elements are shown by default. Applies only when trace_to_xml is used. |
xmldeeplimit=[integer_value] | When generating an XML representation of Java objects, determines the maximum field depth included for data structures. Fields up to a depth of 8 are included by default. Applies only when trace_to_xml is used. |
xmlexcl=[classes_or_fields] | ':' separated classes or fields to exclude from xml serialization (i.e. xmlexcl=com.acme.A:com.acme.B._field). |
xmlinc=[classes_or_fields] | ':' separated classes or fields to always include in xml serialization (i.e.xmlinc=com.acme.A:com.acme.B._field) Matches for xmlinc take preference over matches for xmlexcl: if something matches xmlinc, it will always be shown— even if xmlexcl also matches it. When the pattern matches a class name, 1) fields of that class type or a derived type are excluded from serialization and 2) method arguments and return values of that type or derived ones will not be serialized to xml. By default, the monitor excludes classes of the following types: .......................... Applies only when trace_to_xml is used. |
xmlsecondslimit=[seconds] | By default, if you are using trace_to_xml, the monitoring will spend only up to 10 seconds to convert a monitored complex Java object to an XML representation. This is to prevent significant slow-downs in the monitoring agent when monitoring very large objects. If that limit is reached, then the SOAtest event will show the following message instead of the XML representation of an object: SKIPPED: converting to XML takes too long: 10 seconds If you wish to change that 10 second threshold, use the xmlsecondslimit flag. example: xmlsecondslimit=20 For large objects, the recommended approach is to avoid reaching the threshold in the first place: reduce the XML size by excluding the fields you are not interested (using the xmlecl option). |
trace_exceptions[=exception_c lass_prefix] | Shows a trace of events related to an exception that was created, thrown, or caught.
|
terse | Configures terse output to the console (stack traces have only 1 element). |
Applications that define their own class loaders (i.e. Eclipse, JBoss and Tomcat) need insure.jar
added to the boot classpath. To monitor those applications, add to the launch VM arguments:
-javaagent:"<path_to_jar>\insure.jar=soatest,port=<port>",trace_to_xml,instrument=<my.pack-age.prefix>,trace=<my.package.prefix> -Xbootclasspath/a<path_to_jar>\insure.jar |
For instance, you may use:
-javaagent:"/home/user/parasoft/insure.jar=soatest,port=5060",trace_to_xml,instru- ment=com.mycompany.onlinestore,trace=com.mycompany.onlinestore -Xbootclasspath/a:/home/user/parasoft/insure.jar |
For other (standalone) Java applications, you do NOT need to add insure.jar
to the boot classpath. For instance, you may use:
java -javaagent:"C:\Program Files\Parasoft\insure.jar=soatest,port=5050",trace_to_xml,instru-ment=com.mycompany.myapp,trace=com.mycompany.myapp |
mlsizelimit
). In these cases, consider using the various xml* parameters above to control the content you are interested in and limit the amount of data.