Kohei Nozaki's blog 

GitHubから取ってきたJavaの資源をビルドしてみる


Posted on Saturday Feb 15, 2014 at 01:22PM in Technology


jBeret (JSR352の実装) をGitHubから取ってきてjarファイルを作り、WildFlyに配置する手順のメモ

環境

  • Maven 3.1.1
  • Oracle JDK7u51
  • OS X 10.9.1

GitHubから取ってくる

kyle-no-MacBook:src kyle$ git clone git@github.com:jberet/jsr352.git
Cloning into 'jsr352'...
remote: Reusing existing pack: 7898, done.
remote: Counting objects: 179, done.
remote: Compressing objects: 100% (122/122), done.
remote: Total 8077 (delta 47), reused 0 (delta 0)
Receiving objects: 100% (8077/8077), 1.80 MiB | 118.00 KiB/s, done.
Resolving deltas: 100% (2712/2712), done.
Checking connectivity... done
kyle-no-MacBook:src kyle$ ls -ld jsr352
drwxr-xr-x+ 13 kyle  staff  442  2 15 08:58 jsr352
kyle-no-MacBook:src kyle$ ls -l jsr352
total 40
-rw-r--r--+  1 kyle  staff     83  2 15 08:58 README.md
drwxr-xr-x+  5 kyle  staff    170  2 15 09:03 jberet-core
drwxr-xr-x+  4 kyle  staff    136  2 15 08:58 jberet-distribution
drwxr-xr-x+  4 kyle  staff    136  2 15 08:58 jberet-jpa-repository
drwxr-xr-x+  4 kyle  staff    136  2 15 08:58 jberet-se
drwxr-xr-x+  4 kyle  staff    136  2 15 08:58 jberet-support
-rw-r--r--+  1 kyle  staff  12560  2 15 08:58 pom.xml
drwxr-xr-x+  5 kyle  staff    170  2 15 08:58 tck-porting-impl
drwxr-xr-x+ 13 kyle  staff    442  2 15 08:58 test-apps
kyle-no-MacBook:src kyle$ 

ビルド

