2016-05-07 45 views
1

我跟着this blog post使用引導儀表板Spring example application部署到樞紐的Cloud Foundry。示例應用程序是Spring Boot應用程序(1.3.2.RELEASE),使用JSP並具有WAR包裝。錯誤部署示例應用程序(春季引導1.3.4,JSP,WAR包裝)在樞紐的Cloud Foundry採用STS

應用程序似乎開始好,但主頁是空白的。試圖捲曲,我看到下面的輸出:

enter image description here

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

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

的應用得到部署並運行良好。

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

更新:

所推薦的桑傑·拉瓦特,我更新的春天引導版本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] 
+0

它是一個Spring Boot應用程序嗎?如果是,請提及Boot版本號。 –

+0

是的,它是一個Spring Boot應用程序。版本是1.3.2.RELEASE。 (更新了問題) – Sanjay

回答

1

使用 - CF Java Build-packs。下面的命令

運行:

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

由於您使用的彈簧開機1.3.2.RELEASE你可能會面對這個Issue

更新:在構建包

更多信息:

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

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

但是指定CF使用最新的生成包是很好的。

可以在manifest.yml文件中指定項目生成包,然後部署使用儀表板:

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

然而,CF CLI有更多的選擇和功能。

+0

正如我在問題中提到的那樣,'cf push np-spring-tutorial -p spring-tutorial-0.0.1-SNAPSHOT.war'似乎正在工作。你的命令比這更好嗎?那麼'Boot Dashboard'是否還不支持JSP的WAR? – Sanjay

+0

啓動儀表板與WAR支持無關。它只是CF CLI的一個插件,使部署更容易。儘管它沒有提供CLI所做的所有選項和功能。 '-b https:// github.com/cloudfoundry/java-buildpack.git'爲您的應用程序定義了一個Build-Pack,您也可以在項目中的manifest.yml文件中進行定義。 您的錯誤/問題與您的項目配置有關,您是否看看我提到的問題。更新我的答案以獲取更多關於構建包的信息。 –

+0

PS:我在PCF Dev上測試並部署了這個[Spring-Boot-JSP](https://github.com/RawSanj/SOFRepos/tree/master/spring-boot-sample-tomcat-jsp)應用程序,它正在工作精細。 –

相關問題