Tomcat控制台正在运行,但显示“找不到页面错误404”

时间:2017-10-31 21:19:35

标签: java tomcat servlets java-ee localhost

运行服务器后我在控制台中遇到的错误如下。我真的不认为,这是一个错误,因为它说,服务器已启动并运行。我使用动态Web模块2.5,Tomcat 7.0和Java 1.8。我已尝试更改为3.0,也存在动态Web模块错误的问题。您还可以建议我在开发Web应用程序时使用的最佳组合。我还将向您展示pom.xml文件中使用的依赖项。 每次更新项目时,我都会将Maven依赖项添加到“部署程序集”中。

提前致谢。

Oct 31, 2017 4:04:25 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:spring-tutorial-73' did not find a matching property.
Oct 31, 2017 4:04:25 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:logins' did not find a matching property.
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/7.0.81
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Aug 11 2017 10:21:27 UTC
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         7.0.81.0
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jdk1.8.0_141\jre
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_141-b15
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\S528130\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Program Files\apache-tomcat-7.0.81
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\S528130\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\apache-tomcat-7.0.81
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\S528130\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\apache-tomcat-7.0.81\endorsed
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Oct 31, 2017 4:04:25 PM 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: C:\Program Files\Java\jdk1.8.0_141\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files/Java/jdk1.8.0_141/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_141/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_141/bin/../jre/lib/amd64;C:\Program Files\apache-maven-3.5.0\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\Java\jdk1.8.0_141\bin;C:\Users\S528130\Desktop;;.
Oct 31, 2017 4:04:25 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Oct 31, 2017 4:04:25 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Oct 31, 2017 4:04:25 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1014 ms
Oct 31, 2017 4:04:25 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Oct 31, 2017 4:04:25 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.81
Oct 31, 2017 4:04:26 PM org.apache.catalina.startup.TldConfig execute
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.
Oct 31, 2017 4:04:26 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Oct 31, 2017 4:04:26 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'log'
Oct 31, 2017 4:04:26 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'log': initialization started
Oct 31, 2017 4:04:26 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'log-servlet': startup date [Tue Oct 31 16:04:26 CDT 2017]; root of context hierarchy
Oct 31, 2017 4:04:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/log-servlet.xml]
Oct 31, 2017 4:04:27 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for @ControllerAdvice: WebApplicationContext for namespace 'log-servlet': startup date [Tue Oct 31 16:04:26 CDT 2017]; root of context hierarchy
Oct 31, 2017 4:04:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for @ControllerAdvice: WebApplicationContext for namespace 'log-servlet': startup date [Tue Oct 31 16:04:26 CDT 2017]; root of context hierarchy
Oct 31, 2017 4:04:28 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
Oct 31, 2017 4:04:28 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'log': initialization completed in 1369 ms
Oct 31, 2017 4:04:29 PM org.apache.catalina.startup.TldConfig execute
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.
Oct 31, 2017 4:04:29 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Oct 31, 2017 4:04:29 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Oct 31, 2017 4:04:29 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Oct 31, 2017 4:04:29 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue Oct 31 16:04:29 CDT 2017]; root of context hierarchy
Oct 31, 2017 4:04:29 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [com/caveofprogramming/spring/web/config/dao-context.xml]
Oct 31, 2017 4:04:29 PM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Oct 31, 2017 4:04:29 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [com/caveofprogramming/spring/web/config/service-context.xml]
Oct 31, 2017 4:04:29 PM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Oct 31, 2017 4:04:29 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@68b78425: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,offersDao,dataSource,offersService,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
Oct 31, 2017 4:04:29 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 516 ms
Oct 31, 2017 4:04:29 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'offers'
Oct 31, 2017 4:04:29 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'offers': initialization started
Oct 31, 2017 4:04:29 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'offers-servlet': startup date [Tue Oct 31 16:04:29 CDT 2017]; parent: Root WebApplicationContext
Oct 31, 2017 4:04:29 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/offers-servlet.xml]
Oct 31, 2017 4:04:29 PM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Oct 31, 2017 4:04:29 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7c57f80: defining beans [homeController,offersController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,jspViewResolver,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@68b78425
Oct 31, 2017 4:04:29 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.caveofprogramming.spring.web.controllers.HomeController.showHome()
Oct 31, 2017 4:04:29 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/offers],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.caveofprogramming.spring.web.controllers.OffersController.showOffers(org.springframework.ui.Model)
Oct 31, 2017 4:04:29 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/createoffer],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.caveofprogramming.spring.web.controllers.OffersController.createOffer(org.springframework.ui.Model)
Oct 31, 2017 4:04:29 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/test],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.caveofprogramming.spring.web.controllers.OffersController.showTest(org.springframework.ui.Model,java.lang.String)
Oct 31, 2017 4:04:29 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/docreate],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.caveofprogramming.spring.web.controllers.OffersController.doCreate(org.springframework.ui.Model,com.caveofprogramming.spring.web.dao.Offer,org.springframework.validation.BindingResult)
Oct 31, 2017 4:04:29 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.0.1.Final
Oct 31, 2017 4:04:30 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/static/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
Oct 31, 2017 4:04:30 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'offers': initialization completed in 779 ms
Oct 31, 2017 4:04:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Oct 31, 2017 4:04:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Oct 31, 2017 4:04:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4904 ms

登录servlet.xml中

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">



    <context:component-scan base-package="com.logins.Controllers"></context:component-scan>
    <mvc:annotation-driven></mvc:annotation-driven>
    <mvc:default-servlet-handler/>
    <bean id="jspViewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/jsps"></property>
    <property name="suffix" value=".jsp"></property>
    </bean>
</beans>

的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" 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>logins</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>log</display-name>
    <servlet-name>log</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>log</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
</web-app>

使用的依赖项的pom.xml文件。

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>logins</groupId>
  <artifactId>logins</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>5.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>5.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>5.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>5.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>5.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>5.0.0.RELEASE</version>
    </dependency>
  </dependencies>
</project>

2 个答案:

答案 0 :(得分:0)

在该日志中几乎没有任何错误,它是用于调试目的的所有详细输出,您还担心什么?是否存在问题,或者您是否认为存在堆栈跟踪并决定发布问题?

答案 1 :(得分:0)

修复我的答案是 登录servlet.xml中 前缀值 - &gt; “/ WEB-INF / JSP的”

    <context:component-scan base-package="com.logins.Controllers"></context:component-scan>
    <mvc:annotation-driven></mvc:annotation-driven>
    <mvc:default-servlet-handler/>
    <bean id="jspViewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/jsps/"></property>
    <property name="suffix" value=".jsp"></property>
    </bean>
</beans>