kyle-no-MacBook:jberet-core kyle$ mvn clean compile jar:jar
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building jberet-core 1.0.1.Beta-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jberet-core ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-java-version) @ jberet-core ---
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-10/doxia-sink-api-1.0-alpha-10.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.jar
[WARNING] Checksum validation failed, no checksums available from the repository for http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.jar
Downloaded: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.jar (10 KB at 5.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-10/doxia-sink-api-1.0-alpha-10.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-10/doxia-sink-api-1.0-alpha-10.jar (10 KB at 11.7 KB/sec)
[INFO] 
[INFO] --- maven-enforcer-plugin:1.2:enforce (enforce-maven-version) @ jberet-core ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.2:create-timestamp (get-build-timestamp) @ jberet-core ---
Downloading: http://repository.jboss.org/nexus/content/groups/public/junit/junit/4.10/junit-4.10.pom
[WARNING] Checksum validation failed, no checksums available from the repository for http://repository.jboss.org/nexus/content/groups/public/junit/junit/4.10/junit-4.10.pom
Downloaded: http://repository.jboss.org/nexus/content/groups/public/junit/junit/4.10/junit-4.10.pom (3 KB at 2.1 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom
[WARNING] Checksum validation failed, no checksums available from the repository for http://repository.jboss.org/nexus/content/groups/public/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom
Downloaded: http://repository.jboss.org/nexus/content/groups/public/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom (481 B at 0.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/maven-plugin-api/2.0.1/maven-plugin-api-2.0.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.1/maven-plugin-api-2.0.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/2.0.1/maven-plugin-api-2.0.1.pom (643 B at 2.3 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/maven/2.0.1/maven-2.0.1.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.1/maven-2.0.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven/2.0.1/maven-2.0.1.pom (12 KB at 38.9 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-api/1.8/maven-scm-api-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-api/1.8/maven-scm-api-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-api/1.8/maven-scm-api-1.8.pom (2 KB at 5.5 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm/1.8/maven-scm-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm/1.8/maven-scm-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm/1.8/maven-scm-1.8.pom (21 KB at 54.2 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.3/plexus-utils-3.0.3.pom
Downloaded: http://repository.jboss.org/nexus/content/groups/public/org/codehaus/plexus/plexus-utils/3.0.3/plexus-utils-3.0.3.pom (3 KB at 3.6 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-manager-plexus/1.8/maven-scm-manager-plexus-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.8/maven-scm-manager-plexus-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.8/maven-scm-manager-plexus-1.8.pom (3 KB at 8.3 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-managers/1.8/maven-scm-managers-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-managers/1.8/maven-scm-managers-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-managers/1.8/maven-scm-managers-1.8.pom (2 KB at 5.8 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-bazaar/1.8/maven-scm-provider-bazaar-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-bazaar/1.8/maven-scm-provider-bazaar-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-bazaar/1.8/maven-scm-provider-bazaar-1.8.pom (3 KB at 8.0 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-providers/1.8/maven-scm-providers-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers/1.8/maven-scm-providers-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers/1.8/maven-scm-providers-1.8.pom (4 KB at 14.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/regexp/regexp/1.3/regexp-1.3.pom
[WARNING] Checksum validation failed, no checksums available from the repository for http://repository.jboss.org/nexus/content/groups/public/regexp/regexp/1.3/regexp-1.3.pom
Downloaded: http://repository.jboss.org/nexus/content/groups/public/regexp/regexp/1.3/regexp-1.3.pom (145 B at 0.1 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-svnexe/1.8/maven-scm-provider-svnexe-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svnexe/1.8/maven-scm-provider-svnexe-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svnexe/1.8/maven-scm-provider-svnexe-1.8.pom (3 KB at 9.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-providers-svn/1.8/maven-scm-providers-svn-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-svn/1.8/maven-scm-providers-svn-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-svn/1.8/maven-scm-providers-svn-1.8.pom (3 KB at 6.9 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-svn-commons/1.8/maven-scm-provider-svn-commons-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svn-commons/1.8/maven-scm-provider-svn-commons-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svn-commons/1.8/maven-scm-provider-svn-commons-1.8.pom (3 KB at 10.3 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-gitexe/1.8/maven-scm-provider-gitexe-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-gitexe/1.8/maven-scm-provider-gitexe-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-gitexe/1.8/maven-scm-provider-gitexe-1.8.pom (3 KB at 8.7 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-providers-git/1.8/maven-scm-providers-git-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-git/1.8/maven-scm-providers-git-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-git/1.8/maven-scm-providers-git-1.8.pom (3 KB at 8.5 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-git-commons/1.8/maven-scm-provider-git-commons-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-git-commons/1.8/maven-scm-provider-git-commons-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-git-commons/1.8/maven-scm-provider-git-commons-1.8.pom (3 KB at 7.3 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-cvsexe/1.8/maven-scm-provider-cvsexe-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvsexe/1.8/maven-scm-provider-cvsexe-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvsexe/1.8/maven-scm-provider-cvsexe-1.8.pom (3 KB at 8.3 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-providers-cvs/1.8/maven-scm-providers-cvs-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-cvs/1.8/maven-scm-providers-cvs-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-cvs/1.8/maven-scm-providers-cvs-1.8.pom (2 KB at 6.6 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.8/maven-scm-provider-cvs-commons-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.8/maven-scm-provider-cvs-commons-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.8/maven-scm-provider-cvs-commons-1.8.pom (3 KB at 8.2 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-starteam/1.8/maven-scm-provider-starteam-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-starteam/1.8/maven-scm-provider-starteam-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-starteam/1.8/maven-scm-provider-starteam-1.8.pom (3 KB at 8.5 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-clearcase/1.8/maven-scm-provider-clearcase-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-clearcase/1.8/maven-scm-provider-clearcase-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-clearcase/1.8/maven-scm-provider-clearcase-1.8.pom (3 KB at 9.6 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-perforce/1.8/maven-scm-provider-perforce-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-perforce/1.8/maven-scm-provider-perforce-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-perforce/1.8/maven-scm-provider-perforce-1.8.pom (3 KB at 9.6 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-hg/1.8/maven-scm-provider-hg-1.8.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-hg/1.8/maven-scm-provider-hg-1.8.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-hg/1.8/maven-scm-provider-hg-1.8.pom (3 KB at 8.6 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/com/google/code/maven-scm-provider-svnjava/maven-scm-provider-svnjava/1.13/maven-scm-provider-svnjava-1.13.pom
Downloading: http://repo.maven.apache.org/maven2/com/google/code/maven-scm-provider-svnjava/maven-scm-provider-svnjava/1.13/maven-scm-provider-svnjava-1.13.pom
Downloaded: http://repo.maven.apache.org/maven2/com/google/code/maven-scm-provider-svnjava/maven-scm-provider-svnjava/1.13/maven-scm-provider-svnjava-1.13.pom (10 KB at 31.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/sonatype/oss/oss-parent/5/oss-parent-5.pom
Downloaded: http://repository.jboss.org/nexus/content/groups/public/org/sonatype/oss/oss-parent/5/oss-parent-5.pom (4 KB at 4.6 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-svn-commons/1.5/maven-scm-provider-svn-commons-1.5.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svn-commons/1.5/maven-scm-provider-svn-commons-1.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svn-commons/1.5/maven-scm-provider-svn-commons-1.5.pom (3 KB at 7.9 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-providers-svn/1.5/maven-scm-providers-svn-1.5.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-svn/1.5/maven-scm-providers-svn-1.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers-svn/1.5/maven-scm-providers-svn-1.5.pom (3 KB at 8.0 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-providers/1.5/maven-scm-providers-1.5.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers/1.5/maven-scm-providers-1.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-providers/1.5/maven-scm-providers-1.5.pom (4 KB at 13.9 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm/1.5/maven-scm-1.5.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm/1.5/maven-scm-1.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm/1.5/maven-scm-1.5.pom (15 KB at 56.5 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-api/1.5/maven-scm-api-1.5.pom
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-api/1.5/maven-scm-api-1.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-api/1.5/maven-scm-api-1.5.pom (2 KB at 5.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/net/java/dev/jna/jna/3.2.2/jna-3.2.2.pom
Downloading: http://repo.maven.apache.org/maven2/net/java/dev/jna/jna/3.2.2/jna-3.2.2.pom
Downloaded: http://repo.maven.apache.org/maven2/net/java/dev/jna/jna/3.2.2/jna-3.2.2.pom (2 KB at 5.7 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/tmatesoft/svnkit/svnkit/1.3.5/svnkit-1.3.5.pom
Downloading: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/svnkit/1.3.5/svnkit-1.3.5.pom
Downloaded: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/svnkit/1.3.5/svnkit-1.3.5.pom (2 KB at 4.2 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/tmatesoft/svnkit/trilead-ssh2/build213-svnkit-1.3-patch/trilead-ssh2-build213-svnkit-1.3-patch.pom
Downloading: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/trilead-ssh2/build213-svnkit-1.3-patch/trilead-ssh2-build213-svnkit-1.3-patch.pom
Downloaded: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/trilead-ssh2/build213-svnkit-1.3-patch/trilead-ssh2-build213-svnkit-1.3-patch.pom (725 B at 2.5 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/tmatesoft/sqljet/sqljet/1.0.4/sqljet-1.0.4.pom
Downloading: http://repo.maven.apache.org/maven2/org/tmatesoft/sqljet/sqljet/1.0.4/sqljet-1.0.4.pom
Downloaded: http://repo.maven.apache.org/maven2/org/tmatesoft/sqljet/sqljet/1.0.4/sqljet-1.0.4.pom (771 B at 2.5 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/antlr/antlr-runtime/3.1.3/antlr-runtime-3.1.3.pom
Downloading: http://repo.maven.apache.org/maven2/org/antlr/antlr-runtime/3.1.3/antlr-runtime-3.1.3.pom
Downloaded: http://repo.maven.apache.org/maven2/org/antlr/antlr-runtime/3.1.3/antlr-runtime-3.1.3.pom (4 KB at 13.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/antlr/antlr-master/3.1.3/antlr-master-3.1.3.pom
Downloading: http://repo.maven.apache.org/maven2/org/antlr/antlr-master/3.1.3/antlr-master-3.1.3.pom
Downloaded: http://repo.maven.apache.org/maven2/org/antlr/antlr-master/3.1.3/antlr-master-3.1.3.pom (9 KB at 32.4 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/antlr/stringtemplate/3.2/stringtemplate-3.2.pom
Downloading: http://repo.maven.apache.org/maven2/org/antlr/stringtemplate/3.2/stringtemplate-3.2.pom
Downloaded: http://repo.maven.apache.org/maven2/org/antlr/stringtemplate/3.2/stringtemplate-3.2.pom (2 KB at 7.0 KB/sec)
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-api/1.8/maven-scm-api-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-manager-plexus/1.8/maven-scm-manager-plexus-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-bazaar/1.8/maven-scm-provider-bazaar-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/regexp/regexp/1.3/regexp-1.3.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-svnexe/1.8/maven-scm-provider-svnexe-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-gitexe/1.8/maven-scm-provider-gitexe-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-git-commons/1.8/maven-scm-provider-git-commons-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-svn-commons/1.8/maven-scm-provider-svn-commons-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-cvsexe/1.8/maven-scm-provider-cvsexe-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.8/maven-scm-provider-cvs-commons-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-starteam/1.8/maven-scm-provider-starteam-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-clearcase/1.8/maven-scm-provider-clearcase-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-perforce/1.8/maven-scm-provider-perforce-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/apache/maven/scm/maven-scm-provider-hg/1.8/maven-scm-provider-hg-1.8.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/com/google/code/maven-scm-provider-svnjava/maven-scm-provider-svnjava/1.13/maven-scm-provider-svnjava-1.13.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/tmatesoft/svnkit/svnkit/1.3.5/svnkit-1.3.5.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/tmatesoft/svnkit/trilead-ssh2/build213-svnkit-1.3-patch/trilead-ssh2-build213-svnkit-1.3-patch.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/tmatesoft/sqljet/sqljet/1.0.4/sqljet-1.0.4.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/antlr/antlr-runtime/3.1.3/antlr-runtime-3.1.3.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/org/antlr/stringtemplate/3.2/stringtemplate-3.2.jar
Downloading: http://repository.jboss.org/nexus/content/groups/public/net/java/dev/jna/jna/3.2.2/jna-3.2.2.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-api/1.8/maven-scm-api-1.8.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.8/maven-scm-manager-plexus-1.8.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-bazaar/1.8/maven-scm-provider-bazaar-1.8.jar
Downloading: http://repo.maven.apache.org/maven2/regexp/regexp/1.3/regexp-1.3.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svnexe/1.8/maven-scm-provider-svnexe-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-api/1.8/maven-scm-api-1.8.jar (103 KB at 151.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-gitexe/1.8/maven-scm-provider-gitexe-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-manager-plexus/1.8/maven-scm-manager-plexus-1.8.jar (11 KB at 12.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-git-commons/1.8/maven-scm-provider-git-commons-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/regexp/regexp/1.3/regexp-1.3.jar (25 KB at 25.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svn-commons/1.8/maven-scm-provider-svn-commons-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-gitexe/1.8/maven-scm-provider-gitexe-1.8.jar (62 KB at 149.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvsexe/1.8/maven-scm-provider-cvsexe-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svnexe/1.8/maven-scm-provider-svnexe-1.8.jar (75 KB at 61.6 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.8/maven-scm-provider-cvs-commons-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-bazaar/1.8/maven-scm-provider-bazaar-1.8.jar (54 KB at 42.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-starteam/1.8/maven-scm-provider-starteam-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvsexe/1.8/maven-scm-provider-cvsexe-1.8.jar (30 KB at 99.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-clearcase/1.8/maven-scm-provider-clearcase-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-git-commons/1.8/maven-scm-provider-git-commons-1.8.jar (37 KB at 61.4 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-svn-commons/1.8/maven-scm-provider-svn-commons-1.8.jar (40 KB at 86.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-perforce/1.8/maven-scm-provider-perforce-1.8.jar
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-hg/1.8/maven-scm-provider-hg-1.8.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.8/maven-scm-provider-cvs-commons-1.8.jar (79 KB at 141.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/com/google/code/maven-scm-provider-svnjava/maven-scm-provider-svnjava/1.13/maven-scm-provider-svnjava-1.13.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-clearcase/1.8/maven-scm-provider-clearcase-1.8.jar (70 KB at 163.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/svnkit/1.3.5/svnkit-1.3.5.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-starteam/1.8/maven-scm-provider-starteam-1.8.jar (73 KB at 122.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/trilead-ssh2/build213-svnkit-1.3-patch/trilead-ssh2-build213-svnkit-1.3-patch.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-perforce/1.8/maven-scm-provider-perforce-1.8.jar (80 KB at 120.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/tmatesoft/sqljet/sqljet/1.0.4/sqljet-1.0.4.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/scm/maven-scm-provider-hg/1.8/maven-scm-provider-hg-1.8.jar (65 KB at 97.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/antlr/antlr-runtime/3.1.3/antlr-runtime-3.1.3.jar
Downloaded: http://repo.maven.apache.org/maven2/com/google/code/maven-scm-provider-svnjava/maven-scm-provider-svnjava/1.13/maven-scm-provider-svnjava-1.13.jar (51 KB at 114.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/antlr/stringtemplate/3.2/stringtemplate-3.2.jar
Downloaded: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/trilead-ssh2/build213-svnkit-1.3-patch/trilead-ssh2-build213-svnkit-1.3-patch.jar (246 KB at 262.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/net/java/dev/jna/jna/3.2.2/jna-3.2.2.jar
Downloaded: http://repo.maven.apache.org/maven2/org/antlr/antlr-runtime/3.1.3/antlr-runtime-3.1.3.jar (148 KB at 191.0 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/antlr/stringtemplate/3.2/stringtemplate-3.2.jar (168 KB at 236.3 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/net/java/dev/jna/jna/3.2.2/jna-3.2.2.jar (839 KB at 450.2 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/tmatesoft/svnkit/svnkit/1.3.5/svnkit-1.3.5.jar (1845 KB at 414.9 KB/sec)
Downloaded: http://repo.maven.apache.org/maven2/org/tmatesoft/sqljet/sqljet/1.0.4/sqljet-1.0.4.jar (727 KB at 166.2 KB/sec)
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.2:create (get-scm-revision) @ jberet-core ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /Users/kyle/src/jsr352/jberet-core && git rev-parse --verify HEAD
[INFO] Working directory: /Users/kyle/src/jsr352/jberet-core
[INFO] Storing buildNumber: 70bfa6de5c01f000de0ca1772f7639f956289c76 at timestamp: 1392422639073
[INFO] Executing: /bin/sh -c cd /Users/kyle/src/jsr352/jberet-core && git rev-parse --verify HEAD
[INFO] Working directory: /Users/kyle/src/jsr352/jberet-core
[INFO] Storing buildScmBranch: UNKNOWN
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jberet-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ jberet-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 61 source files to /Users/kyle/src/jsr352/jberet-core/target/classes
[WARNING] ブートストラップ・クラスパスが-source 1.6と一緒に設定されていません
[WARNING] 次のオプションはどのプロセッサでも認識されませんでした: '[org.jboss.logging.tools.level]'
[WARNING] /Users/kyle/src/jsr352/jberet-core/src/main/java/org/jberet/runtime/runner/JobExecutionRunner.java:[74,38] 最終パラメータの不正確な引数型を持った可変引数メソッドの非可変引数呼出し。
  可変引数呼出しに関してはjava.lang.Objectにキャストします。
  非可変引数呼出しに関してはjava.lang.Object[]にキャストしてこの警告を出さないようにします
[WARNING] /Users/kyle/src/jsr352/jberet-core/src/main/java/org/jberet/runtime/context/JobContextImpl.java: 入力ファイルの操作のうち、未チェックまたは安全ではないものがあります。
[WARNING] /Users/kyle/src/jsr352/jberet-core/src/main/java/org/jberet/runtime/context/JobContextImpl.java: 詳細は、-Xlint:uncheckedオプションを指定して再コンパイルしてください。
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-cli) @ jberet-core ---
[INFO] Building jar: /Users/kyle/src/jsr352/jberet-core/target/jberet-core-1.0.1.Beta-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 54.764s
[INFO] Finished at: Sat Feb 15 09:04:02 JST 2014
[INFO] Final Memory: 19M/310M
[INFO] ------------------------------------------------------------------------
kyle-no-MacBook:main kyle$ ls -l  /Users/kyle/src/jsr352/jberet-core/target/jberet-core-1.0.1.Beta-SNAPSHOT.jar
-rw-r--r--+ 1 kyle  staff  185155  2 15 09:04 /Users/kyle/src/jsr352/jberet-core/target/jberet-core-1.0.1.Beta-SNAPSHOT.jar
kyle-no-MacBook:main kyle$ 

よくわからないけどMavenが自動的に依存関係のあるライブラリを集めてきてくれて、ビルドが走りめでたくjarファイルができました

然るべき場所に配置

  1. $WILDFLY_HOME/modules/system/layers/base/org/jberet/jberet-core/mainにjarファイルを配置
  2. 同じディレクトリにあるmodule.xmlを書き換える。こんな感じ。書き換えたら再起動
<module xmlns="urn:jboss:module:1.1" name="org.jberet.jberet-core">
    <properties>
        <property name="jboss.api" value="private"/>
    </properties>

    <resources>
        <resource-root path="jberet-core-1.0.1.Beta-SNAPSHOT.jar"/>
        <!-- Insert resources here -->
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javaee.api"/>
        <module name="javax.transaction.api"/>
        <module name="org.jboss.jts"/>
        <module name="org.jboss.marshalling"/>
        <module name="org.jboss.logging"/>
        <module name="com.h2database.h2" optional="true"/>
        <module name="com.google.guava"/>
    </dependencies>
</module>


JBeret1.0.0 skip problem


Posted on Friday Feb 14, 2014 at 10:07PM in Technology


Problem

  • skippable-exception-classes not worked expectedly
  • I declared a exception to my jobXML, but it seems just ignored. my batch job stopped at exception and failed.

Environment

  • WildFly8.0.0.Final
  • Oracle JDK7u51

Project to reproduce the problem

  • Entire the project is available at GitHub

Spec

  • ItemReader supplies int array which contains 3 items
  • ItemProcessor throws RuntimeException at second item
  • RuntimeException declared in skippable-exception-classes

How to reproduce

  1. Deploy the project
  2. Browse http://localhost:8080/jsr352-skip/
    • servlet kicks the batch job
  3. Check log of application server and job repository

Log

22:03:49,505 INFO  [stdout] (batch-batch - 1) readItem: 1
22:03:49,505 INFO  [stdout] (batch-batch - 1) process: i=1, item=1
22:03:49,506 INFO  [stdout] (batch-batch - 1) readItem: 2
22:03:49,506 ERROR [org.jberet] (batch-batch - 1) JBERET000007: Failed to run job skip, doChunk, org.jberet.job.model.Chunk@50e84eee: java.lang.RuntimeException: I want to skip this!
at example.ExampleItemProcessor.processItem(ExampleItemProcessor.java:14) [classes:]
at org.jberet.runtime.runner.ChunkRunner.processItem(ChunkRunner.java:396) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:295) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:193) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:204) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)

Repository

job_execution

jbatch=# select * from job_execution order by jobexecutionid desc limit 1;
 jobexecutionid | jobinstanceid | version |       createtime        |        starttime        |         endtime         |     lastupdatedtime     | batchstatus | exitstatus | jobparameters | restartposition
----------------+---------------+---------+-------------------------+-------------------------+-------------------------+-------------------------+-------------+------------+---------------+-----------------
            101 |            96 |         | 2014-02-14 22:03:49.478 | 2014-02-14 22:03:49.478 | 2014-02-14 22:03:49.515 | 2014-02-14 22:03:49.515 | FAILED      | FAILED     |               |
(1 row)

jbatch=# 

step_execution

jbatch=# select * from step_execution where jobexecutionid =101;
 stepexecutionid | jobexecutionid | version | stepname |        starttime        |         endtime         | batchstatus | exitstatus |                                                       executionexception                                                       | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount | readercheckpointinfo | writercheckpointinfo 
-----------------+----------------+---------+----------+-------------------------+-------------------------+-------------+------------+--------------------------------------------------------------------------------------------------------------------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------+----------------------
             116 |            101 |         | doChunk  | 2014-02-14 22:03:49.489 | 2014-02-14 22:03:49.508 | FAILED      | FAILED     | java.lang.RuntimeException: I want to skip this!                                                                              +|                    |         2 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
                 |                |         |          |                         |                         |             |            |         at example.ExampleItemProcessor.processItem(ExampleItemProcessor.java:14)                                             +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.ChunkRunner.processItem(ChunkRunner.java:396)                                            +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:295)                                  +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:193)                                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:204)                     +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162)                      +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88)     +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58)                                       +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149)+|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)                                            +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.FutureTask.run(FutureTask.java:262)                                                           +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.lang.Thread.run(Thread.java:744)                                                                              +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jboss.threads.JBossThread.run(JBossThread.java:122)                                                            +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |                                                                                                                                |                    |           |            |             |               |               |                  |             |                |                      | 
