Facing issue while building Mule Project on Bamboo
Asked by Rohit:

Hello Team,

I'm facing issue at Maven Build Task on Plan set up for Mule Project in bamboo. I have Maven set up in my local properly but i see below error logs when i try to build on bamboo. Maven is set on E: drive on my local and corresponding path is configured in environment variable

**Error logs in Build :**

```
simple	18-May-2018 06:58:19	Executing xray actions for the following build: International Monitoring - cs-monitor-p - Default Job #6 (IM-CSMONP-JOB1-6)simple	18-May-2018 06:58:20	Build International Monitoring - cs-monitor-p - Default Job #6 (IM-CSMONP-JOB1-6) started building on agent Bamboo Local 2simple	18-May-2018 06:58:20	simple	18-May-2018 06:58:20	Build working directory is /efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1simple	18-May-2018 06:58:20	Executing build International Monitoring - cs-monitor-p - Default Job #6 (IM-CSMONP-JOB1-6)simple	18-May-2018 06:58:20	Starting task 'Check out source code' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'simple	18-May-2018 06:58:20	Build always requires a clean checkoutsimple	18-May-2018 06:58:20	Cleaning build directory '/efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1'simple	18-May-2018 06:58:21	Updating source code to revision: 48c26c1bd49b90cf20eeaac1b7da083dd438abaasimple	18-May-2018 06:58:21	Fetching 'refs/heads/develop' from 'ssh://git@bitbucket.creditsafe.com/im/cs-monitor-p.git'.simple	18-May-2018 06:58:21	Warning: Permanently added '[127.0.0.1]:37653' (RSA) to the list of known hosts.simple	18-May-2018 06:58:22	Checking out revision 48c26c1bd49b90cf20eeaac1b7da083dd438abaa.simple	18-May-2018 06:58:22	Creating local git repository in '/efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1/.git'.simple	18-May-2018 06:58:22	Cloning into '/efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1'...simple	18-May-2018 06:58:23	done.simple	18-May-2018 06:58:26	Switched to a new branch 'develop'simple	18-May-2018 06:58:26	Branch develop set up to track remote branch develop from origin.simple	18-May-2018 06:58:26	Updated source code to revision: 48c26c1bd49b90cf20eeaac1b7da083dd438abaasimple	18-May-2018 06:58:26	Finished task 'Check out source code' with result: Successsimple	18-May-2018 06:58:26	Running pre-build action: VCS Version Collectorsimple	18-May-2018 06:58:26	Starting task 'Build Mule Project' of type 'com.atlassian.bamboo.plugins.maven:task.builder.mvn3'command	18-May-2018 06:58:26	Beginning to execute external process for build 'International Monitoring - cs-monitor-p - Default Job #6 (IM-CSMONP-JOB1-6)'\n ... running command line: \n/usr/bin/mvn --batch-mode -Djava.io.tmpdir=/opt/atlassian/atlassian-bamboo-5.15.5/temp/IM-CSMONP-JOB1 mvn clean package\n ... in: /efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1\n ... using extra environment variables: \nbamboo_planRepository_1_branch=develop\nbamboo_capability_system_builder_nunit3_NUnit_3_Build=C:\Windows\Microsoft.NET\Framework*64*\v2.0.50727\msbuild.exe\nbamboo_repository_49512449_branch_name=develop\nbamboo_planRepository_1_branchDisplayName=develop\nbamboo_repository_revision_number=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nM2=%M2_HOME%\bin\nMAVEN2_HOME=/usr\nbamboo_resultsUrl=https://bamboo.creditsafe.com/browse/IM-CSMONP-JOB1-6\nbamboo_planRepository_1_name=cs-monitor-p\nbamboo_build_working_directory=/efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1\nbamboo_buildKey=IM-CSMONP-JOB1\nbamboo_repository_49512449_name=cs-monitor-p\nbamboo_shortPlanName=cs-monitor-p\nbamboo_planRepository_name=cs-monitor-p\nbamboo_buildNumber=6\nbamboo_capability_system_jdk_JDK_1_8_0_131=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7_3.x86_64\nbamboo_shortJobName=Default Job\nbamboo_buildResultsUrl=https://bamboo.creditsafe.com/browse/IM-CSMONP-JOB1-6\nbamboo_capability_system_builder_nunit3_MSBuild_Run=C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe\n-Xmx512m=\nbamboo_planRepository_repositoryUrl=ssh://git@bitbucket.creditsafe.com/im/cs-monitor-p.git\nbamboo_capability_system_jdk_JDK_1_8_0_121__JRE_=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre\nbamboo_agentId=22446081\nbamboo_planName=International Monitoring - cs-monitor-p\nbamboo_shortPlanKey=CSMONP\nbamboo_repository_49512449_previous_revision_number=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nbamboo_shortJobKey=JOB1\nbamboo_repository_49512449_git_branch=develop\nbamboo_planRepository_revision=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nbamboo_repository_previous_revision_number=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nbamboo_buildTimeStamp=2018-05-18T06:58:19.762Z\nbamboo_planRepository_previousRevision=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nbamboo_repository_49512449_revision_number=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nM2_HOME=/usr\nbamboo_buildResultKey=IM-CSMONP-JOB1-6\nbamboo_repository_git_branch=develop\nbamboo_repository_branch_name=develop\nbamboo_buildPlanName=International Monitoring - cs-monitor-p - Default Job\nbamboo_planRepository_1_revision=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nbamboo_repository_49512449_git_repositoryUrl=ssh://git@bitbucket.creditsafe.com/im/cs-monitor-p.git\nbamboo_capability_system_jdk_JDK_1_8_0_141=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64\nbamboo_repository_name=cs-monitor-p\nJAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre\nbamboo_dependenciesDisabled=false\nbamboo_capability_system_docker_executable=/usr/bin/docker\nMAVEN_OPTS=-Xms256m\nbamboo_planRepository_branch=develop\nbamboo_capability_system_builder_nunit3_msbuild_exe=C:\Windows\Microsoft.NET\Framework*64*\v2.0.50727\nbamboo_agentWorkingDirectory=/efs/bamboo/bamboobin/build-dir\nbamboo_capability_system_git_executable=/bin/git\nbamboo_repository_49512449_git_username=\nbamboo_planRepository_1_previousRevision=48c26c1bd49b90cf20eeaac1b7da083dd438abaa\nbamboo_repository_git_username=\nbamboo_planRepository_branchDisplayName=develop\nbamboo_capability_system_jdk_JDK_1_8_0_151=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el7_4.x86_64\nbamboo_planRepository_1_type=bbserver\nbamboo_planRepository_branchName=develop\nbamboo_capability_system_jdk_JDK_1_8_0_151__JRE_=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.el7_4.x86_64/jre\nbamboo_capability_system_jdk_JDK_1_8_0_111__JRE_=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre\nbamboo_capability_system_jdk_JDK=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre\nbamboo_plan_storageTag=plan-48660481\nbamboo_planRepository_type=bbserver\nbamboo_planRepository_1_username=\nbamboo_ManualBuildTriggerReason_userName=oc-rohity\nbamboo_repository_git_repositoryUrl=ssh://git@bitbucket.creditsafe.com/im/cs-monitor-p.git\nuseMavenReturnCode=false\nbamboo_capability_system_builder_node_Node_js=/usr/bin/node\nbamboo_capability_system_builder_command_AWSCLI=/bin/aws\nbamboo_capability_system_builder_mvn3_Maven_3=/usr\nbamboo_working_directory=/efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1\nbamboo_planKey=IM-CSMONP\nbamboo_planRepository_1_repositoryUrl=ssh://git@bitbucket.creditsafe.com/im/cs-monitor-p.git\nbamboo_planRepository_username=\nbamboo_capability_system_jdk_JDK_1_8=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre\nbamboo_planRepository_1_branchName=develop\nPATH=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\nerror	18-May-2018 06:58:26	/usr/bin/mvn: Failed to set JAVACMDerror	18-May-2018 06:58:26	/usr/bin/mvn: Failed to set JAVACMDerror	18-May-2018 06:58:26	/usr/bin/mvn: Failed to set JAVACMDerror	18-May-2018 06:58:26	/usr/bin/mvn: Failed to set JAVACMDerror	18-May-2018 06:58:26	/usr/bin/mvn: Failed to set JAVACMDerror	18-May-2018 06:58:26	/usr/bin/mvn: Failed to set JAVACMD
```

