在web.xml中添加ContextLoaderListener后,我的Tomcat无法启动

时间:2016-01-02 07:17:02

标签: spring tomcat

  • 操作系统:Mac OS
  • JDK版本:1.7.0_79
  • Tomcat版本:8.0.29

我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!-- spring listener -->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <!-- spring -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/applicationContext.xml</param-value>
  </context-param>
  <!-- SpringMVC -->
  <servlet>
  <servlet-name>springmvc</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:springmvc/spring-mvc.xml</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
</web-app>

tomcat启动消息:

/Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2/bin/catalina.sh run
[2016-01-02 03:30:53,918] Artifact CrowFunding:war exploded: Server is not connected. Deploy is not available.
02-Jan-2016 15:30:54.920 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.29
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Nov 20 2015 09:18:00 UTC
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.29.0
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Mac OS X
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.11.1
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          x86_64
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre
02-Jan-2016 15:30:54.922 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.7.0_79-b15
02-Jan-2016 15:30:54.923 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
02-Jan-2016 15:30:54.923 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /Users/wengliemiao/Library/Caches/IntelliJIdea15/tomcat/Unnamed_CrowFunding_3
02-Jan-2016 15:30:54.923 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2
02-Jan-2016 15:30:54.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/wengliemiao/Library/Caches/IntelliJIdea15/tomcat/Unnamed_CrowFunding_3/conf/logging.properties
02-Jan-2016 15:30:54.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
02-Jan-2016 15:30:54.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
02-Jan-2016 15:30:54.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
02-Jan-2016 15:30:54.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
02-Jan-2016 15:30:54.924 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
02-Jan-2016 15:30:54.925 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
02-Jan-2016 15:30:54.925 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2/endorsed
02-Jan-2016 15:30:54.925 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/wengliemiao/Library/Caches/IntelliJIdea15/tomcat/Unnamed_CrowFunding_3
02-Jan-2016 15:30:54.925 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2
02-Jan-2016 15:30:54.925 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2/temp
02-Jan-2016 15:30:54.925 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/wengliemiao/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
02-Jan-2016 15:30:55.064 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
02-Jan-2016 15:30:55.087 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
02-Jan-2016 15:30:55.090 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
02-Jan-2016 15:30:55.093 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
02-Jan-2016 15:30:55.093 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 592 ms
02-Jan-2016 15:30:55.124 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
02-Jan-2016 15:30:55.124 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.29
02-Jan-2016 15:30:55.138 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
02-Jan-2016 15:30:55.150 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
02-Jan-2016 15:30:55.151 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 58 ms
Connected to server
[2016-01-02 03:30:55,474] Artifact CrowFunding:war exploded: Artifact is being deployed, please wait...
02-Jan-2016 15:30:57.248 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 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.
02-Jan-2016 15:31:05.142 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2/webapps/manager
02-Jan-2016 15:31:05.184 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /Users/wengliemiao/Documents/study/apache-tomcat-8.0.29-idea2/webapps/manager has finished in 42 ms
02-Jan-2016 15:41:18.744 WARNING [main] org.apache.catalina.core.StandardServer.await StandardServer.await: Invalid command '' received

我的问题是:tomcat只是无法启动。当我删除ContextLoaderListener时,应用程序可以启动,但它会出现org.springframework.beans.factory.BeanCreationException。

0 个答案:

没有答案