(1 row)

jbatch=# 

Worked expectedly in GlassFish4.0

Log

2014-02-14T22:02:27.017+0900|情報: readItem: 1
2014-02-14T22:02:27.017+0900|情報: process: i=1, item=1
2014-02-14T22:02:27.017+0900|情報: readItem: 2
2014-02-14T22:02:27.017+0900|情報: readItem: 3
2014-02-14T22:02:27.017+0900|情報: process: i=3, item=3
2014-02-14T22:02:27.017+0900|情報: readItem: null
2014-02-14T22:02:27.017+0900|情報: write: [1, 3]

Repository

kyle-no-MacBook:bin kyle$ ./asadmin list-batch-jobs
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
JOBNAME  INSTANCECOUNT 
skip     1             
Command list-batch-jobs executed successfully.
kyle-no-MacBook:bin kyle$ ./asadmin list-batch-job-steps -l 1
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
STEPNAME  STEPID  STARTTIME                     ENDTIME                       BATCHSTATUS  EXITSTATUS  STEPMETRICS                  
doChunk   1       Fri Feb 14 22:02:26 JST 2014  Fri Feb 14 22:02:27 JST 2014  COMPLETED    COMPLETED   METRICNAME          VALUE   
                                                                                                       READ_COUNT          3       
                                                                                                       WRITE_COUNT         2       
                                                                                                       COMMIT_COUNT        1       
                                                                                                       ROLLBACK_COUNT      0       
                                                                                                       READ_SKIP_COUNT     0       
                                                                                                       PROCESS_SKIP_COUNT  1       
                                                                                                       FILTER_COUNT        0       
                                                                                                       WRITE_SKIP_COUNT    0       
