4

I want to create an executable jar-file with gradle & springboot. I have already cleaned gradle, reinstalled java and killed all the java processes. Sometimes the process also stopps at 80% and I am not able to access the command window anymore. I am a working on a Remote Desktop. But when I execute gradle bootRun the command line shows the following error message:

2015-12-11 13:20:55.133 ERROR 5992 --- [           main] o.s.boot.SpringApplicat
ion               : Application startup failed

org.springframework.boot.context.embedded.EmbeddedServletContainerException: Una
ble to start embedded Tomcat servlet container
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
tContainer.start(TomcatEmbeddedServletContainer.java:165) ~[spring-boot-1.3.0.RE
LEASE.jar:1.3.0.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
xt.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:290) ~[sprin
g-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
xt.finishRefresh(EmbeddedWebApplicationContext.java:141) ~[spring-boot-1.3.0.REL
EASE.jar:1.3.0.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:540) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.
RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationConte
xt.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.0.RELEASE.j
ar:1.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.
java:752) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.doRun(SpringApplication.ja
va:347) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:295) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.sprinork.boot.SpringApplication.run(SpringApplication.java:1112)
[spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java
:1101) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]
        at DBConnection.Application.main(Application.java:10) [main/:na]
Caused by: java.lang.IllegalStateException: Tomcat connector in failed state
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServle
tContainer.start(TomcatEmbeddedServletContainer.java:159) ~[spring-boot-1.3.0.RE
LEASE.jar:1.3.0.RELEASE]
        ... 10 common frames omitted

:bootRun FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished wi
th non-zero exit value 1

Here is my build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'

jar {
    baseName = 'gs-rest-service'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    providedCompile("org.springframework.boot:spring-boot-starter-web")
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

springBoot{
    mainClass = "DBConnection.Application"
}

And my Application.java file:

package DBConnection;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;




    @SpringBootApplication
        public class Application {

            public static void main(String[] args) {
                SpringApplication.run(Application.class, args);
            }

        }

Thanks a lot! I really dont know what to do anymore..

Cary
  • 51
  • 1
  • 5
  • Possible duplicate of [Android java.exe finished with non-zero exit value 1](http://stackoverflow.com/questions/29045129/android-java-exe-finished-with-non-zero-exit-value-1) – Blake Yarbrough Dec 11 '15 at 22:26
  • I have already tried everything from there, doesnt work.. is it possible that it is because I am working remote? – Cary Dec 12 '15 at 01:13
  • 2
    The Tomcat connector failed to start. Some output earlier in the log than what you've shown will tell you why. I'd guess it'll be a port clash. Assuming you're using the defaults, that'll be 8080 and another process will already be listening on that port. – Andy Wilkinson Dec 12 '15 at 07:29
  • Thanks, Andy. That was the source of the failure in my case. – Alex Dec 23 '15 at 21:31

0 Answers0