使用STS在Pivotal Cloud Foundry上部署示例应用程序(Spring Boot 1.3.4,JSP,WAR打包)时出错 [英] Error deploying the example application (Spring Boot 1.3.4, JSP, WAR Packaging) at Pivotal Cloud Foundry using STS

查看:89
本文介绍了使用STS在Pivotal Cloud Foundry上部署示例应用程序(Spring Boot 1.3.4,JSP,WAR打包)时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了此博客帖子使用启动仪表板来部署 Spring示例应用程序到Pivotal Cloud Foundry.该示例应用程序是一个Spring Boot应用程序(1.3.2.RELEASE),使用JSP并具有WAR打包.

I followed this blog post to use Boot Dashboard to deploy the Spring example application to Pivotal Cloud Foundry. The example application is a Spring Boot application (1.3.2.RELEASE), uses JSP and has WAR packaging.

该应用程序似乎启动正常,但随后主页为空白.尝试使用cURL,我看到以下输出:

The application seemed to start ok, but then the home page was blank. Trying cURL, I saw the following output:

但是,当我使用命令行部署应用程序时:

But, when I deploy the application using command line:

cf push np-spring-tutorial -p spring-tutorial-0.0.1-SNAPSHOT.war

该应用程序已部署并运行良好.

The application got deployed and is running well.

那么,是否是Boot Dashboard部署到PWS的方式尚不支持JSP的WAR文件?在使用JSP之前,我曾尝试通过Boot Dashboard部署较少的JAR文件,并且它们运行良好.

So, is it that the Boot Dashboard way of deployment to PWS isn't yet supporting WAR files with JSPs? I have tried before JSP less JAR files deployment with Boot Dashboard, and they worked well.

更新:

按照 Sanjay Rawat 的建议,我将Spring Boot版本更新为1.3.4,现在还具有manifest.yml,如下所示:

As recommended by Sanjay Rawat, I updated Spring Boot version to 1.3.4, and also now have a manifest.yml as below:

---
applications:
- name: np-spring-tutorial
  buildpack: https://github.com/cloudfoundry/java-buildpack.git
  path: target/spring-tutorial-0.0.1-SNAPSHOT.war
  env:
    application_url: http://np-spring-tutorial.cfapps.io
  services:
   - np-spring-tutorial-db
  timeout: 180

通过反复试验,我注意到实际需要的唯一设置是path: target/spring-tutorial-0.0.1-SNAPSHOT.war.

By hit and trial, I noticed that the only setting actually required was path: target/spring-tutorial-0.0.1-SNAPSHOT.war.

现在该应用程序正在运行,我可以看到页面.但是,启动应用程序时,控制台上会出现以下错误:

Now the application is running, and I'm able to see the pages. However, when starting the application, the following error appears on the console:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/vcap/app/WEB-INF/lib/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/vcap/app/WEB-INF/lib/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

推荐答案

使用- CF Java构建包.

运行以下命令:

cf push webAppSpaceName -p spring-boot-sample-tomcat-jsp-1.3.3.RELEASE.war -b https://github.com/cloudfoundry/java-buildpack.git

由于您使用的是Spring-Boot-13.2.2.RELEASE,因此您可能会遇到

Since you are using Spring-Boot-1.3.2.RELEASE you might face this Issue.

更新:

有关构建包的更多信息:

More info on Build packs:

Buildpacks为您的应用程序提供框架和运行时支持. Buildpacks通常会检查用户提供的工件,以确定要下载的依赖项以及如何配置应用程序以与绑定的服务进行通信.

Buildpacks provide framework and runtime support for your applications. Buildpacks typically examine user-provided artifacts to determine what dependencies to download and how to configure applications to communicate with bound services.

您不必明确提及要使用的Buildpack,Cloud Foundry会自动检测到需要哪个Buildpack并将其安装在需要运行应用程序的Droplet执行代理(DEA)上. 参考.

You don't have to explicitly mention which Buildpack to use, Cloud Foundry automatically detects which buildpack is required and installs it on the Droplet Execution Agent (DEA) where the application needs to run. Reference.

但是最好指定以便CF使用最新的Build Pack.

But it is good to specify so that CF uses the latest Build pack.

您可以在项目的manifest.yml文件中指定构建包,然后使用仪表板进行部署:

You can specify the Build pack in manifest.yml file in your project and then deploy using Dashboard:

buildpack: https://github.com/cloudfoundry/java-buildpack

但是,CF CLI具有更多选项和功能.

However, CF CLI has more options and features.

这篇关于使用STS在Pivotal Cloud Foundry上部署示例应用程序(Spring Boot 1.3.4,JSP,WAR打包)时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