I built an Eclipse project via mvn package
and moved the war file into C:\\Program Files\\apache-tomcat-8.0.9\\webapps .
Then, I start Tomcat Server via startup.bat
and can access it from http://localhost:8080/myProject
.
On the other hand, when build the project and run it on server in Eclipse, http://localhost:8080/myProject
give me HTTP Status 404 - /myProject
I tried many things but none of them didn't solve the problem.
What I'm missing?
You need not give specify the context name, since you are not specifying any context in developement mode.
You have two options.
Either remove context name and access like
http://localhost:8080
Or
If you want to add context, add the file jetty-web-xml along with your web-xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/myProject </Set>
</Configure>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.