简体   繁体   中英

java spring problem : project can not run on tomcat server even though edited the server.xml file?

I am newbie with java spring and here is my problem.

I created a simple project named DiamonShop and tried to run it by tomcat 9.0.62.

But it show me this error

我的错误

I think that the error is because of the file server.xml, because I have 2 projects named DemoSpringMVC and DiamonShop, in the file server.xml, I found that there is this line

<Context docBase="DemoSpringMVC" path="/DemoSpringMVC" reloadable="true" source="org.eclipse.jst.jee.server:DemoSpringMVC"/>
  <Context docBase="DiamonShop" path="/DiamonShop" reloadable="true" source="org.eclipse.jst.jee.server:DiamonShop"/></Host>

And the link http://localhost:8888/DemoSpringMVC/ worked perfectly When I changed the line above into this

<Context docBase="DiamonShop" path="/DiamonShop" reloadable="true" source="org.eclipse.jst.jee.server:DiamonShop"/></Host>

The link http://localhost:8888/DemoSpringMVC/ did not work, so I thought that maybe the link http://localhost:8888/DiamonShop/ must work? But it did not.

I also tried tomcat 8.5 and tomcat 10, but it showed the same error.

Here is my code (DemoSpringMVC and DiamonShop), for reference, if you need.

https://github.com/nguyencuc2586/Spring3.3
https://github.com/nguyencuc2586/DIamonShop4.1

Here is my webapp directory

网络应用目录

Here is my server.xml file

https://github.com/nguyencuc2586/DiamonShop4.1Serverfile

Here is my webapp at my apache-tomcat

https://github.com/nguyencuc2586/DiamonShop4.1apache-tomcat-9.0.62-webapps

Could you please give me some advices for this problem? Thank you in advance.

Most probably the docBase="DemoSpringMVC" you're referring to doesn't exist in webapp directory, because the war/jar file you might have built contains "SNAPSHOT" like strings.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM