问题
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.
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.
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.
Update:
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
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]
回答1:
Use - CF Java Build-packs.
Run below command :
cf push webAppSpaceName -p spring-boot-sample-tomcat-jsp-1.3.3.RELEASE.war -b https://github.com/cloudfoundry/java-buildpack.git
Since you are using Spring-Boot-1.3.2.RELEASE you might face this Issue.
Update:
More info on Build packs:
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.
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.
But it is good to specify so that CF uses the latest Build pack.
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
However, CF CLI has more options and features.
来源:https://stackoverflow.com/questions/37089561/error-deploying-the-example-application-spring-boot-1-3-4-jsp-war-packaging