gradle process command java finished with non-zero exit value 1

Publish date: 2024-04-02

I am getting the following error when I type gradle bootRun --stacktrace --debug in the CentOS 7 terminal to use gradle to launch this sample spring boot app.

Caused by: org.gradle.process.internal.ExecException: Process 'command '/opt/jdk1.8.0_45/bin/java'' finished with non-zero exit value 1 

I have googled this error and read other SO postings that are similar but not duplicates. For example, this is in eclipse in CentOS 7 and a web app. This is not an android app, etc. Also, commands given in other postings have not resolved this problem.

All of the code required to reproduce this problem is in the github link above, and all of the logs to diagnose the problem is in this OP below. How do I resolve this error so that I gradle bootRun can succussfully launch the sample app?

STEP BY STEP REPRODUCTION OF THE PROBLEM:

I downloaded the app as-is by navigating to /home/user/workspaces/ and typing git clone https://github.com/jrodenbostel/beyond-the-examples

I then navigated to cd /home/user/workspaces/beyond-the-examples/part-5 and typed gradle bootRun --stacktrace --debug, which resulted in the stack trace and logs that you can read by clicking on this link to a file sharing site. (The logs are too long to include in this OP.)

4

4 Answers

This was my original error message:

enter image description here

Changing my %JAVA_HOME% in Window's Environmental Variables from Java 9 (file directory C:\Program Files\Java\jdk-9.0.1) to Java 8 (C:\Program Files\Java\jdk1.8.0_151) was what fixed it for me. You can figure out what path you set %JAVA_HOME% to by typing echo %JAVA_HOME% in Command Prompt.

So yea, as of 12-20-2017, gradle bootRun doesn't play well with Java 9. Hopefully that will be fixed soon and I can delete this answer.

1

Looking at the logs this appears to be your problem:

nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [inser t into users (username, password, enabled) values (?,?,?)]; Data truncation: Data too long for column 'password' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1. 

Anyway you can truncate the password size? Otherwise increasing the 'password' column size should do the trick.

In My case, I was getting this error when I was trying to launch my spring boot application. The reason for the error was the port 8080 (default port for running my app in my case) was already being used by another application (mySql) on my machine.

I killed that other application and retried to launch my app, and it worked!

2

Just wanted to add my experience with this error. I used the Grails Application Forge and included the full package in the name when generating my Grails 5.1.2 application. When I ran it, I got the "...java'' finished with
non-zero exit value 1" error. I went back and generated the application with only the application name, removing the package, and it worked. Also, this was only a problem on Windows 10 in a command prompt. Both versions of my application worked in a Cygwin command prompt.

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJoam1sYmqGen6OoKmanJyaerG%2BzpycrKtdmLyuucCnm2aikauubrLIp6CsoJWZeri106Fkp6eeYsemvs5mnLGhpGLDorjUnmRq