I have a Jenkins maven job and I'm getting the following error when I run the job.
Started by user admin
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/My First Maven Job
No credentials specified
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://github.com/yankils/hello-world.git # timeout=10
Fetching upstream changes from https://github.com/yankils/hello-world.git
> /usr/bin/git --version # timeout=10
> /usr/bin/git fetch --tags --force --progress -- https://github.com/yankils/hello-world.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision de043c505e7adab1f892498ca231280298fc2674 (refs/remotes/origin/master)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f de043c505e7adab1f892498ca231280298fc2674 # timeout=10
Commit message: "Update Dockerfile"
> /usr/bin/git rev-list --no-walk de043c505e7adab1f892498ca231280298fc2674 # timeout=10
Parsing POMs
Established TCP socket on 34699
[My First Maven Job] $ " /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-1.el8_0.x86_64/bin/java" -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/opt/maven/apache-maven-3.6.3/boot/plexus-classworlds-2.6.0.jar:/opt/maven/apache-maven-3.6.3/conf/logging jenkins.maven3.agent.Maven35Main /opt/maven/apache-maven-3.6.3 /var/cache/jenkins/war/WEB-INF/lib/remoting-4.2.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 34699
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program " /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-1.el8_0.x86_64/bin/java" (in directory "/var/lib/jenkins/workspace/My First Maven Job"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)
at hudson.Launcher$ProcStarter.start(Launcher.java:454)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1856)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 12 more
Finished: FAILURE
I can see it was looking at /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-1.el8_0.x86_64/bin where as I have openjdk /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.amzn2.0.1.x86_64/jre
How can I fix this on Jenkins server?
Set JAVA_HOME to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.amzn2.0.1.x86_64
as opposed to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-1.el8_0.x86_64
Related
I have configured the project in Azure Repo and Jenkins VM but when I start Build of that java project in jenkins, it fails. Please help me to resolve the issue. Jenkins console output below. Integration between Azure Repo and Jenkins was successful but when I try to click on Build Now in Jenkins it fails.
Java Project is in Azure Repo,
Jenkins is in Azure cloud vm (Ready plugins available by Azure)
Started by user user
Running as SYSTEM
Building in workspace /bitnami/jenkins/home/workspace/MyShuttle
The recommended git tool is: NONE
using credential 04536115-8271-469c-9196-66fa633da13a
> git rev-parse --resolve-git-dir /bitnami/jenkins/home/workspace/MyShuttle/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://cloudera2019#dev.azure.com/cloudera2019/MyShuttle/_git/MyShuttle # timeout=10
Fetching upstream changes from https://cloudera2019#dev.azure.com/cloudera2019/MyShuttle/_git/MyShuttle
> git --version # timeout=10
> git --version # 'git version 2.35.1'
using GIT_ASKPASS to set credentials
> git fetch --tags --force --progress -- https://cloudera2019#dev.azure.com/cloudera2019/MyShuttle/_git/MyShuttle +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision c481534e99083921a6ff50e07bed72b1f6855a93 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f c481534e99083921a6ff50e07bed72b1f6855a93 # timeout=10
Commit message: "Added CreateMYSQLDB.sql"
> git rev-list --no-walk c481534e99083921a6ff50e07bed72b1f6855a93 # timeout=10
Parsing POMs
Established TCP socket on 33515
[MyShuttle] $ java -cp /bitnami/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/bitnami/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven/boot/plexus-classworlds-2.6.0.jar:/bitnami/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven/conf/logging jenkins.maven3.agent.Maven35Main /bitnami/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven /bitnami/jenkins/home/war/WEB-INF/lib/remoting-4.11.2.jar /bitnami/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /bitnami/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 33515
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /bitnami/jenkins/home/workspace/MyShuttle/pom.xml package -Dtest=FaresTest,SimpleTest
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.microsoft.example:myshuttle >-------------------
[INFO] Building myshuttle 0.0.1
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (default) # myshuttle ---
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO] argLine set to -javaagent:/bitnami/jenkins/home/.m2/repository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=/bitnami/jenkins/home/workspace/MyShuttle/target/jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # myshuttle ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /bitnami/jenkins/home/workspace/MyShuttle/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # myshuttle ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # myshuttle ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /bitnami/jenkins/home/workspace/MyShuttle/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) # myshuttle ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # myshuttle ---
[INFO] Surefire report directory: /bitnami/jenkins/home/workspace/MyShuttle/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_8ff85ea.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140)
at org.jacoco.agent.rt.internal_8ff85ea.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101)
at org.jacoco.agent.rt.internal_8ff85ea.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_8ff85ea.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:1999)
at org.jacoco.agent.rt.internal_8ff85ea.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
... 9 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at ./src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Aborted
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.070 s
[INFO] Finished at: 2022-02-28T09:25:11Z
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project myshuttle: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
[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
[JENKINS] Archiving /bitnami/jenkins/home/workspace/MyShuttle/pom.xml to com.microsoft.example/myshuttle/0.0.1/myshuttle-0.0.1.pom
channel stopped
Archiving artifacts
Finished: FAILURE
I could able to solve the issue by adding below xml in pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
I have a maven project which is building fine on local but failing on gitlab ci/cd pipeline.
The error which is coming as follows:
25869 [INFO] ------------------------------------------------------------------------
925869 [INFO] BUILD FAILURE
925870 [INFO] ------------------------------------------------------------------------
925870 [INFO] Total time: 15:24 min
925871 [INFO] Finished at: 2021-06-08T10:38:11Z
925871 [INFO] ------------------------------------------------------------------------
925891 [ERROR] Failed to execute goal org.apache.cxf:cxf-java2ws-plugin:3.3.0:java2ws (generate-rec-data-service-wsdl) on project descapreusables-server: Error while executing process.
925898 [ERROR] Try to run this goal using <fork>true</fork> and <classpathAsEnvVar>true</classpathAsEnvVar>.
925905 [ERROR] Command line was: /usr/java/openjdk-11/bin/java --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -DexitOnFinish=true -cp /builds/arcesium/internal/fiatech/.m2/repository/org/apache/cxf/cxf-java2ws-plugin/3.3.0/cxf-java2ws-plugin-3.3.0.jar:/builds/arcesium/internal/fiatech/.m2/repository/com/sun/xml/ws/jaxws-ri/2.3.0/jaxws-ri-2.3.0.pom:/builds/arcesium/internal/fia
The final error is coming as **: Cannot run program "/bin/sh" (in directory "/builds/arcesium/internal/fiatech/performa/descap/DESCap-Reusables/src/modules/server/target"): error=7, Argument list too long**
The command which its building is very huge but on local its not happening.
The gitlab ciYaml file is as :
variables:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
#MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
#MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
#MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
# This template uses jdk8 for verifying and deploying images
image: maven:3.3.9-jdk-8
stages:
- build
#- test
build:
image: "674283286888.dkr.ecr.us-east-1.amazonaws.com/core-infra/openjdk-maven:3.8.1-openjdk11"
stage: build
tags:
- identity-mnrltdev
#before_script:
# - yum -y install maven
# - mvn -version
script:
- pwd
- ls -ltr
- mvn clean package -DfailIfNoTests=false -Dmaven.test.failure.ignore=true -Dmaven.test.skip=true -s settings.xml
#- mvn clean install -DskipTests=true
I tried to do mvn install on my Maven project. But I get the error:
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:3.1.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:3.1.0: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:3.1.0 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/3.1.0/maven-clean-plugin-3.1.0.pom ProxyInfo{host='MYCOMPANYPROXYHOST', userName='null', port=8080, type='https', nonProxyHosts='null'}: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
I get an error telling me that Maven couldn't find the certificate, I searched almost every website to find a solution.
What I have tried :
I changed the Maven settings file, my settings.xml file is like below:
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
I went to https://repo.maven.apache.org/maven2 and downloaded the certificate, then I added it to the cacerts, with the command:
keytool -import -alias example -keystore .\cacerts -file example.cer
Details :
The cacerts file is in %JAVA_HOME%\lib\security.
I could obviously go to https://repo.maven.apache.org/maven2 on my Web Browser, since I've downloaded the certificate.
I am on Windows 10, 64 bits
EDIT:
The command mvn -version show gives:
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems inc."
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\MYUSER\Desktop\Code\apache-maven-3.6.3\bin\..
Java version: 1.8.0_73, vendor: Sun Microsystems inc., runtime: C:\Users\MYUSER\Desktop\TEST\05-Environnement_dev\Tools\Java\jdk-8u73-windows-x64\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
EDIT 2:
I tried to use Eclipse, instead of the Maven command. And I could verify this:
When I change the username or the password I get the error Failed to authenticate with proxy, and modifying the proxy host changes the error message. I can now guarantee that the proxy settings are correct.
(This step actually has cost me half an hour with the IT service, because I failed to authenticate with the proxy multiple times).
Try adding -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT to the maven JVM options so it uses the root certificates from Windows
I have Jenkins installed on my AWS EC2 server, on which the following are installed:
Maven Integration Plugin
Deploy to Container Plugin
Slack Notification Plugin
GitHub Integration Plugin
... and possibly a few others I cannot remember (because coding)...
I create new freestyle Project, go to its config, and do the following:
In General, check GitHub project, and enter the Project url
In Source Code Management, select Git and enter the Repository URL
In Build Triggers, check GitHub hook trigger for GITScm polling
In Build, I add build step "Invoke top-level Maven targets", and do the following:
Enter clean install in Goals
Enter relative path of my project's pom.xml in POM
In Post-build Actions, I do the following:
Archive the artifacts:
Deploy war/ear to container:
On my attempt to build the (working) code, it fails, and I get this long stack of info on the console:
Started by user Mike Warren
Building in workspace /home/ec2-user/.jenkins/workspace/Project2
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/MikeWarren2014/171106-Project2-SHOULDi.git # timeout=10
Fetching upstream changes from https://github.com/MikeWarren2014/171106-Project2-SHOULDi.git
> git --version # timeout=10
> git fetch --tags --progress https://github.com/MikeWarren2014/171106-Project2-SHOULDi.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision d172c840db59d7aff020787e0b49f3741f57b555 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f d172c840db59d7aff020787e0b49f3741f57b555
Commit message: "gamification finished"
> git rev-list --no-walk d172c840db59d7aff020787e0b49f3741f57b555 # timeout=10
[Project2] $ mvn -f SHOULDi-back/pom.xml clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SHOULDi-back 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # SHOULDi-back ---
[INFO] Deleting /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SHOULDi-back ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # SHOULDi-back ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 49 source files to /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target/classes
[WARNING] /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/src/main/java/com/zenith/DAO/UserDAO.java: Some input files use or override a deprecated API.
[WARNING] /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/src/main/java/com/zenith/DAO/UserDAO.java: Recompile with -Xlint:deprecation for details.
[WARNING] /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/src/main/java/com/zenith/DAO/UserDAO.java: Some input files use unchecked or unsafe operations.
[WARNING] /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/src/main/java/com/zenith/DAO/UserDAO.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SHOULDi-back ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # SHOULDi-back ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # SHOULDi-back ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # SHOULDi-back ---
[INFO] Packaging webapp
[INFO] Assembling webapp [SHOULDi-back] in [/home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target/SHOULDi-back]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/src/main/webapp]
[INFO] Webapp assembled in [293 msecs]
[INFO] Building war: /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target/SHOULDi-back.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # SHOULDi-back ---
[INFO] Installing /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target/SHOULDi-back.war to /home/ec2-user/.m2/repository/com/zenith/SHOULDi-back/1.0-SNAPSHOT/SHOULDi-back-1.0-SNAPSHOT.war
[INFO] Installing /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/pom.xml to /home/ec2-user/.m2/repository/com/zenith/SHOULDi-back/1.0-SNAPSHOT/SHOULDi-back-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.207 s
[INFO] Finished at: 2017-12-31T00:24:46+00:00
[INFO] Final Memory: 19M/48M
[INFO] ------------------------------------------------------------------------
Archiving artifacts
Deploying /home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target/SHOULDi-back.war to container Tomcat 7.x Remote with context Project2
ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [/home/ec2-user/.jenkins/workspace/Project2/SHOULDi-back/target/SHOULDi-back.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:192)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:77)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:147)
at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:117)
at hudson.FilePath.act(FilePath.java:997)
at hudson.FilePath.act(FilePath.java:975)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:114)
at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeploy(PasswordProtectedAdapterCargo.java:93)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:64)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at hudson.model.Run.execute(Run.java:1749)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:561)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:876)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:889)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:173)
... 17 more
java.net.ConnectException: Connection timed out (Connection timed out)
How can I fix this?
My tomcat credentials, located in [tomcat directory]/conf/tomcat-users.xml, are as follows:
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcatgui" password="password" roles="manager-gui" />
<user username="project2" password="Z3n1th0x47726f7570" roles="manager-script" />
</tomcat-users>
Since this is a connection time out,
Check whether you restarted the tomcat instance after editing the tomcat-users.xml
Check whether jenkins has access to tomcat instance.
Whether the user credentials are correct
For the same issue, setting port 8084 in server.xml and restarting the Apache worked for me. I replaced all occurrences of 8080 with 8084:
[root#ip-172-31-21-72 conf]# grep 8084 server.xml
Define a non-SSL/TLS HTTP/1.1 Connector on port 8084
<Connector port="8084" protocol="HTTP/1.1"
port="8084" protocol="HTTP/1.1"
comment tag Valve in context.xml files
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
there are multiple context.xml files in tomcat directory, update following context.xml files and restart tomcat service-
/apache-tomcat-8.5.41/webapps/manager/META-INF/context.xml
/apache-tomcat-8.5.41/webapps/host-manager/META-INF/context.xml
1.If you are using public IP address in AWS/Azure/any Server. if we stop and start server there might be a chance of change in Public IP which we used to Deploy Our Container. Instead we can use Elastic IP.
To Redeploy Tomcat server if Public IP used then follow below steps
Goto your Jenkins Dashboard:
Manage Jenkins> configure>Post-build Actions
--> Under Post build Actions change URL like Tomcat URL: http://ipa:8080
Restart tomcat server.
cd /opt/tomcat/bin/ && ./shutdown.sh
cd /opt/tomcat/bin/ && ./startup.sh
Open in Tomcat Manager Application.
I GOT THE BUILD TO WORK!!!
What I did
In [tomcat directory]/conf/server.xml, I changed
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
to
<!-- my business port -->
<Connector port="8084" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
I then restart the Tomcat server, go to AWS EC2, only to realize there was no inbound rule for that business port! I created one, to accept connection from anywhere.
I then re-build the project. Upon trying to run the .war file, with
java -jar .jenkins/workspace/path/to/myProject.war
but get some issue about main (but this seems to be separate issue)...
I'm using maven release plugin in order to be able to use the jenkins' release plugin. I'm using a multi module project running it on linux system (centos).
for that I've added the following plugins configuration to parent pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>v#{project.version}</tagNameFormat>
<arguments>-Dmaven.test.skip=true -DskipTests -Dbatch=true</arguments>
<tagBase>http://gitcore/user/app/tags</tagBase>
</configuration>
</plugin>
also added to the top of this pom.xml theses lines:
<scm>
<connection>scm:git:git#gitcore:user/app.git</connection>
<developerConnection>scm:git:git#gitcore:user/app.git</developerConnection>
<url>http://gitcore.company.local/</url>
</scm>
After that I run the following maven command:
mvn -B release:clean release:prepare release:perform
The prepare passes successfully
also it pushes the promotion of the pom version and it's modules (sub project), to git origin.
it creates only local git tag with the correct version but didn't success to push to remote.
what I'm getting after running maven with -X is:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project projectParent: Unable to tag SCM
Provider message:
The git-push command failed.
Command output:
Access denied.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
And above those lines, I noticed the following which related to pushing the git tag:
[INFO] Executing: /bin/sh -c cd /home/mickey/App/ProjectParent && git push git#gitcore:user/app.git refs/heads/release_version_8_0:refs/heads/release_version_8_0
[INFO] Working directory: /home/mickey/App/ProjectParent
[INFO] Tagging release with the label v8.0.2...
[DEBUG] ScmTagPhase :: scmTagParameters remotingTag true
[DEBUG] ScmTagPhase :: scmTagParameters scmRevision null
[DEBUG] ScmTagPhase :: fileSet basedir = /home/mickey/App; files = []
[INFO] Executing: /bin/sh -c cd /home/mickey/App && git tag -F /tmp/maven-scm-876857130.commit v8.0.2
[INFO] Working directory: /home/mickey/App
[INFO] Executing: /bin/sh -c cd /home/mickey/App && git push **git#gitcore:user** refs/tags/v8.0.2
[INFO] Working directory: /home/mickey/App
I tried to run the last push locally (git push git#gitcore:user) with the same error I got when running from maven, but after I added to the push command also the name of the file it worked. I can't understand why it isn't running the whole command of git push with the entire tag path as I put in the pom.
I had similar problem, but I was using flat directory multi-module like:
release-workspace\
|
|--release-parent
| |+pom.xml (modules: ../release-module1, ../release-module2)
|--release-module1
| |+pom.xml (parent: ../release-parent/pom.xml)
|--release-module2
| |+pom.xml (parent: ../release-parent/pom.xml)
The version 2.x doesn't support flat directory multi-module. You can check it out here https://issues.apache.org/jira/browse/MRELEASE-261
As a workaround, you can create a pom.xml in the root directory
release-workspace\
|
|--release-parent
| |+pom.xml (parent: ../pom.xml, modules: ../release-module1, ../release-module2)
|--release-module1
| |+pom.xml (parent: ../release-parent/pom.xml)
|--release-module2
| |+pom.xml (parent: ../release-parent/pom.xml)
|--pom.xml (modules: release-parent) <-- maven-release-plugin goes