我已经将Spring Boot Web App部署到Heroku,但是该应用程序无法启动,有人可以帮助我吗?
这是我第一次使用Spring Boot,我想我在pom.xml中缺少一些必要的配置
我的应用程序中有heroku / jvm buildpack,但是我也注意到了那里的heroku / java。 .war应用应该使用哪一个?
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>app</groupId>
<artifactId>Condominio</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Condomínio App</name>
<description></description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>2.0.6</version>
<configuration>
<appName>myapp</appName>
</configuration>
</plugin>
</plugins>
</build>
</project>
我使用的CMD:mvn clean heroku:deploy-war
结果为
-----> heroku-maven-plugin app detected
-----> Installing JDK 1.8... done
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 98.2M
-----> Launching...
Released v59
https://myapp.herokuapp.com/ deployed to Heroku
日志:
2018-09-16T02:00:55.946295+00:00 app[web.1]: Sep 16, 2018 2:00:55 AM org.apache.catalina.core.ContainerBase startInternal
2018-09-16T02:00:55.946299+00:00 app[web.1]: SEVERE: A child container failed during start
2018-09-16T02:00:55.946303+00:00 app[web.1]: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
2018-09-16T02:00:55.946305+00:00 app[web.1]: at java.util.concurrent.FutureTask.report(FutureTask.java:122)
2018-09-16T02:00:55.946307+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:192)
2018-09-16T02:00:55.946309+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
2018-09-16T02:00:55.946311+00:00 app[web.1]: at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
2018-09-16T02:00:55.946313+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.946314+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
2018-09-16T02:00:55.946316+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
2018-09-16T02:00:55.946318+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2018-09-16T02:00:55.946319+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2018-09-16T02:00:55.946321+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2018-09-16T02:00:55.946323+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-09-16T02:00:55.946326+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
2018-09-16T02:00:55.946328+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.946330+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.946331+00:00 app[web.1]: Caused by: java.lang.NoClassDefFoundError: app/condominio/CondomínioApplication
2018-09-16T02:00:55.946333+00:00 app[web.1]: at app.condominio.ServletInitializer.configure(ServletInitializer.java:10)
2018-09-16T02:00:55.946336+00:00 app[web.1]: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:121)
2018-09-16T02:00:55.946338+00:00 app[web.1]: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)
2018-09-16T02:00:55.946340+00:00 app[web.1]: at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
2018-09-16T02:00:55.946341+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5245)
2018-09-16T02:00:55.946343+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.946345+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.946346+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: app.condominio.CondomínioApplication
2018-09-16T02:00:55.946348+00:00 app[web.1]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
2018-09-16T02:00:55.946349+00:00 app[web.1]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
2018-09-16T02:00:55.946351+00:00 app[web.1]: ... 12 more
2018-09-16T02:00:55.946353+00:00 app[web.1]:
2018-09-16T02:00:55.948495+00:00 app[web.1]: Sep 16, 2018 2:00:55 AM org.apache.catalina.core.ContainerBase startInternal
2018-09-16T02:00:55.948497+00:00 app[web.1]: SEVERE: A child container failed during start
2018-09-16T02:00:55.948499+00:00 app[web.1]: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
2018-09-16T02:00:55.948501+00:00 app[web.1]: at java.util.concurrent.FutureTask.report(FutureTask.java:122)
2018-09-16T02:00:55.948503+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:192)
2018-09-16T02:00:55.948504+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
2018-09-16T02:00:55.948506+00:00 app[web.1]: at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
2018-09-16T02:00:55.948508+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.948510+00:00 app[web.1]: at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
2018-09-16T02:00:55.948511+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.948513+00:00 app[web.1]: at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
2018-09-16T02:00:55.948515+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.948517+00:00 app[web.1]: at org.apache.catalina.startup.Tomcat.start(Tomcat.java:366)
2018-09-16T02:00:55.948518+00:00 app[web.1]: at webapp.runner.launch.Main.main(Main.java:289)
2018-09-16T02:00:55.948520+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
2018-09-16T02:00:55.948522+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.948523+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
2018-09-16T02:00:55.948525+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
2018-09-16T02:00:55.948527+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2018-09-16T02:00:55.948529+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2018-09-16T02:00:55.948530+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2018-09-16T02:00:55.948532+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-09-16T02:00:55.948533+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: A child container failed during start
2018-09-16T02:00:55.948535+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:950)
2018-09-16T02:00:55.948537+00:00 app[web.1]: at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
2018-09-16T02:00:55.948538+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.948540+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.948542+00:00 app[web.1]: Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
2018-09-16T02:00:55.948544+00:00 app[web.1]: at java.util.concurrent.FutureTask.report(FutureTask.java:122)
2018-09-16T02:00:55.948546+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:192)
2018-09-16T02:00:55.948548+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
2018-09-16T02:00:55.948549+00:00 app[web.1]: ... 8 more
2018-09-16T02:00:55.948551+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
2018-09-16T02:00:55.948553+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.948554+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.948556+00:00 app[web.1]: Caused by: java.lang.NoClassDefFoundError: app/condominio/CondomínioApplication
2018-09-16T02:00:55.948558+00:00 app[web.1]: at app.condominio.ServletInitializer.configure(ServletInitializer.java:10)
2018-09-16T02:00:55.948560+00:00 app[web.1]: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:121)
2018-09-16T02:00:55.948561+00:00 app[web.1]: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)
2018-09-16T02:00:55.948563+00:00 app[web.1]: at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
2018-09-16T02:00:55.948565+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5245)
2018-09-16T02:00:55.948566+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.948568+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.948570+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: app.condominio.CondomínioApplication
2018-09-16T02:00:55.948571+00:00 app[web.1]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
2018-09-16T02:00:55.948574+00:00 app[web.1]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
2018-09-16T02:00:55.948575+00:00 app[web.1]: ... 12 more
2018-09-16T02:00:55.948577+00:00 app[web.1]:
2018-09-16T02:00:55.949409+00:00 app[web.1]: Exception in thread "main" org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
2018-09-16T02:00:55.949542+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.949628+00:00 app[web.1]: at org.apache.catalina.startup.Tomcat.start(Tomcat.java:366)
2018-09-16T02:00:55.949750+00:00 app[web.1]: at webapp.runner.launch.Main.main(Main.java:289)
2018-09-16T02:00:55.949916+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
2018-09-16T02:00:55.950046+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.950136+00:00 app[web.1]: at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
2018-09-16T02:00:55.950271+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.950385+00:00 app[web.1]: ... 2 more
2018-09-16T02:00:55.950558+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat]]
2018-09-16T02:00:55.950643+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.950899+00:00 app[web.1]: at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
2018-09-16T02:00:55.951072+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.951244+00:00 app[web.1]: ... 4 more
2018-09-16T02:00:55.951458+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: A child container failed during start
2018-09-16T02:00:55.951578+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:950)
2018-09-16T02:00:55.951662+00:00 app[web.1]: at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
2018-09-16T02:00:55.951776+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.951852+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.951981+00:00 app[web.1]: Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
2018-09-16T02:00:55.952098+00:00 app[web.1]: at java.util.concurrent.FutureTask.report(FutureTask.java:122)
2018-09-16T02:00:55.952205+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:192)
2018-09-16T02:00:55.952320+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
2018-09-16T02:00:55.952427+00:00 app[web.1]: ... 8 more
2018-09-16T02:00:55.952525+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]]
2018-09-16T02:00:55.952648+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.952777+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
2018-09-16T02:00:55.952861+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
2018-09-16T02:00:55.952976+00:00 app[web.1]: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2018-09-16T02:00:55.953064+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2018-09-16T02:00:55.953180+00:00 app[web.1]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2018-09-16T02:00:55.953302+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748)
2018-09-16T02:00:55.953394+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: A child container failed during start
2018-09-16T02:00:55.953510+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:950)
2018-09-16T02:00:55.953608+00:00 app[web.1]: at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
2018-09-16T02:00:55.953714+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.953825+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.953956+00:00 app[web.1]: Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
2018-09-16T02:00:55.954062+00:00 app[web.1]: at java.util.concurrent.FutureTask.report(FutureTask.java:122)
2018-09-16T02:00:55.954180+00:00 app[web.1]: at java.util.concurrent.FutureTask.get(FutureTask.java:192)
2018-09-16T02:00:55.954270+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:942)
2018-09-16T02:00:55.954374+00:00 app[web.1]: ... 8 more
2018-09-16T02:00:55.954512+00:00 app[web.1]: Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
2018-09-16T02:00:55.954601+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
2018-09-16T02:00:55.954715+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.954841+00:00 app[web.1]: Caused by: java.lang.NoClassDefFoundError: app/condominio/CondomínioApplication
2018-09-16T02:00:55.954924+00:00 app[web.1]: at app.condominio.ServletInitializer.configure(ServletInitializer.java:10)
2018-09-16T02:00:55.955070+00:00 app[web.1]: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:121)
2018-09-16T02:00:55.955189+00:00 app[web.1]: at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)
2018-09-16T02:00:55.955274+00:00 app[web.1]: at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
2018-09-16T02:00:55.955398+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5245)
2018-09-16T02:00:55.955487+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2018-09-16T02:00:55.955570+00:00 app[web.1]: ... 6 more
2018-09-16T02:00:55.955714+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: app.condominio.CondomínioApplication
2018-09-16T02:00:55.955799+00:00 app[web.1]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1309)
2018-09-16T02:00:55.955890+00:00 app[web.1]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
2018-09-16T02:00:55.956014+00:00 app[web.1]: ... 12 more
2018-09-16T02:00:55.957944+00:00 app[web.1]: Sep 16, 2018 2:00:55 AM org.apache.coyote.AbstractProtocol pause
2018-09-16T02:00:55.957947+00:00 app[web.1]: INFO: Pausing ProtocolHandler ["http-nio-13697"]
2018-09-16T02:00:55.958702+00:00 app[web.1]: Sep 16, 2018 2:00:55 AM org.apache.catalina.core.StandardService stopInternal
2018-09-16T02:00:55.958705+00:00 app[web.1]: INFO: Stopping service [Tomcat]
2018-09-16T02:00:56.406351+00:00 heroku[web.1]: Process exited with status 1
2018-09-16T02:00:56.423732+00:00 heroku[web.1]: State changed from up to crashed
答案 0 :(得分:0)
正如@chrylis所说,这是由非ASCII字符“í”引起的Heroku错误。我通过重命名课程解决了这个问题。