Can someone point out what else needs to be configured or reason for issue and how to resolve![maven_setup.JPG](/t5/image/serverpage/image-id/22392iCD519B37A35100B6/image-size/large?v=v2&px=999 "maven_setup.JPG") ?


Answers:
author: Foong
body: ```
/usr/bin/mvn: Failed to set JAVACMD
```

This error means that Java Home couldn't be set.

```
command 18-May-2018 06:58:26 Beginning to execute external process for build 'International Monitoring - cs-monitor-p - Default Job #6 (IM-CSMONP-JOB1-6)'
\n ... running command line: 
\n/usr/bin/mvn --batch-mode -Djava.io.tmpdir=/opt/atlassian/atlassian-bamboo-5.15.5/temp/IM-CSMONP-JOB1 mvn clean package
\n ... in: /efs/bamboo/bamboobin/build-dir/IM-CSMONP-JOB1
\n ... using extra environment variables: 
...
\nJAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre
...
\nbamboo_capability_system_jdk_JDK_1_8=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre
```

From the build log and screen shot, this Maven task is configured to use the Java path **/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre** as JAVA_HOME.

Check if this path**/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-1.b15.el7_2.x86_64/jre** exist in the machine hosting Bamboo.

If it does not exist, edit the **JDK 1.8** Capability at **Administration \> Build Resources \> Server Capabilities** to use the valid path to Java 1.8