Command list-batch-job-steps executed successfully.
kyle-no-MacBook:bin kyle$ 

References


Chunk方式のStepの再実行時の挙動を確かめてみる


Posted on Thursday Feb 13, 2014 at 05:54PM in Technology


適切に実装されたChunk orientedのStepは、異常終了したジョブの再実行の際、処理済みのデータをスキップして未だ処理されていないデータのみを処理対象とする事が可能である。動作を確かめてみる。

環境・前提条件

Chunk方式のStepを使ってみると同じ。この記事で作ったプロジェクトや資源がすでに存在するものとする

準備

  • 資源の詳細はこのあたり
  • エンティティ、テストデータ等は流用する

バッチを構成する資源

chunkrestart.xml

  • Stepは1つ
  • あるジョブ引数を与えるとItemReaderで例外が起こりジョブが死ぬ

ChunkRestartItemReader.java

  • @BatchPropertyで与えられた引数に指定された番号のデータに達すると例外を投げて死ぬ
  • 引数がない場合は死なない

ChunkRestartItemProcessor.java

  • 一応コピーして作ったけど完全に前回と同じ

ChunkRestartItemWriter.java

  • 一応コピーして作ったけど完全に前回と同じ

テスト用資源

ChunkRestartJobTest.java

  • テスト内容は以下
    • テストメソッドitemReaderFailAt5(): 6件目のデータに達したところで異常終了する。item-count=3なので出力テーブルには3件目までが出力される
    • テストメソッドitemReaderRestart(): 異常終了後の再実行で10件目まで処理を完走する

expected0-2.yml

  • itemReaderFailAt5()の期待結果。3件だけ

実行してみる

どちらも正常だが内容はほぼかぶっているのでitemReaderRestart()の実行結果だけ見てみる

ログ

長いので初回実行部分と再実行部分を分ける

初回実行部分

18:45:00,733 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 8) postConstruct(): divide=2
18:45:00,733 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) open(): checkpoint=null, index starts at=0
18:45:00,737 DEBUG [org.hibernate.SQL] (batch-batch - 8) select chunkinput0_.id as id1_0_, chunkinput0_.input as input2_0_, chunkinput0_.processed as processe3_0_ from ChunkInputItem chunkinput0_ order by chunkinput0_.id
18:45:00,740 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) open(): checkpoint=null, index starts at=0
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): index=0
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): returning=ChunkInputItem [id=0, input=0, processed=false]
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 8) processItem(): input=ChunkInputItem [id=0, input=0, processed=false], output=ChunkOutputItem [id=0, result=0]
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=1
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): index=1
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): returning=ChunkInputItem [id=1, input=10, processed=false]
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 8) processItem(): input=ChunkInputItem [id=1, input=10, processed=false], output=ChunkOutputItem [id=1, result=5]
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=2
18:45:00,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): index=2
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): returning=ChunkInputItem [id=2, input=20, processed=false]
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 8) processItem(): input=ChunkInputItem [id=2, input=20, processed=false], output=ChunkOutputItem [id=2, result=10]
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=3
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) writeItems(): index=0
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) writeItems(): item=ChunkOutputItem [id=0, result=0]
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) writeItems(): item=ChunkOutputItem [id=1, result=5]
18:45:00,742 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) writeItems(): item=ChunkOutputItem [id=2, result=10]
18:45:00,743 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=3
18:45:00,743 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) checkpointInfo(): returns=1
18:45:00,744 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=3
18:45:00,748 DEBUG [org.hibernate.SQL] (batch-batch - 8) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:00,750 DEBUG [org.hibernate.SQL] (batch-batch - 8) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:00,750 DEBUG [org.hibernate.SQL] (batch-batch - 8) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:00,779 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): index=3
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): returning=ChunkInputItem [id=3, input=30, processed=false]
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 8) processItem(): input=ChunkInputItem [id=3, input=30, processed=false], output=ChunkOutputItem [id=3, result=15]
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=4
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): index=4
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): returning=ChunkInputItem [id=4, input=40, processed=false]
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 8) processItem(): input=ChunkInputItem [id=4, input=40, processed=false], output=ChunkOutputItem [id=4, result=20]
18:45:00,780 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) checkpointInfo(): returns=5
18:45:00,781 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) readItem(): index=5
18:45:00,781 ERROR [org.jberet] (batch-batch - 8) JBERET000007: Failed to run job chunkrestart, doChunk, org.jberet.job.model.Chunk@53aaf456: java.lang.RuntimeException: 5
    at org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader.readItem(ChunkRestartItemReader.java:43) [classes:]
    at org.jberet.runtime.runner.ChunkRunner.readItem(ChunkRunner.java:346) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:291) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:193) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:204) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

