Spring、Tomcat、Java

Spring, Tomcat, Java

当我 运行 .war 文件在 tomcat 时,日志显示

ERROR [com.configleon.configurer.WebPropertyConfigurer] - The 'configLocation' variable is not specified in the JVM settings!

ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed

这是我的代码:

<!-- configlion property configurator -->
<bean class="com.configleon.configurer.WebPropertyConfigurer">
    <property name="propertyResources">
        <bean class="com.configleon.resource.WebPropertyResources"/>
    </property>
</bean>

有人可以帮助我吗?

对于第一个错误 [com.configleon.configurer.WebPropertyConfigurer]

查看 here

第二个

ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed

在部署环境中,只需确保您的服务器类路径包含 Spring jar 库(例如 spring-2.5.6.jar)。

对于Spring3,ContextLoaderListener被移动到spring-web.jar,您可以从Maven中央仓库获取库。

标记

<dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>