Scanning a Java application
Learn how to scan a Java™ application for impact analysis.
- If you have not yet done so, start the container and launch the container terminal.
- Create a project for Java source by running the following command.
wa-create.sh <project-name> javaNote:- Replace the
<project-name>with the name of your project.- The valid characters that can be used in the project name are
A-Z,a-z,0-9and_.
- The valid characters that can be used in the project name are
wa-create.sh javaApp javaThe
javaAppdirectory is created under/home/wazi/data. - Replace the
- Transfer or copy source files to be scanned into
the
/home/wazi/data/<project-name>/sourcedirectory. Also copy any extra jar files (aside from standard java) that your application requires into this same directory. - Scan the source files by running the following
command.
wa-scan.sh <project-name> <dat-file-path><project-name>is an optional parameter to specify the name of the project that you are scanning. If the parameter is not specified, the default project is scanned.<dat-file-path>is an optional parameter to specify the absolute path and the name of the configuration file (.dat). If the parameter is not specified, the default path is used to find the configuration file. The default path is /home/wazi/data/<project-name>/<project-name>.dat.For example, to scan Java source files in the javaApp project and use thejavaApp.datfile in the /home/wazi/ directory as the configuration file, run the following command:wa-scan.sh javaApp /home/wazi/javaApp.datThe scan results are in the sub-directories of /home/wazi/data/<project-name>.
- For a summary of error messages, check the /home/wazi/data/<project-name>/<project-name>.log file.
- For complete scan results, check the /home/wazi/data/<project-name>/Output/Scan.log file.
- View the scan log files. Fix the errors that are reported and scan the source files again. For
more information about how to fix common scan errors , see Understanding the scanning messages in the scan log file. Note:
- You can use any text editor to view or edit the file.
- If you use the VI editor, you can run the following command to open the file.
vi /home/wazi/data/<project-name>/Output/Scan.logYou can use the following keys to change the editing mode of VI editor:- Press i to go to edit mode.
- Press Esc + :wq to save and exit.
- Press Esc + :q! to exit without saving.
- When no errors are found in the scan results, start the ADDI Local Analysis server. For more information, see Starting up and shutting down the server.
- Access scan results by using one of the following methods.
- Use ADDI Local Analysis APIs. For more information, see Using ADDI Local Analysis APIs.
- View the impact analysis graphs from ADDI. For more
information, see Java Call Graph. Note:
The first time you configure integration between ADDI and ADDI Local Analysis, the /home/wazi/data directory is mounted to the directory on the ADDI server. The original data in this directory, the
projectdirectory and theGenAppCsample project, will no longer be available. You can restore both theprojectdirectory and theGenAppCsample project from the /home/wazi/templates/data directory, if needed.In the case that you have additional projects that are created or scan results in the default project, you need to back up the entire data directory and
autoDB.txtfile to be restored later. For more information, see Backing up project data.After you complete the configuration, the /home/wazi/data directory on the ADDI Local Analysis container and the mounted location on ADDI server will be synchronized automatically. At this point, if you have the project data that you backed up earlier, you can restore it to the data directory.