Springboot/gradle/tomcat:进程java.exe以非零退出值1结束
我想用gradle&springboot创建一个可执行的jar文件。我已经清理了gradle,重新安装了java,并杀死了所有的java进程。有时进程也会在80%时停止,我无法再访问命令窗口。我是一个在远程桌面上工作的人。 但是当我执行Springboot/gradle/tomcat:进程java.exe以非零退出值1结束,java,tomcat,gradle,spring-boot,spring-boot-gradle-plugin,Java,Tomcat,Gradle,Spring Boot,Spring Boot Gradle Plugin,我想用gradle&springboot创建一个可执行的jar文件。我已经清理了gradle,重新安装了java,并杀死了所有的java进程。有时进程也会在80%时停止,我无法再访问命令窗口。我是一个在远程桌面上工作的人。 但是当我执行gradle bootRun时,命令行显示以下错误消息: 2015-12-11 13:20:55.133 ERROR 5992 --- [ main] o.s.boot.SpringApplicat ion : Ap
gradle bootRun
时,命令行显示以下错误消息:
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
这是我的build.gradle文件:
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"
}
和my Application.java文件:
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);
}
}
非常感谢!我真的不知道该怎么办了。可能的复制品我已经从那里尝试了所有的方法,但都不起作用。。是否可能是因为我在远程工作?Tomcat连接器无法启动。日志中早于您所显示的部分输出将告诉您原因。我猜是港口冲突。假设您使用的是默认值,即8080,另一个进程已经在该端口上侦听。谢谢,Andy。这就是我失败的原因。