zoukankan      html  css  js  c++  java
  • Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"

    1、错误描述

    信息: Initializing Spring root WebApplicationContext
    2017-02-09 16:40:53,812 [localhost-startStop-1] ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
      org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in URL [file:/F:/Tomcat/apache-tomcat-7.0.69/webapps/cmp/WEB-INF/classes/ApplicationContext.xml]: Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"
    	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)
    	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)
    	at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:281)
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:161)
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
    	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
    	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
    	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"
    	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
    	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
    	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:258)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:204)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82)
    	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:220)
    	... 22 more
    二月 09, 2017 4:40:53 下午 org.apache.catalina.core.StandardContext listenerStart
    严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in URL [file:/F:/Tomcat/apache-tomcat-7.0.69/webapps/cmp/WEB-INF/classes/ApplicationContext.xml]: Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"
    	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)
    	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)
    	at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:281)
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:161)
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
    	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
    	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
    	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    	at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'driverClassName' in string value "${driverClassName}"
    	at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
    	at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
    	at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:258)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:204)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141)
    	at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82)
    	at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:220)
    	... 22 more

    2、错误原因

         由于在ApplicationContext.xml文件里获取MySQL连接配置,dataSource里有属性

    <property name="driverClassName" value="${driverClassName}" />  
          但是在mysql.properties中没有配置这个属性

    3、解决办法

         在mysql.properties属性文件中添加一行

    driverClassName=com.mysql.jdbc.Driver


  • 相关阅读:
    Ajax工作原理和原生JS的ajax封装
    HNU 13073 Ternarian Weights 解题报告
    如何在Eclipse中配置python开发环境
    C++中vector 容器的基本操作
    2014年百度实习生面试题及总结
    Python计算一个项目中含有的代码行数
    Linux环境下的GCC编译器与GDB调试工具介绍
    linux环境下Vim的配置
    计算机网络中好的期刊和会议
    hdu 1005解题报告
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13313957.html
Copyright © 2011-2022 走看看