2
votes

I have a Spring Boot application deployed to Liberty in Bluemix, and I'm seeing the embedded Tomcat server is being started when the app is started. I don't see this behaviour locally, as I've followed the following documentation steps to disable Tomcat when it's not required.

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging

However when the app is pushed to Bluemix I see a log entry stating that Apache has been started, and the following response header being set for all requests to the app:

Server:Apache-Coyote/1.1

How can I stop this behaviour?

1
And how does having the headers indicate that the server is starter? Isn't this just the default that bluemix version of tomcat issues? - M. Deinum
Hi M.Deinum, I can see from the application logs that during startup Spring starts the embedded container - it returns that it's listening on a port, and I just assumed that header must be set by Tomcat - surely Liberty wouldn't add that response header ? - Ric
Oops missed the liberty part :). I would say it should show that behavior locally to. Else you are deploying something else to production as locally. You are really deploying to a server and not just throwing the war on there (as that is indeed going to start the server as it is then going to do java -jar your.war which starts the embedded things). - M. Deinum
Just for background knowledge - locally I'm packaging the project into a .war, and then the local Liberty server is configured to use that war using an <application> tag in server.xml. On Bluemix I'm pushing the .war using cf push appname -p app.war. Are you saying that using this method the war file isn't deployed to the liberty server properly using this method? - Ric
I don't have bluemix experience but for basic cloud foundry that would simply push it to CF which would analyze the archive and start a server or launch the war. - M. Deinum

1 Answers

1
votes

It turns out that by pushing the .war to Bluemix using cf push appname -p app.war didn't deploy the application in the way I expected. The Liberty buildpack was executing the .war as a standalone application using java -jar

By following the Server Directory method of deploying the application outlined here : https://www.ng.bluemix.net/docs/starters/liberty/index.html#optionsforpushinglibertyapplications

the problem was resolved, and the application launched running from Liberty as required.