2016-05-22 25 views
3

我已经在我的Linux机器中部署了我的应用程序。我使用简单的apache tomcat 7版本。我能够看到我的tomcat context is initialized,但刚刚初始化后,上下文正在被破坏。我没有看到日志文件中发生任何异常。tomcat应用程序启动,但立即销毁

[从 文件加载 org.springframework.util.ConcurrentReferenceHashMap $ EntryIterator:/var/cache/easy-tomcat7/work/Catalina/web.com/web-1.0.0-BUILD-SNAPSHOT/WEB -INF/lib/spring-core-4.2.1.RELEASE.jar] DEBUG:org.springframework.web.context.ContextLoader - 发布的根 WebApplicationContext作为ServletContext属性,名称为 [org.springframework.web.context.WebApplicationContext .ROOT]信息: org.springframework.web.context.ContextLoader - 根 WebApplicationContext:在7637 ms完成初始化信息: org.springframework.web.context.support.XmlWebAppl icationContext - Closing Root WebApplicationContext:启动日期[Sun May 22 07:58:10 UTC 2016];上下文层次DEBUG的根: org.springframework.core.env.PropertySourcesPropertyResolver - 在 [servletConfigInitParams] DEBUG搜索键 'spring.liveBeansView.mbeanDomain': org.springframework.core.env.PropertySourcesPropertyResolver - 搜索关键在[servletContextInitParams] 实测值 键 'spring.liveBeansView.mbeanDomain' 与式[字符串]和值 'dev的' - org.springframework.core.env.PropertySourcesPropertyResolver:在 [servletContextInitParams] DEBUG 'spring.liveBeansView.mbeanDomain' DEBUG: org.springframework.beans.factory.support.DefaultListableBeanFactory - 返回单例bean'lifecycleProce的缓存实例SSOR” DEBUG: org.springframework.beans.factory.support.DefaultListableBeanFactory - 销毁独身 org.s[email protected]2b48a930:

这是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" xmlns:web="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_3_0.xsd" version="3.0"> 
    <display-name>web</display-name> 
    <context-param> 
    <param-name>log4jConfigLocation</param-name> 
    <param-value>/WEB-INF/config/log4j.xml</param-value> 
    </context-param> 
    <context-param> 
    <param-name>spring.profiles.active</param-name> 
    <param-value>dev</param-value> 
</context-param> 
<context-param> 
    <param-name>spring.profiles.default</param-name> 
    <param-value>dev</param-value> 
</context-param> 
<context-param> 
    <param-name>spring.liveBeansView.mbeanDomain</param-name> 
    <param-value>dev</param-value> 
</context-param> 
    <listener> 
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 
    </listener> 
    <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> 
    <filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/login/auth</url-pattern> 
    <dispatcher>FORWARD</dispatcher> 
    </filter-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> 
    </filter-mapping> 
    <context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
      /WEB-INF/spring/root-context.xml    
      /WEB-INF/spring/appServlet/security-context.xml 
     </param-value> 
    </context-param> 
    <listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 
    <servlet> 
    <servlet-name>web</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
    <servlet-name>web</servlet-name> 
    <url-pattern>/</url-pattern> 
    </servlet-mapping> 
</web-app> 

根的context.xml

<beans:beans xmlns="http://www.springframework.org/schema/mvc" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:jdbc="http://www.springframework.org/schema/jdbc" 
    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.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd 
     http://www.springframework.org/schema/jdbc 
     http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">   


</beans:beans> 
+0

这个问题有什么好运? – EpicPandaForce

回答

0

你有你的@Configuration类定义的配置文件的具体配置,如

@Configuration 
public class MyConfig { 

    @Configuration 
    @Profile(value="dev") 
    public static class DevConfiuration { 
     @Bean 
     ///some bean methods here 
    } 
} 

如果没有,请尝试以下完全移除标签型材并看看它是否被部署。

<context-param> 
    <param-name>spring.profiles.active</param-name> 
    <param-value>dev</param-value> 
</context-param> 
<context-param> 
    <param-name>spring.profiles.default</param-name> 
    <param-value>dev</param-value> 
</context-param> 
<context-param> 
    <param-name>spring.liveBeansView.mbeanDomain</param-name> 
    <param-value>dev</param-value> 
</context-param> 
+0

我已经尝试过,但没有帮助。 – jdeveloper

相关问题