Tomcat give error 404

Hi guys,
After running tomcat on ubuntu with port forwarding its give this error
Can you help to understand whats the problem?

HTTP Status 404 – Not found

Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.35

3 Likes

Hi okamigo,

I was facing the same issue while I was trying to pull Tomcat image from Amazon Linux virtual machine, Here is solution to fix the issue,

docker pull tomcat:latest

docker run -d --name mytomcat -p 8080:8080 tomcat:latest

docker exec -it mytomcat /bin/bash

mv webapps webapps2

mv webapps.dist/ webapps

exit

for explanation go through this article

9 Likes

@rajashekarjangam Moving ~/webapps inside the container solved the issue. Great tip! :slight_smile:

1 Like

Thanks a lot for the solution. It resolved my issue.

it’s working for me too. thanks a lot

Thanks a lot, works for me.

Thanks a lot! it works.

Thanks @rajashekarjangam,

The solution helped me to get to see the tomcat welcome page http://localhost:8080

I am now left wondering why my deployed application is till returning 404. http://localhost:8080/conference/

Hi @nagbara , Did you got any break here ? I’m also facing similar issue.
Appreciate any help here.

Thanks.

It’s good to realize that a 404 Not Found is actually generated by Tomcat (or maybe something that is sitting in front of Tomcat, such as Nginx), not by Docker. So, the Docker part that is running Tomcat, and accessing the port on which Tomcat is running in the Docker container, seem to be working just fine.

To debug the cause of the 404 we need many more details.

Thanks a lot. It worked for me too.

Thanks, it worked for me too!

Solved my issue. Thank you man.

Thanks. This solved my prob.

FROM tomcat:latest
RUN mv /usr/local/tomcat/webapps /usr/local/tomcat/webapps2
RUN mv /usr/local/tomcat/webapps.dist /usr/local/tomcat/webapps
ADD target/sample.war /usr/local/tomcat/webapps/
EXPOSE 8080
CMD [“catalina.sh”, “run”]