spring web应用程序经常关闭

时间:2015-10-10 22:49:22

标签: 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 [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

在此日志之后,我尝试了显示 404错误的网址

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>

弹簧-config.xml中

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

它经常发生。

如何解决此问题,我们将非常感谢任何帮助!!!

0 个答案:

没有答案