java - 请教eclipse中发布struts项目,ContextRoot设置成功,但tomcat仍因root名称相同而部署失败
黄舟
黄舟 2017-04-18 10:25:04
0
3
606

这两个项目如下图所示,为Struts2Action 和Struts2Project,之前Action是从project复制过来,确实存在相同ContextRoot的情况,但我现在已经将action的ContextRoot修改好了,如下图

并且在工具栏project中使用clean,清理了一下,但仍然不了在tomcat 中发布,错误的图片为下图

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
Ty80
  1. your tomcat中已经存在一个上下文为/Struts2Project的项目了,找到tomcat的目录查看一下webappsdirectory, delete it.

  2. If you publish the project through server.xml, you can delete its corresponding configuration.

小葫芦
  • Expand the servers folder in your picture. Find server.xml

  • Scroll to the bottom to find the <Context> tag, and delete the duplicates.

<Engine defaultHost="localhost" name="Catalina">
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>-->
  <Realm className="org.apache.catalina.realm.LockOutRealm">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/></Realm>
  <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>
    <Context docBase="xweixin-web" path="/xweixin-web" reloadable="true" source="org.eclipse.jst.jee.server:xweixin-web"/>
  </Host>
</Engine>

I have it.
If not, look for it in server.xml in the tomcat directory.

小葫芦

Just change the .project in the project root directory... and the project name in a few files

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!