Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-19827

Maven builds via Maven Project Plugin in Jenkins fail when using the openjpa-maven-plugin with enhance goal

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Blocker Blocker
    • maven-plugin
    • None
    • Windows Server 2008 R2
      Java 1.7

      I have a Maven project with JPA classes that use the openjpa-maven-plugin to enhance the entities at compile via the enhance goal of the plugin.

      From Jenkins, I use the Jenkins Maven project plugin to build my Maven projects.

      When I instruct the plugin to use these Maven args:

      clean install -DskipTests

      The plugin fails:

      Parsing POMs
      Downloaded artifact http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/entsvc/evm/evm-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      Downloaded artifact http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/entsvc/entsvc-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      Downloaded artifact http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/gaig-master-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      [workspace] $ java -Xmx512m -XX:MaxPermSize=1024m -cp "E:\Program Files\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-agent-1.4.jar;E:\Program Files\Apache\Maven\boot\plexus-classworlds-2.4.2.jar;E:\Program Files\Apache\Maven/conf/logging" jenkins.maven3.agent.Maven31Main "E:\Program Files\Apache\Maven" "E:\Program Files\Jenkins\war\WEB-INF\lib\remoting-2.32.jar" "E:\Program Files\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven31-interceptor-1.4.jar" "E:\Program Files\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.4.jar" 49300
      <===[JENKINS REMOTING CAPACITY]===>channel started
      log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
      log4j:WARN Please initialize the log4j system properly.
      Executing Maven: -B -f E:\Program Files\Jenkins\jobs\EAI EVM Enterprise Domain Model\workspace\pom.xml clean install deploy -DskipTests
      [INFO] Scanning for projects...
      [INFO] Downloading: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/entsvc/evm/evm-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      [INFO] Downloaded: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/entsvc/evm/evm-parent/1.0.0-SNAPSHOT/maven-metadata.xml (832 B at 2.8 KB/sec)
      [INFO] Downloading: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/entsvc/entsvc-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      [INFO] Downloaded: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/entsvc/entsvc-parent/1.0.0-SNAPSHOT/maven-metadata.xml (831 B at 12.9 KB/sec)
      [INFO] Downloading: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/gaig-master-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      [INFO] Downloaded: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/gaig-master-parent/1.0.0-SNAPSHOT/maven-metadata.xml (829 B at 13.3 KB/sec)
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building GAIG Annuity EAI EVM Enterprise Domain Model 1.0.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] Downloading: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/commons/model-commons/1.0.0-SNAPSHOT/maven-metadata.xml
      [INFO] Downloaded: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/commons/model-commons/1.0.0-SNAPSHOT/maven-metadata.xml (2 KB at 10.8 KB/sec)
      [INFO] Downloading: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/commons/commons-parent/1.0.0-SNAPSHOT/maven-metadata.xml
      [INFO] Downloaded: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/commons/commons-parent/1.0.0-SNAPSHOT/maven-metadata.xml (833 B at 8.8 KB/sec)
      [INFO] Downloading: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/commons/gaig-commons/1.0.0-SNAPSHOT/maven-metadata.xml
      [INFO] Downloaded: http://repo.aag.gfrinc.net/nexus/content/groups/public/com/gaig/annuity/commons/gaig-commons/1.0.0-SNAPSHOT/maven-metadata.xml (2 KB at 13.7 KB/sec)
      [INFO]
      [INFO] — maven-clean-plugin:2.5:clean (default-clean) @ evm-model —
      [TASKS] Scanning folder 'E:\Program Files\Jenkins\jobs\EAI EVM Enterprise Domain Model\workspace' for files matching the pattern '*/.java' - excludes:
      [TASKS] Found 17 files to scan for tasks
      Found 0 open tasks.
      [TASKS] Computing warning deltas based on reference build #129
      [INFO]
      [INFO] — maven-resources-plugin:2.6:resources (default-resources) @ evm-model —
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 1 resource
      [INFO]
      [INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ evm-model —
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 9 source files to E:\Program Files\Jenkins\jobs\EAI EVM Enterprise Domain Model\workspace\target\classes
      [INFO]
      [INFO] — openjpa-maven-plugin:2.2.2:enhance (enhancer) @ evm-model —
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 19.995s
      [INFO] Finished at: Tue Oct 01 06:57:00 EDT 2013
      [INFO] Final Memory: 13M/34M
      [INFO] ------------------------------------------------------------------------

      Notice the immediate failure after the line:

      openjpa-maven-plugin:2.2.2:enhance (enhancer)

      There's no details about what the error is.

      When I run a normal mvn clean install -DskipTests from Jenkins as a batch command, it builds as expected. This used to work at one point. My only guess is the plugin was broken at some point.

          [JENKINS-19827] Maven builds via Maven Project Plugin in Jenkins fail when using the openjpa-maven-plugin with enhance goal

          Chris,

          I tried to reproduce this issue with Jenkins 1.536, Maven Integration Plugin 2.0 and Java 1.7.0_25 without success.

          Can you try with these versions or give some more details like the versions you use and a project example?

          I've attached to the issue the project that I use for the tests.

          Regards.

          Marcelo Rebasti

          Marcelo Rebasti added a comment - Chris, I tried to reproduce this issue with Jenkins 1.536, Maven Integration Plugin 2.0 and Java 1.7.0_25 without success. Can you try with these versions or give some more details like the versions you use and a project example? I've attached to the issue the project that I use for the tests. Regards. Marcelo Rebasti

          Chris Jaehnen added a comment -

          After installing 2.0 of the integration plugin, I'm now getting this error:

          [ERROR] Failed to execute goal org.apache.openjpa:openjpa-maven-plugin:2.2.2:enhance (enhancer) on project audit-model: Execution enhancer of goal org.apache.openjpa:openjpa-maven-plugin:2.2.2:enhance failed: java.lang.ClassNotFoundException: com.gaig.annuity.entsvc.audit.model.entity.AuditActivity -> [Help 1]
          [JENKINS] Archiving E:\Program Files\Jenkins\jobs\EAI Audit Enterprise Domain Model\workspace\pom.xml to com.gaig.annuity.entsvc.audit/audit-model/1.1.0-SNAPSHOT/audit-model-1.1.0-SNAPSHOT.pom
          [ERROR]
          [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
          [ERROR] Re-run Maven using the -X switch to enable full debug logging.
          [ERROR]
          [ERROR] For more information about the errors and possible solutions, please read the following articles:
          [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
          channel stopped

          I've verified this entity class exists in the proper place.

          After more debugging locally, when I set the tmpClassLoader to "true" in the open-jpa-maven plugin, I get this same error locally. Is there something about the integration plugin that's enabling the temporary class loader?

          Here's my jpa model pom:

          <?xml version="1.0" encoding="UTF-8"?>
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

          <modelVersion>4.0.0</modelVersion>

          <parent>
          <groupId>com.gaig.annuity.entsvc.audit</groupId>
          <artifactId>audit-parent</artifactId>
          <version>1.0.0</version>
          </parent>

          <artifactId>audit-model</artifactId>
          <version>1.1.0-SNAPSHOT</version>
          <packaging>jar</packaging>
          <name>GAIG Annuity EAI Audit Enterprise Domain Model</name>

          <!-- SCM configuration -->
          <scm>
          <connection>${scm.host}:${scm.workspace}:${scm.location}</connection>
          <developerConnection>${scm.host}:${scm.workspace}:${scm.location}</developerConnection>
          <url>${scm.host}:${scm.workspace}:${scm.location}</url>
          </scm>

          <dependencies>
          <!-- GAIG Annuity Test Dependencies -->
          <dependency>
          <groupId>com.gaig.annuity.commons</groupId>
          <artifactId>model-commons</artifactId>
          <version>1.0.0</version>
          <scope>test</scope>
          <type>test-jar</type>
          </dependency>
          </dependencies>

          <build>
          <plugins>
          <!-- OpenJPA plugin for enhancing entity classes at compile time -->
          <plugin>
          <groupId>org.apache.openjpa</groupId>
          <artifactId>openjpa-maven-plugin</artifactId>
          <version>${maven.openpja.plugin.version}</version>
          <configuration><tmpClassLoader></tmpClassLoader>
          <includes>${openjpa.includes}</includes>
          <addDefaultConstructor>true</addDefaultConstructor>
          <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
          <persistenceXmlFile>${basedir}/src/main/resources/META-INF/audit/persistence.xml</persistenceXmlFile>
          </configuration>
          <executions>
          <execution>
          <id>enhancer</id>
          <phase>
          process-classes
          </phase>
          <goals>
          <goal>enhance</goal>
          </goals>
          </execution>
          </executions>
          <dependencies>
          <dependency>
          <groupId>org.apache.openjpa</groupId>
          <artifactId>openjpa-all</artifactId>
          <version>${openjpa.version}</version>
          </dependency>
          </dependencies>
          </plugin>
          </plugins>
          </build>
          </project>

          Here's my persistence xml:

          <?xml version="1.0" encoding="UTF-8"?>
          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          version="1.0">

          <persistence-unit name="audit" transaction-type="RESOURCE_LOCAL">
          <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
          <class>com.gaig.annuity.entsvc.audit.model.entity.AuditActivity</class>
          <class>com.gaig.annuity.entsvc.audit.model.entity.BusinessProcess</class>
          <exclude-unlisted-classes>true</exclude-unlisted-classes>

          <properties>
          <property name="openjpa.Log" value="slf4j"/>
          </properties>
          </persistence-unit>
          </persistence>

          Chris Jaehnen added a comment - After installing 2.0 of the integration plugin, I'm now getting this error: [ERROR] Failed to execute goal org.apache.openjpa:openjpa-maven-plugin:2.2.2:enhance (enhancer) on project audit-model: Execution enhancer of goal org.apache.openjpa:openjpa-maven-plugin:2.2.2:enhance failed: java.lang.ClassNotFoundException: com.gaig.annuity.entsvc.audit.model.entity.AuditActivity -> [Help 1] [JENKINS] Archiving E:\Program Files\Jenkins\jobs\EAI Audit Enterprise Domain Model\workspace\pom.xml to com.gaig.annuity.entsvc.audit/audit-model/1.1.0-SNAPSHOT/audit-model-1.1.0-SNAPSHOT.pom [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException channel stopped I've verified this entity class exists in the proper place. After more debugging locally, when I set the tmpClassLoader to "true" in the open-jpa-maven plugin, I get this same error locally. Is there something about the integration plugin that's enabling the temporary class loader? Here's my jpa model pom: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd "> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.gaig.annuity.entsvc.audit</groupId> <artifactId>audit-parent</artifactId> <version>1.0.0</version> </parent> <artifactId>audit-model</artifactId> <version>1.1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>GAIG Annuity EAI Audit Enterprise Domain Model</name> <!-- SCM configuration --> <scm> <connection>${scm.host}:${scm.workspace}:${scm.location}</connection> <developerConnection>${scm.host}:${scm.workspace}:${scm.location}</developerConnection> <url>${scm.host}:${scm.workspace}:${scm.location}</url> </scm> <dependencies> <!-- GAIG Annuity Test Dependencies --> <dependency> <groupId>com.gaig.annuity.commons</groupId> <artifactId>model-commons</artifactId> <version>1.0.0</version> <scope>test</scope> <type>test-jar</type> </dependency> </dependencies> <build> <plugins> <!-- OpenJPA plugin for enhancing entity classes at compile time --> <plugin> <groupId>org.apache.openjpa</groupId> <artifactId>openjpa-maven-plugin</artifactId> <version>${maven.openpja.plugin.version}</version> <configuration><tmpClassLoader></tmpClassLoader> <includes>${openjpa.includes}</includes> <addDefaultConstructor>true</addDefaultConstructor> <enforcePropertyRestrictions>true</enforcePropertyRestrictions> <persistenceXmlFile>${basedir}/src/main/resources/META-INF/audit/persistence.xml</persistenceXmlFile> </configuration> <executions> <execution> <id>enhancer</id> <phase> process-classes </phase> <goals> <goal>enhance</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.apache.openjpa</groupId> <artifactId>openjpa-all</artifactId> <version>${openjpa.version}</version> </dependency> </dependencies> </plugin> </plugins> </build> </project> Here's my persistence xml: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> <persistence-unit name="audit" transaction-type="RESOURCE_LOCAL"> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <class>com.gaig.annuity.entsvc.audit.model.entity.AuditActivity</class> <class>com.gaig.annuity.entsvc.audit.model.entity.BusinessProcess</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="openjpa.Log" value="slf4j"/> </properties> </persistence-unit> </persistence>

          settings.xml used to compile openjpa-project-example.

          Marcelo Rebasti added a comment - settings.xml used to compile openjpa-project-example.

          Chris,

          First of all, sorry by the delay in answer you.

          I wasn't able to reproduce the problem inside Jenkins alone, but I was able to reproduce it by setting tmpClassLoader=true as you said, both in Jenkins as in the command line.

          Jenkins don't set tmpClassLoader to any value at all.

          I recommends you doing 2 tests in order to know if the problem is in your jenkins configuration or in your project:

          1) Try to compile the project openjpa-project-example attached to this issue in your Jenkins. For do this, you'll need use the settings.xml that I also attached. If this build works fine, the problem is something related to your project configuration and not to any openjpa project.
          2) Try to build your project in a fresh installation of Jenkins. For do this, you can download any version of Jenkins (LTS or OSS, and perhaps the same that you are using in production) and run it in your computer by executing "java -jar jenkins.war". If this build works fine, the problem have to be related to your jenkins global configuration.

          If you can reproduce the problem in a fresh Jenkins installation with a simplified project, and you attach it to this issue, I'll be able to do some debug.

          Regards.

          Marcelo Rebasti

          Marcelo Rebasti added a comment - Chris, First of all, sorry by the delay in answer you. I wasn't able to reproduce the problem inside Jenkins alone, but I was able to reproduce it by setting tmpClassLoader=true as you said, both in Jenkins as in the command line. Jenkins don't set tmpClassLoader to any value at all. I recommends you doing 2 tests in order to know if the problem is in your jenkins configuration or in your project: 1) Try to compile the project openjpa-project-example attached to this issue in your Jenkins. For do this, you'll need use the settings.xml that I also attached. If this build works fine, the problem is something related to your project configuration and not to any openjpa project. 2) Try to build your project in a fresh installation of Jenkins. For do this, you can download any version of Jenkins (LTS or OSS, and perhaps the same that you are using in production) and run it in your computer by executing "java -jar jenkins.war". If this build works fine, the problem have to be related to your jenkins global configuration. If you can reproduce the problem in a fresh Jenkins installation with a simplified project, and you attach it to this issue, I'll be able to do some debug. Regards. Marcelo Rebasti

          Chris,

          After 8 months without response I assume that the issue is resolved.

          If you still have the problem, feel free to reopen the issue.
          Regards.

          Marcelo Rebasti

          Marcelo Rebasti added a comment - Chris, After 8 months without response I assume that the issue is resolved. If you still have the problem, feel free to reopen the issue. Regards. Marcelo Rebasti

            mrebasti Marcelo Rebasti
            cjaehnen Chris Jaehnen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: