As I mentioned earlier, the difference in behavior is down to the command that is being run when the application is pushed to Cloud Foundry. When you push your WAR to CloudFoundry, it is being run in a Tomcat container that is not configured to allow custom status messages. If you want to run the application in its embedded Jetty container, you’ll need to ensure that it has a `Main-Class` entry in the JAR’s manifest that will start the embedded Jetty container.
toggle quoted messageShow quoted text
Cloud Foundry Java Experience
On May 11, 2016, at 12:45 AM, Stanley Shen <meteorping(a)gmail.com> wrote:
I created the docker image, and you can find it "meteorping2/hello".
You can push the image as an APP like "cf push stanley -o meteorping2/hello"
When the APP is ready, you can access the servlet like:
And I got result
:~ stanleyshen$ wget http://stanley.test.io/hello
--2016-05-11 15:23:16-- http://stanley.test.io/hello
Resolving stanley.test.io... 22.214.171.124
Connecting to stanley.test.io|126.96.36.199|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2016-05-11 15:23:17 ERROR 403: Forbidden.
But if you access the servlet deployed in local env via "java -jar jetty-runner.jar testId.war" you will get below result:
--2016-05-11 07:04:31-- http://127.0.0.1:8080/hello
Connecting to 127.0.0.1:8080... connected.
HTTP request sent, awaiting response... 403 my customized 413 error message
2016-05-11 07:04:31 ERROR 403: my customized 413 error message.
And here is the Dockerfile definition:
COPY . /usr/src/myapp
CMD java -jar jetty-runner.jar testId.war
Thanks for investigation, let me know if you still cannot reproduce the issue.