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

98,202

Solution 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.

Solution 2

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.

Solution 3

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!

Share:
98,202

Related videos on Youtube

CodeMed
Author by

CodeMed

Updated on May 01, 2022

Comments

  • CodeMed
    CodeMed about 2 years

    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.)

    • DavidR
      DavidR over 8 years
      I got the same error on a Mac but earlier exceptions pointed to a DB error. Did you get those also?
    • CodeMed
      CodeMed over 8 years
      @DavidR THANK YOU for recreating the problem on your machine. I just posted more complete logs, which include a database error. They are too long to fit in the OP, so I put a link to them at a file sharing site. Am I getting the same error you are getting?
    • DavidR
      DavidR over 8 years
      No, I don't have the beyond-the-examples db set up. Looking at the logs this appears to be your problem: ption; 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? Or increase that column size...
    • CodeMed
      CodeMed over 8 years
      @DavidR You pointed me to resolving the error. If you want to write it up as an answer, I would be happy to mark it as accepted and +1. Your error was due to not installing the database. My error was due to the wrong field length in the ddl I used to create the data tables. Changing the field length in the ddl for a single field resolved the problem. This is my first time using gradle. It is much stricter than maven is in checking all such dependencies.
  • JesseBoyd
    JesseBoyd over 6 years
    if anyone finds a way to make it work with Java 9 that would be great as I don't like going backwards in my dev workspace.
  • CodeMed
    CodeMed about 2 years
    Thank you and +1 for taking the time to try to help others by giving an answer to this very old question..
  • dcrall
    dcrall about 2 years
    Thank you. This saved me from Gradle's meaningless error message.