18:45:00,783 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 8) close()
18:45:00,783 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 8) close()

再実行分

18:45:01,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) postConstruct(): divide=2
18:45:01,741 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) open(): checkpoint=3, index starts at=3
18:45:01,742 DEBUG [org.hibernate.SQL] (batch-batch - 9) select chunkinput0_.id as id1_0_, chunkinput0_.input as input2_0_, chunkinput0_.processed as processe3_0_ from ChunkInputItem chunkinput0_ order by chunkinput0_.id
18:45:01,744 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) open(): checkpoint=1, index starts at=1
18:45:01,745 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=3
18:45:01,745 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=3, input=30, processed=false]
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=3, input=30, processed=false], output=ChunkOutputItem [id=3, result=15]
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=4
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=4
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=4, input=40, processed=false]
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=4, input=40, processed=false], output=ChunkOutputItem [id=4, result=20]
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=5
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=5
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=5, input=50, processed=false]
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=5, input=50, processed=false], output=ChunkOutputItem [id=5, result=25]
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=6
18:45:01,746 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): index=1
18:45:01,747 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=3, result=15]
18:45:01,747 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=4, result=20]
18:45:01,747 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=5, result=25]
18:45:01,747 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=6
18:45:01,747 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) checkpointInfo(): returns=2
18:45:01,749 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=6
18:45:01,749 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,750 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,750 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=6
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=6, input=60, processed=false]
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=6, input=60, processed=false], output=ChunkOutputItem [id=6, result=30]
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=7
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=7
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=7, input=70, processed=false]
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=7, input=70, processed=false], output=ChunkOutputItem [id=7, result=35]
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=8
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=8
18:45:01,776 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=8, input=80, processed=false]
18:45:01,777 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=8, input=80, processed=false], output=ChunkOutputItem [id=8, result=40]
18:45:01,777 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=9
18:45:01,777 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): index=2
18:45:01,777 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=6, result=30]
18:45:01,777 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=7, result=35]
18:45:01,777 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=8, result=40]
18:45:01,778 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=9
18:45:01,778 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) checkpointInfo(): returns=3
18:45:01,779 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=9
18:45:01,779 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,780 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,781 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=9
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=ChunkInputItem [id=9, input=90, processed=false]
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemProcessor] (batch-batch - 9) processItem(): input=ChunkInputItem [id=9, input=90, processed=false], output=ChunkOutputItem [id=9, result=45]
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=10
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): index=10
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) readItem(): returning=null
18:45:01,807 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): index=3
18:45:01,808 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) writeItems(): item=ChunkOutputItem [id=9, result=45]
18:45:01,808 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=10
18:45:01,808 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) checkpointInfo(): returns=4
18:45:01,809 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) checkpointInfo(): returns=10
18:45:01,810 DEBUG [org.hibernate.SQL] (batch-batch - 9) insert into ChunkOutputItem (result, id) values (?, ?)
18:45:01,835 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) close()
18:45:01,835 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) close()
18:45:01,836 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader] (batch-batch - 9) close()
18:45:01,836 FINE  [org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemWriter] (batch-batch - 9) close()

ItemReaderのopen()に3が渡されてStepの実行が開始されているのがわかる。結果4件目から処理が再開され問題なく完走。

Repository

jbatch=# select * from step_execution where jobexecutionid in (30, 31) order by jobexecutionid, stepexecutionid;
 stepexecutionid | jobexecutionid | version | stepname |        starttime        |         endtime         | batchstatus | exitstatus |                                                       executionexception                                                       | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount |                                                                         readercheckpointinfo                                                                         |                                                                         writercheckpointinfo                                                                         
-----------------+----------------+---------+----------+-------------------------+-------------------------+-------------+------------+--------------------------------------------------------------------------------------------------------------------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------
              46 |             30 |         | doChunk  | 2014-02-13 18:45:00.73  | 2014-02-13 18:45:00.782 | FAILED      | FAILED     | java.lang.RuntimeException: 5                                                                                                 +|                    |         5 |          3 |           1 |             0 |             0 |                0 |           0 |              0 | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b020000787000000003 | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b020000787000000001
                 |                |         |          |                         |                         |             |            |         at org.nailedtothex.jbatch.example.chunkrestart.ChunkRestartItemReader.readItem(ChunkRestartItemReader.java:43)       +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.ChunkRunner.readItem(ChunkRunner.java:346)                                               +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.ChunkRunner.readProcessWriteItems(ChunkRunner.java:291)                                  +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.ChunkRunner.run(ChunkRunner.java:193)                                                    +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:204)                     +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131)                                    +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162)                      +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88)     +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58)                                       +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149)+|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)                                            +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.FutureTask.run(FutureTask.java:262)                                                           +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)                                    +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)                                    +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at java.lang.Thread.run(Thread.java:744)                                                                              +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |         at org.jboss.threads.JBossThread.run(JBossThread.java:122)                                                            +|                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
                 |                |         |          |                         |                         |             |            |                                                                                                                                |                    |           |            |             |               |               |                  |             |                |                                                                                                                                                                      | 
              47 |             31 |         | doChunk  | 2014-02-13 18:45:01.739 | 2014-02-13 18:45:01.836 | COMPLETED   | COMPLETED  |                                                                                                                                |                    |         7 |          7 |           3 |             0 |             0 |                0 |           0 |              0 | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b02000078700000000a | \xaced0005737200116a6176612e6c616e672e496e746567657212e2a0a4f781873802000149000576616c7565787200106a6176612e6c616e672e4e756d62657286ac951d0b94e08b020000787000000004
