簡體   English   中英

使用 STS 在 Pivotal Cloud Foundry 部署示例應用程序(Spring Boot 1.3.4、JSP、WAR Packaging)時出錯

[英]Error deploying the example application (Spring Boot 1.3.4, JSP, WAR Packaging) at Pivotal Cloud Foundry using STS

我按照這篇博文使用Boot DashboardSpring 示例應用程序部署到 Pivotal Cloud Foundry。 示例應用程序是一個 Spring Boot 應用程序 (1.3.2.RELEASE),使用 JSP 並具有 WAR 封裝。

該應用程序似乎啟動正常,但隨后主頁是空白的。 嘗試 cURL,我看到以下輸出:

在此處輸入圖片說明

但是,當我使用命令行部署應用程序時:

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

應用程序已部署並運行良好。

那么,是不是 Boot Dashboard 部署到 PWS 的方式還不支持帶有 JSP 的 WAR 文件? 我之前嘗試過使用 Boot Dashboard 部署 JSP less JAR 文件,它們運行良好。

更新:

按照Sanjay Rawat 的建議,我將 Spring Boot 版本更新為1.3.4 ,現在還有一個manifest.yml如下:

---
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

現在應用程序正在運行,我可以看到頁面。 但是,在啟動應用程序時,控制台上出現以下錯誤:

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-1.3.2.RELEASE,您可能會遇到此問題

更新:

關於構建包的更多信息:

Buildpacks 為您的應用程序提供框架和運行時支持。 Buildpack 通常會檢查用戶提供的工件,以確定要下載哪些依賴項以及如何配置應用程序以與綁定服務進行通信。

您不必明確提及要使用哪個 Buildpack,Cloud Foundry 會自動檢測需要哪個 buildpack,並將其安裝在應用程序需要運行的 Droplet Execution Agent (DEA) 上。 參考

但是最好指定以便 CF 使用最新的 Build 包。

您可以在項目的manifest.yml文件中指定構建包,然后使用 Dashboard 進行部署:

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

但是,CF CLI 具有更多選項和功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM