Spring boot Openshift-Spring启动-创建新应用程序时出错-无法执行:';控制启动';
我试图在Openshift上部署一个非常简单的Spring启动应用程序。 我正在使用浏览器中的openshift online创建Tomcat 7(JBoss EWS 2.0)盒式磁带 我在创建时遇到以下错误。 及 无法找到任何解决方案。谁能帮我看看这里出了什么问题Spring boot Openshift-Spring启动-创建新应用程序时出错-无法执行:';控制启动';,spring-boot,openshift,Spring Boot,Openshift,我试图在Openshift上部署一个非常简单的Spring启动应用程序。 我正在使用浏览器中的openshift online创建Tomcat 7(JBoss EWS 2.0)盒式磁带 我在创建时遇到以下错误。 及 无法找到任何解决方案。谁能帮我看看这里出了什么问题 Git URL:不确定错误的确切原因。但是,我发现您的代码中存在以下问题 Java版本不确定JBoss EWS 2.0是否支持1.7(在生成的pom.xml数据中为1.7) 您正在Tomcat服务器上部署,但是spring b
Git URL:不确定错误的确切原因。但是,我发现您的代码中存在以下问题
- Java版本不确定JBoss EWS 2.0是否支持1.7(在生成的pom.xml数据中为1.7)
- 您正在Tomcat服务器上部署,但是
对spring boot starter web
具有可传递的依赖性。您需要将tomcat依赖项设置为提供spring boot starter Tomcat
- 您的打包是jar,您已经安装了SpringBootMaven插件,不确定它将如何部署到tomcat服务器的webapps目录。它使用openshift配置文件来构建项目。您的openshift配置文件可能无法按预期工作
- 为了让spring boot在外部应用服务器上运行,您需要使用
extends-SpringBootServletilizer
不过,我建议您按照以下步骤创建可部署到openshift的spring引导项目
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.openshif</groupId>
<artifactId>cloudemo</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>cloudemo</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<repositories>
<repository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<java.version>1.6</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'webapps'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>cloudemo</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
谢谢你如此详细的回答。我将试着用这种方式工作。
@SpringBootApplication
public class CloudemoApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(CloudemoApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(CloudemoApplication.class, args);
}