comments: author: Rohit
body: [@Foong](/t5/user/viewprofilepage/user-id/502088) thanks for reply. I will check and get back.


author: Rohit
body: [@Foong](/t5/user/viewprofilepage/user-id/502088) below is maven configuration on bamboo server

> mvn -v  
> Apache Maven 3.0.5 (Red Hat 3.0.5-17)  
> Maven home: /usr/share/maven  
> Java version: 1.8.0_171, vendor: Oracle Corporation  
> Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-7.b10.el7.x86_64/jre  
> Default locale: en_US, platform encoding: ANSI_X3.4-1968  
> OS name: "linux", version: "4.14.33-51.37.amzn1.x86_64", arch: "amd64", family

As you can see above java home on server is different from the path that is being referred in my build.

Can you please let me know the reason for this difference in configuration ?

Also i could see that latest JDK build is not getting reflected if i try to config manually.

PFB screenshot

![java_home.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/22519iF1B7FEC5C01C5D1F/image-size/large?v=v2&px=999 "java_home.JPG")

Let me know your views on this.

Thanks in advance.


author: Foong
body: The path for "Build JDK" - **JDK 1.8** have to be edited at **Administration \> Build Resources \> Server Capabilities**

Have you edited the **JDK 1.8** capability at **Administration \> Build Resources \> Server Capabilities** ?


author: Rohit
body: [@Foong](/t5/user/viewprofilepage/user-id/502088) No I don't have administration rights. I need to inform respective team for this. Thanks for response.


author: Rohit
body: [@Foong](/t5/user/viewprofilepage/user-id/502088) thanks alot !! its resolved when updated jdk as mentioned above :)


author: Rohit
body: [@Foong](/t5/user/viewprofilepage/user-id/502088)