当前位置: 首页 > 知识库问答 >
问题:

Tomcat-Eclipse-404尝试访问我的webapp时出错

富钧
2023-03-14

下面是我的配置:

在server.xml中(来自Tomcat)

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

在web.xml中(来自Tomcat)

 <!-- The mapping for the default servlet -->
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
  <servlet-mapping>
        <servlet-name>MaServlet</servlet-name>
        <url-pattern>/actions</url-pattern>
    </servlet-mapping>

在web.xml中(来自我的项目)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>asteriskManagerV3</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>MaServlet</display-name>
    <servlet-name>MaServlet</servlet-name>
    <servlet-class>MaServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>MaServlet</servlet-name>
    <url-pattern>/actions</url-pattern>
  </servlet-mapping>
</web-app>

和我的项目结构:

.
├── bin
│   ├── pom.xml
│   ├── src
│   │   └── main
│   │       ├── java
│   │       │   └──[all my .class]
│   │       ├── resources
│   │       └── webapp
│   │           ├── index.html
│   │           ├── META-INF
│   │           │   └── MANIFEST.MF
│   │           ├── resources
│   │           │   └── js
│   │           │       ├── jquery-3.3.1.min.js
│   │           │       └── script.js
│   │           └── WEB-INF
│   │               ├── lib
│   │               │   ├── asterisk-java.jar
│   │               │   └── log4j-1.2.17.jar
│   │               └── web.xml
│   └── target
│       └── classes
|
├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── be
│   │   │       └──[all my .java] 
│   │   ├── resources
│   │   └── webapp
│   │       ├── index.html
│   │       ├── META-INF
│   │       │   └── MANIFEST.MF
│   │       ├── resources
│   │       │   └── js
│   │       │       ├── jquery-3.3.1.min.js
│   │       │       └── script.js
│   │       └── WEB-INF
│   │           ├── lib
│   │           │   ├── asterisk-java.jar
│   │           │   └── log4j-1.2.17.jar
│   │           └── web.xml
│   └── test
│       └── java
├── target
│   ├── asteriskManagerV3
│   │   ├── index.html
│   │   ├── META-INF
│   │   │   └── MANIFEST.MF
│   │   ├── resources
│   │   │   └── js
│   │   │       ├── jquery-3.3.1.min.js
│   │   │       └── script.js
│   │   └── WEB-INF
│   │       ├── classes
│   │       │   └── be
│   │       │       └──[all my .class]
│   │       ├── lib
│   │       │   ├── asterisk-java-2.0.2.jar
│   │       │   ├── asterisk-java.jar
│   │       │   ├── log4j-1.2.17.jar
│   │       │   └── slf4j-api-1.7.9.jar
│   │       └── web.xml
│   ├── asteriskManagerV3.war
│   ├── classes
│   │   └── be
│   │       └──[all my .class]
│   ├── generated-sources
│   │   └── annotations
│   ├── maven-archiver
│   │   └── pom.properties
│   ├── maven-status
│   │   └── maven-compiler-plugin
│   │       └── compile
│   │           └── default-compile
│   │               ├── createdFiles.lst
│   │               └── inputFiles.lst
│   └── test-classes
└── WebContent
    ├── META-INF
    │   └── MANIFEST.MF
    └── WEB-INF
        ├── lib
        └── web.xml

最后,看看日志,我想不出我的应用程序部署在哪里:

Mar 27, 2018 8:37:31 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:asteriskManagerV3' did not find a matching property.
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/8.5.28
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Feb 6 2018 23:10:25 UTC
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         8.5.28.0
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Linux
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            3.10.0-693.17.1.el7.x86_64
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_161-b14
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         /home/wvn/Downloads/apache-tomcat-8.5.28
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         /home/wvn/Downloads/apache-tomcat-8.5.28
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/home/wvn/Downloads/apache-tomcat-8.5.28
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/home/wvn/Downloads/apache-tomcat-8.5.28
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/home/wvn/Downloads/apache-tomcat-8.5.28/wtpwebapps
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/home/wvn/Downloads/apache-tomcat-8.5.28/endorsed
Mar 27, 2018 8:37:31 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Mar 27, 2018 8:37:31 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
Mar 27, 2018 8:37:35 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Mar 27, 2018 8:37:36 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 27, 2018 8:37:36 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Mar 27, 2018 8:37:36 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 27, 2018 8:37:36 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 11030 ms
Mar 27, 2018 8:37:36 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Mar 27, 2018 8:37:36 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.28
Mar 27, 2018 8:37:48 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 27, 2018 8:37:48 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/ROOT]
Mar 27, 2018 8:37:52 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 27, 2018 8:37:52 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/ROOT] has finished in [4,388] ms
Mar 27, 2018 8:37:52 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/docs]
Mar 27, 2018 8:37:56 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 27, 2018 8:37:56 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/docs] has finished in [3,917] ms
Mar 27, 2018 8:37:56 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/examples]
Mar 27, 2018 8:38:00 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 27, 2018 8:38:01 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 27, 2018 8:38:01 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 27, 2018 8:38:01 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@4e0d6786')
Mar 27, 2018 8:38:01 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/examples] has finished in [4,542] ms
Mar 27, 2018 8:38:01 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/host-manager]
Mar 27, 2018 8:38:04 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 27, 2018 8:38:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/host-manager] has finished in [2,962] ms
Mar 27, 2018 8:38:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/manager]
Mar 27, 2018 8:38:06 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Mar 27, 2018 8:38:06 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [/home/wvn/Downloads/apache-tomcat-8.5.28/webapps/manager] has finished in [2,333] ms
Mar 27, 2018 8:38:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Mar 27, 2018 8:38:06 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Mar 27, 2018 8:38:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 30736 ms

感谢任何帮助!

共有1个答案

濮阳钟展
2023-03-14

我找到了解决方法:我不知道为什么,但是我的index.html和.js文件不在我的./webcontent目录中。

 类似资料:
  • 这真是令人难以置信的沮丧。 我已经部署了一个webapp在Eclipse/Tomcat中进行调试。我选择了“使用Tomcat安装”单选按钮来使用我自己的服务器。这都很好。但当我尝试访问我的web应用程序时,我得到一个404错误。我可以看到它已经部署在wptwebapps文件夹中。日志只显示404。我可以很好地访问manager应用程序,它显示我的web应用程序已经部署。 我做了清理/重新发布,重新

  • 我带着一个我无法解决的问题来到这里。 我在版本1.7中有一个prestashop,我已经移动到另一台服务器,值得一提的是,在旧服务器中,prestashop运行良好。 当我将prestashop迁移到新服务器时,除了我想进入后台,当我想进入后台时,只需将页面留空,其他一切都可以正常工作。 我已经激活了调试模式,但它没有给我任何与后台相关的错误,有趣的是,当调试模式被激活时,我可以毫无问题地进入后台

  • 本文向大家介绍解决在启动eclipse的tomcat进行访问时出现404问题的方法,包括了解决在启动eclipse的tomcat进行访问时出现404问题的方法的使用技巧和注意事项,需要的朋友参考一下 有段时间没部署项目到tomcat,今天部署出现了404问题。 一、环境 tomcat7   jdk1.7    eclipse-jee-luna-R-win32 二、问题描述 1、创建完web项目时,

  • 我正在尝试做一件平常不费脑筋的事。我想从Eclipse在Tomcat中启动我的webapp。 下面是我遵循的步骤: 使用服务器向导创建服务器 添加WebApp 服务器启动时没有任何问题,但它没有启动WebApp。我应该得到webapp启动日志,但我只得到标准的Tomcat日志,就像我在没有webapp的情况下启动它时的日志一样。并且尝试在浏览器中访问webapp会得到一个404错误。有什么想法吗?

  • 拜托,我需要一些关于Prestashop问题的帮助。我在OVH共享主机上运行Prestashop 1.7。直到昨天早上,一切都很顺利,但后来我再也无法访问后台,反而出现了错误500。门脸还在工作,我还在接受订单。 资料: 我没有升级任何东西,无论是网站还是任何模块。 当我启用调试模式(define.inc.php),后台再次工作,但前台得到一个错误:前台错误。当我试图从后台重新生成. htacce

  • 我在尝试更新我的Eclipse时出错! 以下是在“安装下载0”期间发生内部错误的错误日志 Java . lang . illegalargumentexception:比较法违反了它的通用契约!at Java . util . comparabletimsort . merge hi(comparabletimsort . Java:835)at Java . util . comparablet