我正在运行我的spring应用程序。在启动tomcat 7服务器时,它会在restfull服务启动之前加载两次。 应用程序中有某些调度程序,由于这个原因,它也会运行两次。 这是否适用于我的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">
<!-- Processes application requests -->
<servlet>
<servlet-name>Example</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Example</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/Example-servlet.xml,/WEB-INF/spring/mongo-config.xml,/WEB-INF/spring/spring-security.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class> org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.tag</url-pattern>
</servlet-mapping>
<filter>
<filter-name>hiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>hiddenHttpMethodFilter</filter-name>
<url-pattern>/</url-pattern>
<servlet-name>Example</servlet-name>
</filter-mapping>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<!-- hibernate -->
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
服务器日志
May 23, 2016 11:25:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:exampleDotCom' did not find a matching property.
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.32
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Feb 2 2016 19:34:53 UTC
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.32.0
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_73
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_73-b02
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\abhiljain\Documents\personel\exampleWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\abhiljain\Documents\personel\software\apache-tomcat-8.0.32
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\abhiljain\Documents\personel\exampleWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\abhiljain\Documents\personel\software\apache-tomcat-8.0.32
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\abhiljain\Documents\personel\exampleWorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\abhiljain\Documents\personel\software\apache-tomcat-8.0.32\endorsed
May 23, 2016 11:25:54 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 23, 2016 11:25:54 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\jre1.8.0_73\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_73/bin/server;C:/Program Files/Java/jre1.8.0_73/bin;C:/Program Files/Java/jre1.8.0_73/lib/amd64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseHg\;C:\Users\abhiljain\Documents\personel\software\apache-maven-3.2.1\apache-maven-3.2.1\bin;C:\dev\nodejs\;C:\dev\Android\sdk\tool;C:\dev\Android\sdk\platform-tools;C:\dev\nodejs;C:\Program Files\MongoDB\Server\3.0\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4\Doctrine extensions for PHP\;C:\Program Files\Java\jdk1.8.0_73\bin;C:\Program Files\TortoiseGit\bin;C:\Users\abhiljain\Documents\personel\software\openssl-0.9.8k_WIN32\bin;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\Redis;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Users\abhiljain\AppData\Roaming\npm;C:\Users\abhiljain\Documents\personel\software\eclipse-luna-AndroidPlugin;;.
May 23, 2016 11:25:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 23, 2016 11:25:54 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 23, 2016 11:25:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 23, 2016 11:25:54 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 23, 2016 11:25:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1069 ms
May 23, 2016 11:25:54 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 23, 2016 11:25:54 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.32
May 23, 2016 11:26:04 PM 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.
May 23, 2016 11:26:04 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 23, 2016 11:26:04 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
May 23, 2016 11:26:16 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'example'
May 23, 2016 11:26:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 23, 2016 11:26:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 23, 2016 11:26:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 23571 ms
May 23, 2016 11:26:19 PM org.apache.tomcat.util.http.LegacyCookieProcessor processCookieHeader
INFO: Cookies: Invalid cookie. Value not a token or quoted value
Note: further occurrences of Cookie errors will be logged at DEBUG level.