【问题标题】:tomcat running but 404 returns without errorstomcat 运行但 404 返回没有错误
【发布时间】:2017-09-17 10:59:53
【问题描述】:

我正在尝试通过 tomcat maven 插件在 tomcat 服务器中运行我的项目。

在我的 pom xml 中:

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>  
    <artifactId>tomcat7-maven-plugin</artifactId>  
    <version>2.2</version>
    <configuration>
        <source>${java.version}</source>
        <target>${java.version}</target>
    </configuration>
</plugin>

我在 Eclipse 中通过这个命令运行项目:

-e clean tomcat:run

服务器在没有错误或警告的情况下启动,但是在将 url 粘贴到 Web 浏览器的地址栏后发生 404 错误(在 Eclipse 控制台中没有错误或警告)。

我该如何解决这个问题?如果您需要更多内容,请在 cmets 中提及。

【问题讨论】:

    标签: java spring maven tomcat http-status-code-404


    【解决方案1】:

    index 页面不存在于写入位置,这是 404 未找到错误的原因。请在/src/main/webappWebContent 文件夹中创建index.jspindex.html

    【讨论】:

    • index.jsp 存在于 srs/main/webapp 文件夹中。
    • 然后检查web.xml文件的配置。
    【解决方案2】:

    1.在 eclipse tomcat 配置中检查“部署路径”,基本上它是查找用于部署的 war 文件的路径路径 如果需要,请使用自定义位置并配置服务器路径。

    2.请检查我认为您已经配置的tomcat-users.xml。如果没有,请将以下配置添加到 tomcat-users.xml

    <role rolename="manager-gui" /> 
    <role rolename="manager-script" /> 
    <user username="admin" password="admin" roles="manager-gui,manager-script" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-21
      相关资源
      最近更新 更多