GoogleCloudPlatform/getting-started-java

web.xml IS required for helloworld for doGet to get called.

DrifterAtSea opened this issue · 6 comments

In the HelloWorld module, the following comment is present:

// With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.

This is false. The web.xml IS required. The web.xml doesn't specify the servlet in this case because the @WebServlet is used. BUT, if you do not provide a web.xml file, the doGet method will never get called. Please remove this comment.

See:
https://stackoverflow.com/questions/11731377/servlet-returns-http-status-404-the-requested-resource-servlet-is-not-availa

lesv commented

The comment should be changed.

The Quickstart process actually creates a web.xml for you, which it why it works for us. However, someone forgot to include it in the latest gcloud, so it has broken a few things.

Also, :appengineStage task of gradle fails if we omit web.xml. Although local running of app works perfectly.But appengineDeploy task ultimately fails due to failure of :appengineStage task.

@lesv I am using latest(Google Cloud SDK [187.0.0]) SDK version. still i am getting error while deploying war without web.xml

Also Servlet 3.1 deployment descriptor is not working.

lesv commented

This is a problem w/ the 187.0.0 SDK it should be fixed shortly.
@patflynn @loosebazooka FYI

lesv commented

@parindholakia If you wish to roll back to the last SDK you can give the following:

gcloud components restore will roll back to the last version.

lesv commented

Or gcloud components update --version 186.0.0 to be very specific.