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> java
Note:- 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-9
and_
.
- The valid characters that can be used in the project name are
wa-create.sh javaApp java
The
javaApp
directory is created under/home/wazi/data
. - Replace the
- Transfer or copy source files to be scanned into
the
/home/wazi/data/<project-name>/source
directory. 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.dat
file in the /home/wazi/ directory as the configuration file, run the following command:wa-scan.sh javaApp /home/wazi/javaApp.dat
The 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.log
You 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 Wazi Analyze server. For more information, see Starting up and shutting down the server.
- Access scan results by using one of the following methods.
- Use Wazi Analyze APIs. For more information, see Using Wazi Analyze APIs.
- View the impact analysis graphs from Application Discovery. For more information, see Java Call Graph. Note:
The first time you configure integration between AD and Wazi Analyze, the /home/wazi/data directory is mounted to the directory on the Application Discovery server. The original data in this directory, the
project
directory and theGenAppC
sample project, will no longer be available. You can restore both theproject
directory and theGenAppC
sample 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.txt
file to be restored later. For more information, see Backing up project data.After you complete the configuration, the /home/wazi/data directory on the Wazi Analyze container and the mounted location on Application Discovery 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.