わかりません。しかし、私はあなたのコードで次の問題を見つける。あなたがTomcatサーバーにデプロイしている
- JavaバージョンのJBoss EWS 2.0(1.7に生成されたのpom.xmlのdeafultsで)1.7をサポートしているかどうかわからない
- は、しかし
spring-boot-starter-web
はspring-boot-starter-tomcat
に推移依存性を有します。あなたはtomcat依存関係を提供するように設定する必要があります。
- あなたのパッキングはjarです。あなたは春のブート・メイヴン・プラグインがわからないのですが、それはtomcatサーバーのwebappsディレクトリにどのように展開されるのでしょうか。プロジェクトを構築するためにオープンシフトプロファイルを使用します。あなたのオープンシフトのプロファイルが期待どおりに機能しない可能性があります。
- 春ブーツは、外部のアプリケーションサーバー上で実行するためには、あなたは私がopenshiftする春のブートプロジェクトに展開を作成するには、次の手順に従いますを示唆しているが
extends SpringBootServletInitializer
でメインクラスを拡張する必要があります。
- WebコンソールまたはEclipse openshiftプラグインからTomcat 7(JBoss EWS 2.0)カートリッジを作成します。
- ローカルマシンにプロジェクトをクローンします。
pom.xmlを変更し、春のブート親の依存関係を追加し、依存関係のみを追加します。プラグインはそのままの状態にしてください。 更新されたpom.xmlは次のようになります。あなたのアプリケーションは、あなたがwebappsディレクトリ
の下に、すべてのHTML、CSS、JSのリソースを配置する必要があるかもしれませんプラグインスプリングブートを使用しないため <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>
修正MainClass
@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);
}
を提出
このような詳細についてお返事ありがとうございます。私はこのように働くことを試みます。 –