gradleとspringbootで実行可能なjarファイルを作成したい。私はすでにgradleをきれいにし、Javaを再インストールし、すべてのJavaプロセスを強制終了しました。プロセスが 80% で停止することもあり、コマンド ウィンドウにアクセスできなくなります。私はリモート デスクトップで作業しています。しかし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"
}
そして私の 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);
}
}
どうもありがとう!私は本当にもう何をすべきかわかりません..