Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-3797

Spring Boot jar containing kjar and commons-beanutils causes "Could not read pom in jar" error.

    XMLWordPrintable

Details

    • False
    • False
    • ER1
    • ?
    • Undefined
    • Hide
      • Prerequisites
        • Business Central is installed (and has admin user "rhpamAdmin" password "RedHat1!") and started.
        • (Optional) byteman 4.0.14 is installed on /path/to/byteman-download-4.0.14.
      • How to build
        $ unzip reproducer_business-application_1a.zip
        $ cd reproducer_business-application_1a
        $ cd business-application-model
        $ mvn clean install
        $ cd ../business-application-kjar
        $ mvn clean install
        $ cd ../business-application-service
        $ mvn clean install
        
      • How to reproduce the issue
        $ mv ~/.m2/repository ~/.m2/repository.org
        $ ./launch-dev.sh
        
      • To see exceptions thrown internally, modify launch-dev.sh like below and then run it.
        (From)
        java -Dspring.profiles.active=dev -jar "$executable"
        #java \
        # -Djboss.modules.system.pkgs=org.jboss.byteman \
        # -javaagent:/path/to/byteman-download-4.0.14/lib/byteman.jar=script:./byteman/script.btm,boot:/path/to/byteman-download-4.0.14/lib/byteman.jar \
        # -Dspring.profiles.active=dev -jar "$executable"
        

        (To)

        #java -Dspring.profiles.active=dev -jar "$executable"
        java \
         -Djboss.modules.system.pkgs=org.jboss.byteman \
         -javaagent:/path/to/byteman-download-4.0.14/lib/byteman.jar=script:./byteman/script.btm,boot:/path/to/byteman-download-4.0.14/lib/byteman.jar \
         -Dspring.profiles.active=dev -jar "$executable"
        
      Show
      Prerequisites Business Central is installed (and has admin user "rhpamAdmin" password "RedHat1!") and started. (Optional) byteman 4.0.14 is installed on /path/to/byteman-download-4.0.14 . How to build $ unzip reproducer_business-application_1a.zip $ cd reproducer_business-application_1a $ cd business-application-model $ mvn clean install $ cd ../business-application-kjar $ mvn clean install $ cd ../business-application-service $ mvn clean install How to reproduce the issue $ mv ~/.m2/repository ~/.m2/repository.org $ ./launch-dev.sh To see exceptions thrown internally, modify launch-dev.sh like below and then run it. (From) java -Dspring.profiles.active=dev -jar "$executable" #java \ # -Djboss.modules.system.pkgs=org.jboss.byteman \ # -javaagent:/path/to/byteman-download-4.0.14/lib/byteman.jar=script:./byteman/script.btm,boot:/path/to/byteman-download-4.0.14/lib/byteman.jar \ # -Dspring.profiles.active=dev -jar "$executable" (To) #java -Dspring.profiles.active=dev -jar "$executable" java \ -Djboss.modules.system.pkgs=org.jboss.byteman \ -javaagent:/path/to/byteman-download-4.0.14/lib/byteman.jar=script:./byteman/script.btm,boot:/path/to/byteman-download-4.0.14/lib/byteman.jar \ -Dspring.profiles.active=dev -jar "$executable"
    • 2021 Week 28-30 (from Jul 12), 2021 Week 31-33 (from Aug 2)

    Description

      There is a Spring Boot application (based on business-application-{model,kjar,service} generated from start.jbpm.org) which contains Kie Server and also contains business-application-kjar by configuration (*1) with properties (*2). After adding a dependency to commons-beanutils (1.9.4.redhat-00002) in business-application-kjar/pom.xml like (*3) for using functions of it, an error "Could not read pom in jar" like (*e) occurs while the Spring Boot application is launching.

      (*e)

      [main] ERROR o.a.m.i.InJarArtifactResolver - Could not read pom in jar jar:file:/path/to/reproducer_business-application_1a/business-application-service/target/business-application-service-1.0-SNAPSHOT.jar!/BOOT-INF/classes/KIE-INF/lib/commons-beanutils-1.9.4.redhat-00002.jar!/META-INF/maven/commons-beanutils/commons-beanutils/pom.xml
      

      When the error occurs at start-up, the Kie Server in the Spring Boot application is actually trying to look for some artifacts in local maven repository (~/.m2/repository). So, we can avoid the error (*e) by installing those artifacts in the local maven repository in advance like (*4), but originally the Spring Boot application should be able to start independently without installing artifacts in the local maven repository.

      (*1) There is the following description in business-application-service/pom.xml.

      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>kie-maven-plugin</artifactId>
        <version>${version.org.kie}</version>
        <executions>
          <execution>
            <id>copy</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>package-dependencies-kjar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <artifactItems>
            <artifactItem>
              <groupId>com.company</groupId>
              <artifactId>business-application-kjar</artifactId>
              <version>1.0-SNAPSHOT</version>
            </artifactItem>
          </artifactItems>
        </configuration>
      </plugin>
      

      (*2) There are two lines in business-application-service/src/main/resources/application-dev.properties.

      kieserver.classPathContainer=true
      kieserver.autoScanDeployments=true
      

      (*3) There is a dependency to commons-beanutils-1.9.4.redhat-00002.jar in business-application-kjar/pom.xml.

      <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.4.redhat-00002</version>
      </dependency>
      

      (*4)

      .m2/repository
      └── org
          ├── apache
          │   ├── apache
          │   │   └── 19.0.0.redhat-00001
          │   │       ├── apache-19.0.0.redhat-00001.pom
          │   │       └── apache-19.0.0.redhat-00001.pom.sha1
          │   └── commons
          │       └── commons-parent
          │           └── 47.0.0.redhat-00001
          │               ├── commons-parent-47.0.0.redhat-00001.pom
          │               └── commons-parent-47.0.0.redhat-00001.pom.sha1
          └── jboss
              └── jboss-parent
                  └── 19.0.0.redhat-2
                      ├── jboss-parent-19.0.0.redhat-2.pom
                      └── jboss-parent-19.0.0.redhat-2.pom.sha1
      

      Attachments

        Issue Links

          Activity

            People

              elguardian@gmail.com Enrique González Martínez (Inactive)
              rhn-support-myoshida Masato Yoshida
              Antonio Fernandez Alhambra Antonio Fernandez Alhambra (Inactive)
              Antonio Fernandez Alhambra Antonio Fernandez Alhambra (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: