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

时间:2018-03-23 15:01:47

标签: java eclipse tomcat http-status-code-404

当我从Eclipse启动Tomcat 8.5.28时,才会出现此问题。 我无法访问我的webapp。 http://localhost:8080/asteriskManagerV3返回404 HTTP错误:404 error

这是我的配置:

在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>

正如您在此图片中看到的那样my app is running at /asteriskManagerV3 (at least I think so)

我的项目结构:

.
├── 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

Anf最后,看着日志,我无法确定我的应用程序的部署位置:

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 个答案:

答案 0 :(得分:0)

我找到了解决方案:我不知道为什么,但我的./webContent目录中没有我的index.html和.js文件。