Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SpringWeb应用程序经常关闭_Java_Spring_Rest_Spring Mvc - Fatal编程技术网

Java SpringWeb应用程序经常关闭

Java SpringWeb应用程序经常关闭,java,spring,rest,spring-mvc,Java,Spring,Rest,Spring Mvc,我是spring框架的新手,今天我已经成功地在服务器上部署了我的第一个spring应用程序。部署后,我的应用程序自行关闭。这是日志 2015-10-10 23:24:22,925 INFO org.springframework.web.context.support.XmlWebApplicationContext.doClose:1002 - Closing WebApplicationContext for namespace 'spring-servlet': startup date

我是spring框架的新手,今天我已经成功地在服务器上部署了我的第一个spring应用程序。部署后,我的应用程序自行关闭。这是日志

2015-10-10 23:24:22,925 INFO  org.springframework.web.context.support.XmlWebApplicationContext.doClose:1002 - Closing WebApplicationContext for namespace 'spring-servlet': startup date [Sat Oct 10 23:23:24 IST 2015]; root of context hierarchy
2015-10-10 23:24:22,925 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons:422 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15dbf24b: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1,adminController,EPICController,homeController,EPICNumberServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,viewResolver,tilesConfigurer,messageSource,localeChangeInterceptor,localeResolver,handlerMapping,multipartResolver,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0]; root of factory hierarchy
2015-10-10 23:24:22,925 INFO  org.apache.tiles.access.TilesAccess.setContainer:108 - Removing TilesContext for context: org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext
2015-10-10 23:24:36,249 INFO  org.springframework.web.servlet.DispatcherServlet.initServletBean:301 - FrameworkServlet 'Selva': initialization started
2015-10-10 23:24:36,312 INFO  org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh:456 - Refreshing WebApplicationContext for namespace 'spring-servlet': startup date [Sat Oct 10 23:24:36 IST 2015]; root of context hierarchy
2015-10-10 23:24:36,421 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions:315 - Loading XML bean definitions from ServletContext resource [/WEB-INF/config/spring-config.xml]
2015-10-10 23:24:37,015 INFO  org.springframework.context.annotation.ClassPathBeanDefinitionScanner.registerDefaultFilters:178 - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
2015-10-10 23:24:37,890 INFO  org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.loadProperties:177 - Loading properties file from class path resource [resources/easy.properties]
2015-10-10 23:24:37,890 INFO  org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.loadProperties:177 - Loading properties file from class path resource [resources/constant.properties]
2015-10-10 23:24:37,952 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons:555 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4a83b194: defining beans [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1,adminController,ProductController,homeController,ProductServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,viewResolver,tilesConfigurer,messageSource,localeChangeInterceptor,localeResolver,handlerMapping,multipartResolver,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0]; root of factory hierarchy
2015-10-10 23:24:38,128 INFO  org.springframework.web.servlet.view.tiles2.TilesConfigurer.setDefinitions:222 - TilesConfigurer: adding definitions [/WEB-INF/config/tiles.xml]
2015-10-10 23:24:38,140 INFO  org.springframework.web.servlet.view.tiles2.TilesConfigurer.isExpressionFactoryAvailable:511 - Found JSP 2.1 ExpressionFactory
2015-10-10 23:24:38,171 INFO  org.apache.tiles.context.AbstractTilesApplicationContextFactory.createFactory:76 - Initializing Tiles2 application context. . .
2015-10-10 23:24:38,187 INFO  org.apache.tiles.context.AbstractTilesApplicationContextFactory.createFactory:95 - Finished initializing Tiles2 application context.
2015-10-10 23:24:38,218 DEBUG org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>:65 - The portlet environment is available, since the class interface javax.portlet.PortletRequest is present
2015-10-10 23:24:38,312 INFO  org.apache.tiles.access.TilesAccess.setContainer:113 - Publishing TilesContext for context: org.springframework.web.servlet.view.tiles2.SpringTilesApplicationContextFactory$SpringWildcardServletTilesApplicationContext
2015-10-10 23:24:22925 INFO org.springframework.web.context.support.XmlWebApplicationContext.doClose:1002-关闭名称空间“spring servlet”的WebApplicationContext:启动日期[2015年10月10日星期六23:23:24];上下文层次结构的根
2015-10-10 23:24:22925信息org.springframework.beans.factory.support.DefaultListableBeanFactory.DestroySingleton:422-在org.springframework.beans.factory.support中销毁单例。DefaultListableBeanFactory@15dbf24b:定义bean[org.springframework.beans.factory.config.propertyPlaceHolderConfigure#0,org.springframework.beans.factory.config.propertyPlaceHolderConfigure#1,adminController,EPICController,homeController,EPICNumberServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,viewResolver,TileConfigure,messageSource,localeChangeInterceptor,localeResolver,handlerMapping,multipartResolver,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappeInterceptor#0];工厂层次结构的根
2015-10-10 23:24:22925 INFO org.apache.tiles.access.tileAccess.setContainer:108-删除上下文的tileContext:org.springframework.web.servlet.view.tiles2.springtileApplicationContextFactory$springwildcardservlettileApplicationContext
2015-10-10 23:24:36249 INFO org.springframework.web.servlet.DispatcherServlet.initServletBean:301-FrameworkServlet'Selva':初始化已开始
2015-10-10 23:24:36312 INFO org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh:456-刷新命名空间“spring servlet”的WebApplicationContext:启动日期[Sat Oct 10 23:24:36 IST 2015];上下文层次结构的根
2015-10-10 23:24:36421 INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions:315-从ServletContext资源[/WEB-INF/config/spring config.xml]加载xml bean定义
2015-10-10 23:24:37015信息org.springframework.context.annotation.ClassPathBeanDefinitionScanner.registerDefaultFilters:178-找到并支持JSR-250“javax.annotation.ManagedBean”进行组件扫描
2015-10-10 23:24:37890 INFO org.springframework.beans.factory.config.propertyPlaceHolderConfigure.loadProperties:177-从类路径资源[resources/easy.properties]加载属性文件
2015-10-10 23:24:37890 INFO org.springframework.beans.factory.config.propertyPlaceHolderConfigure.loadProperties:177-从类路径资源[resources/constant.properties]加载属性文件
2015-10-10 23:24:37952 INFO org.springframework.beans.factory.support.DefaultListableBeanFactory.PreInstanceSingleton:555-在org.springframework.beans.factory.support中预实例化Singleton。DefaultListableBeanFactory@4a83b194:定义bean[org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1,adminController,ProductController,homeController,ProductServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,viewResolver,TileConfigure,messageSource,localeChangeInterceptor,localeResolver,handlerMapping,multipartResolver,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappeInterceptor#0];工厂层次结构的根
2015-10-10 23:24:38128 INFO org.springframework.web.servlet.view.tiles2.tileConfigure.setDefinitions:222-tileConfigure:添加定义[/web-INF/config/tiles.xml]
2015-10-10 23:24:38140 INFO org.springframework.web.servlet.view.tiles2.tileConfigurer.isExpressionFactoryAvailable:511-找到了JSP 2.1 ExpressionFactory
2015-10-10 23:24:38171 INFO org.apache.tiles.context.AbstractTilesApplicationContextFactory.createFactory:76-初始化Tiles2应用程序上下文。
2015-10-10 23:24:38187 INFO org.apache.tiles.context.AbstractTilesApplicationContextFactory.createFactory:95-已完成Tiles2应用程序上下文的初始化。
2015-10-10 23:24:38218调试org.apache.tiles.portlet.context.PortletTileResRequestContextFactory.:65-portlet环境可用,因为存在类接口javax.portlet.PortletRequest
2015-10-10 23:24:38312 INFO org.apache.tiles.access.tileAccess.setContainer:113-发布上下文的TileContext:org.springframework.web.servlet.view.tiles2.springtileApplicationContextFactory$springwildcardservlettileApplicationContext
在这个日志之后,我尝试了显示404错误的url。

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" version="2.5">
  <servlet>
    <servlet-name>Selva</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/config/spring-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Selva</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>/index.do</welcome-file>
  </welcome-file-list>
  <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>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>*.do</url-pattern>
  </filter-mapping>
  <error-page>
    <error-code>404</error-code>
    <location>/error.do</location>
  </error-page>
  <error-page>
    <error-code>500</error-code>
    <location>/error.do</location>
  </error-page>
  <error-page>
    <error-code>400</error-code>
    <location>/error.do</location>
  </error-page>
  <error-page>
    <error-code>405</error-code>
    <location>/error.do</location>
  </error-page>
  <session-config>
    <session-timeout>15</session-timeout>
  </session-config>
</web-app>

塞尔瓦
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/config/spring-config.xml
1.
塞尔瓦
*.做
/index.do
编码滤波器
org.springframework.web.filter.CharacterEncodingFilter
编码
UTF-8
强制编码
符合事实的
编码滤波器
*.做
40
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">



    <!-- Initailasing propert file into context -->

    <context:property-placeholder
        location="classpath:resources/selva.properties"
        ignore-unresolvable="true" />

    <context:property-placeholder location="classpath:resources/constant.properties"
        ignore-unresolvable="true" />




    <!-- Assigning base package for Spring classes -->

    <context:component-scan base-package="com.selva" />

    <!-- Tiles configuration -->
    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass">
            <value>
                org.springframework.web.servlet.view.tiles2.TilesView
            </value>
        </property>
    </bean>
    <bean id="tilesConfigurer"
        class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/config/tiles.xml</value>
            </list>
        </property>
    </bean>

    <!-- Application Message Bundle -->
    <bean id="messageSource"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename" value="classpath:resources/messages" />
        <property name="defaultEncoding" value="UTF-8" />
    </bean>

    <bean id="localeChangeInterceptor"
        class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        <property name="paramName" value="lang" />
    </bean>

    <bean id="localeResolver"
        class="org.springframework.web.servlet.i18n.CookieLocaleResolver" />

    <bean id="handlerMapping"
        class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
        <property name="interceptors">
            <ref bean="localeChangeInterceptor" />
        </property>
    </bean>


    <!-- File uploading interceptor to limiting Mulitipart foemdata -->

    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

        <property name="maxUploadSize" value="31457280" /> <!-- 30MB -->

        <property name="maxInMemorySize" value="2097152" /> <!-- 2MB -->

    </bean>

    <constructor-arg>
        <bean class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
              <property name="readTimeout" value="2000" />
            <property name="connectTimeout" value="2000" />
         </bean>
    </constructor-arg>
</bean> -->
<mvc:annotation-driven/>





</beans>