AWS Elastic Beanstalk Tomcat works with .war but n

2019-02-27 13:11发布

I am trying to deploy an application to EC2 with elastic beanstalk and tomcat. In order to try and fix a different problem I had I changed my uploaded file from a .war to a .zip in order to include a .ebextensions folder. However, now I get the following error when trying to enter the website:

enter image description here

I figured that there might be a problem with the .config file I added, so I tried zipping the .war file alone, however I get the exact same error, so this is ruled out.

1条回答
三岁会撩人
2楼-- · 2019-02-27 13:20

TL/DR: Put 2 .war files in the .zip file instead of 1.

I realize this post is nearly 18 months old. But I experienced exactly the same symptoms, so this seemed as good a place as any to share my discovery.

Premise: deploying a .war file works well, exactly as expected.

Observation: Elastic Beanstalk does this automatically:

/usr/share/tomcat/webapps/ROOT/[contents of .war are placed here]

Problem: deploying a .zip file containing this .war file along with valid config files does NOT work well.

Observation: Elastic Beanstalk does this automatically:

/usr/share/tomcat/webapps/ROOT/[my-war.war is placed here]

To me this seems like a bug. Perhaps it's intended behavior... but I don't understand it. Placing the .war file in webapps would make sense. Placing the contents of the .war in ROOT would make sense. But placing the .war file there directly seems very strange.

Solution: Add a second .war file to the .zip (even if you don't need the second app!).

Observation: Elastic Beanstalk does this automatically:

/usr/share/tomcat/webapps/[my-war.war is placed here]
/usr/share/tomcat/webapps/[my-other-war.war is placed here]

Now my-war.war deploys normally, and life is good.

查看更多
登录 后发表回答