(2 rows)

jbatch=# 

備考

  • ItemProcessorとかItemWriterでもそのうち試してみる。たぶん同じだろうけど


WildFly8.0.0.Finalで出るGuavaのNoClassDefFoundErrorの対処


Posted on Thursday Feb 13, 2014 at 04:24PM in Technology


環境

  • WildFly8.0.0.Final

問題

JSR352で実装したバッチからわざと例外を発生させると、こんな感じのstacktraceが出る

16:16:11,934 FINE  [org.nailedtothex.jbatch.example.aric.ExceptionBatchlet] (batch-batch - 10) process(): stepName=step1, exception=null
16:16:11,955 FINE  [org.nailedtothex.jbatch.example.aric.ExceptionBatchlet] (batch-batch - 10) process(): stepName=step2, exception=null
16:16:11,963 FINE  [org.nailedtothex.jbatch.example.aric.ExceptionBatchlet] (batch-batch - 10) process(): stepName=step3, exception=true
16:16:11,963 WARN  [org.jberet] (batch-batch - 10) JBERET000001: Failed to run batchlet org.jberet.job.model.RefArtifact@495db27a: java.lang.RuntimeException: true
at org.nailedtothex.jbatch.example.aric.ExceptionBatchlet.process(ExceptionBatchlet.java:27) [classes:]
at org.jberet.runtime.runner.BatchletRunner.run(BatchletRunner.java:61) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:207) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)

16:16:11,965 ERROR [org.jberet] (batch-batch - 10) JBERET000007: Failed to run job aric, step3, org.jberet.job.model.Step@30fbce4d: java.lang.NoClassDefFoundError: com/google/common/base/Throwables
at org.jberet.repository.JdbcRepository.formatException(JdbcRepository.java:924) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.repository.JdbcRepository.updateStepExecution(JdbcRepository.java:606) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.repository.JdbcRepository.savePersistentData(JdbcRepository.java:635) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.context.StepContextImpl.savePersistentData(StepContextImpl.java:165) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:144) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)

16:16:11,965 ERROR [org.jberet] (batch-batch - 10) JBERET000007: Failed to run job aric, , org.jberet.job.model.Job@2dd10b: java.lang.NoClassDefFoundError: com/google/common/base/Throwables
at org.jberet.repository.JdbcRepository.formatException(JdbcRepository.java:924) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.repository.JdbcRepository.updateStepExecution(JdbcRepository.java:606) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:173) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)

例外はわざと出しているからこれでいいのだが、気になるのはこの部分

java.lang.NoClassDefFoundError: com/google/common/base/Throwables

このせいで何かの処理が正常に動いてないと思われる。

対処: jberetのmodule.xmlにguavaへのdependencyを追加してやる

$WILDFLY_HOME/modules/system/layers/base/org/jberet/jberet-core/main/module.xmlのdependenciesの一番最後に以下の内容を追加してやる。

<module name="com.google.guava"/>

全体はこうなる

<module xmlns="urn:jboss:module:1.1" name="org.jberet.jberet-core">
    <properties>
        <property name="jboss.api" value="private"/>
    </properties>

    <resources>
        <resource-root path="jberet-core-1.0.0.Final.jar"/>
        <!-- Insert resources here -->
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javaee.api"/>
        <module name="javax.transaction.api"/>
        <module name="org.jboss.jts"/>
        <module name="org.jboss.marshalling"/>
        <module name="org.jboss.logging"/>
        <module name="com.h2database.h2" optional="true"/>
        <module name="com.google.guava"/>
    </dependencies>
</module>

これで再起動すれば、jberetからWildFlyに元々入っているguavaのjarファイルが見えるようになるようだ。再起動後は、先ほどのバッチが出すstacktraceがこんな感じになる

16:23:10,913 FINE  [org.nailedtothex.jbatch.example.aric.ExceptionBatchlet] (batch-batch - 1) process(): stepName=step1, exception=null
16:23:10,937 FINE  [org.nailedtothex.jbatch.example.aric.ExceptionBatchlet] (batch-batch - 1) process(): stepName=step2, exception=null
16:23:10,943 FINE  [org.nailedtothex.jbatch.example.aric.ExceptionBatchlet] (batch-batch - 1) process(): stepName=step3, exception=true
16:23:10,943 WARN  [org.jberet] (batch-batch - 1) JBERET000001: Failed to run batchlet org.jberet.job.model.RefArtifact@21eec7fc: java.lang.RuntimeException: true
    at org.nailedtothex.jbatch.example.aric.ExceptionBatchlet.process(ExceptionBatchlet.java:27) [classes:]
    at org.jberet.runtime.runner.BatchletRunner.run(BatchletRunner.java:61) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:207) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58) [jberet-core-1.0.0.Final.jar:1.0.0.Final]
    at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149) [wildfly-jberet-8.0.0.Final.jar:8.0.0.Final]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)

さらにstacktraceがRepositoryに残るようになる。こんな感じ。たぶんこれやるところで死んでたんだと思う。ちょっとすごい

jbatch=# select * from step_execution where jobexecutionid =15 order by stepexecutionid;;
 stepexecutionid | jobexecutionid | version | stepname |        starttime        |         endtime         | batchstatus | exitstatus |                                                       executionexception                                                       | persistentuserdata | readcount | writecount | commitcount | rollbackcount | readskipcount | processskipcount | filtercount | writeskipcount | readercheckpointinfo | writercheckpointinfo 
