org.springframework.beans.factory.BeanDefinitionStoreException异常

1、下面是我遇到的异常信息:

2017-03-25 18:01:11,322 [localhost-startStop-1] [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed

org.springframework.beans.factory.BeanDefinitionStoreException:

Invalid bean definition with name ‘dataSource‘ defined in file [C:\Users\Aaron\workspace\HT\target\classes\spring\applicationContext.xml]:

Could not resolve placeholder ‘jdbc.driver‘ in string value "${jdbc.driver}";

nested exception is java.lang.IllegalArgumentException:

Could not resolve placeholder ‘jdbc.driver‘ in string value "${jdbc.driver}"

2、异常信息中文翻译:

Context initialization failed: 

环境初始化失败

BeanDefinitionStoreException:  

这是一个异常对象:java bean 定义、注入异常

Invalid bean definition with name ‘dataSource‘ defined in file:

无效的 java bean 定义,使用文件C:\Users\Aaron\workspace\HT\target\classes\spring\applicationContext.xml 为 dataSourece 类定义属性时出错:

Could not resolve placeholder ‘jdbc.driver‘ in string value "${jdbc.driver}";

不能解析占位符 ‘jdbc.driver‘ in string value "${jdbc.driver}";

IllegalArgumentException

非法参数异常

3、查找错误

3.1 在 applicationContext.xml 里有如下配置:

  <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource">
    <property name="driverClassName" value="${jdbc.driver}"/>

3.2 在 db-mysql.properties 里有如下配置:

  jdbc.driverClassName=com.mysql.jdbc.Driver

3.3 value的变量名为jdbc.driver,但在properties里配置的却是jdbc.driverClassName

4、解决办法

  修改db-mysql.properties文件如下:

  jdbc.driver=com.mysql.jdbc.Driver

  

时间: 2024-10-27 13:52:11

org.springframework.beans.factory.BeanDefinitionStoreException异常的相关文章

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/lonecloud/tomcat/apache-tomcat-7.0.70 2/webapps/myproject/WEB-INF/classes/cn/lone

解决这个报错的解决办法: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/lonecloud/tomcat/apache-tomcat-7.0.70 2/webapps/myproject/WEB-INF/classes/cn/lonecloud/dao/Impl/UserDaoImpl.class]; ne

org.springframework.beans.factory.BeanDefinitionStoreException

1.错误描写叙述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 2014-7-12 11:48:27 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.29 usi

SSH集成org.springframework.beans.factory.BeanDefinitionStoreException: IOException

系统环境:JDK8+Eclipse4.4+Tomcat7.x+Spring4.1.3+Hibernate4.3.7+Struts2.3.20,我的配置文件均存放在src目录下. 首先Spring默认配置文件是applicationContext.xml,如果不叫这个名,那就需要额外指定了,指定方式是在web.xml文件中加入: <param-name>contextConfigLocation</param-name>和<param-value>classpath:be

SpringMVC 问题 org.springframework.beans.factory.BeanDefinitionStoreException

HTTP Status 500 – Internal Server Error Type Exception Report Message Servlet.init() for servlet [springmvc] threw exception Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception javax.ser

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL

[报错] org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/F:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marbled-cat/WEB-INF/classes/spring-servlet.xm

springmvc遇到问题:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class:

在运行搭建好的springmvc项目时,出现 org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: 出现这个问题是spring版本与java版本的问题. 需要将spring中的所有的jar包更换. 或者把项目中的java版本改成和jar包适合运行的版本 原文地址:https://www.cnblogs.com/huangcan1688/p/

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Users\86181\Desktop\0390\0390\assmchaoshicangku\out\artifacts\assmchaoshic

错误信息: - JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning    - Context initialization failed    org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\gold_wo

Spring加载配置文件的几种方法(org.springframework.beans.factory.BeanDefinitionStoreException)

一:Spring中的几种容器都支持使用xml装配bean,包括:XmlBeanFactory ,ClassPathXmlApplicationContext ,FileSystemXmlApplicationContext ,XmlWebApplicationContext 加载这些容器的配置文件的xml有一下几种常见的方法: 1:引用资源用XmlBeanFactory(不能实现多个文件相互引用) Resource resource = new ClassPathResource("appcon

关于Spring中org.springframework.beans.factory.UnsatisfiedDependencyException异常

这个异常是由于在applicationContext.xml中关于bean的autowirte装配类型,在类型byName,byType,constructor三种类型中,可能会出现因无法自动装配而产生题目中的异常. 下面介绍一下关于autowrite的集中装配类型: 1)no:采用自动装配.必须使用ref直接饮用其他Bean<ref bean="JavaBean"/> 2)byName:以属性名区分自动装配.在容器中寻找与JavaBean属性名相同的JavaBean,并假