8.3.5. Initial Setup of the Nablarch Batch Project without DB connection

The following is procedures of initial setup of the Nablarch batch project without DB connection:

  • Generate the Nablarch batch project without DB connection
  • Confirm communications of the Nablarch batch project without DB connection

8.3.5.1. Overview of the generated project

The overview of the project generated by this procedure is as follows.

Item Description
Project type Maven project
Project composition Single project composition
What is included in the generated project?

The following is included in the generated project:

  • Basic configuration for the Nablarch batch application
  • On-demand batch application for communication confirmation
  • Initial configuration of the tool that operates in conjunction with Maven (is imported by referring to nablarch-archetype-parent (parent project)).

For relationship with other projects and directories, see Maven Archetype Configuration.

8.3.5.2. Create blank project

Generate a blank project using the archetypes provided by Nablarch.

8.3.5.2.1. Execute the mvn command

Change the current directory to the directory where the blank project (can be any directory) is to be created, and place the following file.

Batch file

After placing the file, specify the necessary parameters in the arguments and execute the bat file.

generateNablarchBatchDblessProject.bat 5u24 <<groupId>> <<artifactId>> <<version>> <<package(optional)>>

The parameters configured in the above command are as follows. If you want to change the version of Nablarch, change 5u24. Change the current directory to the directory where the blank project (can be any directory) is to be created.

Input item Description Configuration example
groupId Group ID (normally, enter the package name) com.example
artifactId Artifact ID myapp-batch-dbless
version Version number 0.1.0
package Package (normally the same as group ID) com.example

Important

Item groupId and package are mapped to the Java package name. Use lowercase letters, numbers, and dots for these input values, and do not use hyphens.

If the command ends normally, a blank project is created under the current directory.

8.3.5.3. Communication confirmation (on-demand batch)

8.3.5.3.1. Automated test (on-demand batch)

The following unit tests are included in the project generated from the archetype.

Unit test classes Test content
SampleBatchActionRequestTest Use the Nablarch testing framework to check if the batch can be launched.

Execute the unit test and confirm that the blank project was successfully generated.

Execute the following command.

cd myapp-batch-dbless
mvn test

If the execution is successful, the log given below will be output to the console.

(omitted)
[INFO] -------------------< com.example:myapp-batch-dbless >-------------------
[INFO] Building myapp-batch-dbless 0.1.0
[INFO] --------------------------------[ jar ]---------------------------------
(omitted)
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
(rest is omitted)

8.3.5.3.2. Launch test (on-demand batch)

The on-demand batch is included in the generated project.

Batch class Details
SampleAction Confirm communications of the Nablarch functions commonly used when implementing batch applications.

Confirm that the blank project has been successfully generated by launching on-demand batch.

8.3.5.3.2.1. Build a batch application

If the current directory is not yet moved to the generated project, move the directory.

cd myapp-batch-dbless

Execute the following command to build the batch application.

mvn package

8.3.5.3.2.2. Launching the on-demand batch application

Execute the following command.

mvn exec:java -Dexec.mainClass=nablarch.fw.launcher.Main ^
    -Dexec.args="'-diConfig' 'classpath:batch-boot.xml' '-requestPath' 'SampleBatch' '-userId' 'batch_user'"

If the launch is successful, the log given below will be output to the console.

2020-04-28 08:56:23.353 -INFO- com.example.SampleBatch [202004280856233530002] boot_proc = [] proc_sys = [batch] req_id = [SampleBatch] usr_id = [batch_user] 疎通確認を開始します。
2020-04-28 08:56:23.383 -INFO- com.example.SampleBatch [202004280856233530002] boot_proc = [] proc_sys = [batch] req_id = [SampleBatch] usr_id = [batch_user] 疎通確認が完了しました。
2020-04-28 08:56:23.396 -INFO- nablarch.fw.handler.MultiThreadExecutionHandler [202004280856233470001] boot_proc = [] proc_sys = [batch] req_id = [SampleBatch] usr_id = [batch_user]
Thread Status: normal end.
Thread Result:[200 Success] The request has succeeded.
2020-04-28 08:56:23.413 -INFO- nablarch.fw.launcher.Main [null] boot_proc = [] proc_sys = [batch] req_id = [null] usr_id = [null] @@@@ END @@@@ exit code = [0] execute time(ms) = [559]

8.3.5.4. Supplementary notes

For information on the method of confirming the data of H2 and tools included in the blank project, see Initial Setup Procedure Supplementary Information.