2016-02-05 75 views
1

当我在Tomcat的运行.war文件,日志显示春天,Tomcat的,爪哇

错误[com.configleon.configurer.WebPropertyConfigurer] - 未在JVM设置中指定的 'configLocation' 变量!

错误[org.springframework.web.context.ContextLoader] - 上下文初始化失败

这我的代码:

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

任何人都可以帮我吗?

+0

试试这个,我相信JVM属性设置不正确 - https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features- external-config.html#boot-features-external-config-application-property-files –

回答

1

的第一个错误[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> 
+0

我可以在哪里放置代码来定义JVM变量?我曾尝试在我的config.properties中添加'-DconfigLocation = test',但仍然得到相同的错误 –

+0

您可以将jvm变量放在tomcat web容器的CATALINA_OPT或JAVA_OPT中。 –

+0

谢谢Girish,这是工作.. –