-----------------+----------------+---------+----------+-------------------------+-------------------------+-------------+------------+--------------------------------------------------------------------------------------------------------------------------------+--------------------+-----------+------------+-------------+---------------+---------------+------------------+-------------+----------------+----------------------+----------------------
              17 |             15 |         | step1    | 2014-02-13 16:23:10.894 | 2014-02-13 16:23:10.914 | COMPLETED   | SUCCESS    |                                                                                                                                |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
              18 |             15 |         | step2    | 2014-02-13 16:23:10.93  | 2014-02-13 16:23:10.937 | COMPLETED   | SUCCESS    |                                                                                                                                |                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
              19 |             15 |         | step3    | 2014-02-13 16:23:10.941 | 2014-02-13 16:23:10.945 | FAILED      | FAILED     | java.lang.RuntimeException: true                                                                                              +|                    |         0 |          0 |           0 |             0 |             0 |                0 |           0 |              0 |                      | 
                 |                |         |          |                         |                         |             |            |         at org.nailedtothex.jbatch.example.aric.ExceptionBatchlet.process(ExceptionBatchlet.java:27)                          +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.BatchletRunner.run(BatchletRunner.java:61)                                               +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.runBatchletOrChunk(StepExecutionRunner.java:207)                     +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:131)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162)                      +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126)                +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162)                      +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runJobElement(CompositeExecutionRunner.java:126)                +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.StepExecutionRunner.run(StepExecutionRunner.java:177)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runStep(CompositeExecutionRunner.java:162)                      +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.CompositeExecutionRunner.runFromHeadOrRestartPoint(CompositeExecutionRunner.java:88)     +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jberet.runtime.runner.JobExecutionRunner.run(JobExecutionRunner.java:58)                                       +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.wildfly.jberet.services.BatchEnvironmentService$WildFlyBatchEnvironment$1.run(BatchEnvironmentService.java:149)+|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)                                            +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.FutureTask.run(FutureTask.java:262)                                                           +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)                                    +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at java.lang.Thread.run(Thread.java:744)                                                                              +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |         at org.jboss.threads.JBossThread.run(JBossThread.java:122)                                                            +|                    |           |            |             |               |               |                  |             |                |                      | 
                 |                |         |          |                         |                         |             |            |                                                                                                                                |                    |           |            |             |               |               |                  |             |                |                      | 
(3 rows)

jbatch=# 

単純に書き漏れたのだろうか。次のリリースでは直っていることを祈る


Logging with log4j appenders


Posted on Thursday Feb 13, 2014 at 10:59AM in Technology


  • We can use WildFly's logging mechanism with log4j appenders.

Environment

  • WildFly 8.0.0.Final
  • Oracle JDK7u51
  • OS X 10.9.2

Precondition

  • Ensure we already have a logger named “hoge.logger1”.
  • I will use this servlet to logging test.
package logger;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/")
public class LogServlet extends HttpServlet {
    private static final org.slf4j.Logger SLF4J_LOGGER1 = org.slf4j.LoggerFactory.getLogger("hoge.logger1");

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        StringBuilder sb = new StringBuilder(1200);
        for(int i=0; i<1200; i++){
            sb.append(i%10);
        }

        SLF4J_LOGGER1.info("0-1199: {}", sb);
        SLF4J_LOGGER1.info("exception logging test", new AssertionError("test"));
    }
}
  • Log4j is shipped with out-of-box WildFly8 so we don't need any preparation about log4j.

Defining with org.apache.log4j.FileAppender

Create an custom-handler named “LOG4J_FILE”

/subsystem=logging/custom-handler=LOG4J_FILE:add( \
 class="org.apache.log4j.FileAppender", \
 module="org.apache.log4j", \
 named-formatter=PATTERN, \
 level=INFO, \
 properties={ \
  File="/tmp/log4jtest.log", \
  Append=true})

Assign the handler to a logger

/subsystem=logging/logger=hoge.logger1:assign-handler(name=LOG4J_FILE)

Output

2014-03-07 14:57:46,538 INFO  [hoge.logger1] (default task-10) 0-1199: 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
2014-03-07 14:57:46,538 INFO  [hoge.logger1] (default task-10) exception logging test: java.lang.AssertionError: test
        at logger.LogServlet.doGet(LogServlet.java:22) [classes:]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

Defining with org.apache.log4j.net.SyslogAppender

Create an custom-handler named “LOG4J_SYSLOG”

/subsystem=logging/custom-handler=LOG4J_SYSLOG:add( \
 class="org.apache.log4j.net.SyslogAppender", \
 module="org.apache.log4j", \
 formatter="%-5p [%c] (%t) %s%E%n", \
 level=INFO, \
 properties={ \
  Header=true, \
  syslogHost="localhost:514", \
  facility="local1", \
  facilityPrinting=false})

Assign the handler to a logger

/subsystem=logging/logger=hoge.logger1:assign-handler(name=LOG4J_SYSLOG)

Output

Mar  7 15:02:33 kyle-no-MacBook.local INFO  [hoge.logger1] (default task-1) 0-119]: 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456...
Mar  7 15:02:33 kyle-no-MacBook.local Unknown: ...78901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
Mar  7 15:02:33 kyle-no-MacBook.local INFO  [hoge.logger1] (default task-1) exception logging tes]: java.lang.AssertionError: test
                at logger.LogServlet.doGet(LogServlet.java:22) [classes:]
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
Mar  7 15:02:33 kyle-no-MacBook.local ...est(SecurityContextAssociationHandler.java: 78)
                at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
Mar  7 15:02:33 kyle-no-MacBook.local ...Handler.handleRequest(CachedAuthenticatedSessionHandler.java: 70) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
Mar  7 15:02:33 kyle-no-MacBook.local ...ertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java: 227) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
                at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

Conclusion

  • Anyway, we can use log4j appenders with custom-handler surely.
  • But something goes wrong with exception logging with SyslogAppender.
    • Some parts of stacktraces were lost.
    • The last digit of message strings are replaced by ']'.

References

  1. [AS7-4925] Log4j appenders should also be allowed for custom handlers - JBoss Issue Tracker
  2. Log4jAppenderHandler usage | Community
  3. #8059525 - Pastie
  4. Use Log4j appender as custom-handler in AS 7.1…. | Community
  5. Magnus K Karlsson: How to setup log4j Syslog Appender in JBoss EAP 6
  6. Programming fun at startup: log4j TCP SyslogAppender