zoukankan      html  css  js  c++  java
  • 找不着 jdbc 配置文件解决方案

    <context:property-placeholder location="classpath*:*.properties" />
    "classpath*  会扫描所有的配置文件








    [WARNING] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in URL [jar:file:/D:/maven/repository/com/itheima/ssm_dao/1.0-SNAPSHOT/ssm_dao-1.0-SNAPSHOT.jar!/applicationContext-dao.xml]: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"
    [ERROR] Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in URL [jar:file:/D:/maven/repository/com/itheima/ssm_dao/1.0-SNAPSHOT/ssm_dao-1.0-SNAPSHOT.jar!/applicationContext-dao.xml]: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties (PlaceholderConfigurerSupport.java:228)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties (PropertySourcesPlaceholderConfigurer.java:182)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory (PropertySourcesPlaceholderConfigurer.java:157)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:286)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:166)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors (AbstractApplicationContext.java:705)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:531)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (ContextLoader.java:400)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext (ContextLoader.java:291)
    at org.springframework.web.context.ContextLoaderListener.10月 19, 2020 8:53: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 [jar:file:/D:/maven/repository/com/itheima/ssm_dao/1.0-SNAPSHOT/ssm_dao-1.0-SNAPSHOT.jar!/applicationContext-dao.xml]: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:228)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties(PropertySourcesPlaceholderConfigurer.java:182)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:157)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.base/java.lang.Thread.run(Thread.java:844)
    Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237)
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:296)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:217)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:147)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:85)
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:225)
    ... 18 more

    10月 19, 2020 8:53:53 上午 org.apache.catalina.core.StandardContext startInternal
    严重: Error listenerStart
    contextInitialized (ContextLoaderListener.java:103)
    at org.apache.catalina.core.StandardContext.listenerStart (StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call (ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call (ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
    at java.lang.Thread.run (Thread.java:844)
    Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.driver' in value "${jdbc.driver}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue (PropertyPlaceholderHelper.java:178)
    at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders (PropertyPlaceholderHelper.java:124)
    at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders (AbstractPropertyResolver.java:237)
    at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders (AbstractPropertyResolver.java:211)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0 (PropertySourcesPlaceholderConfigurer.java:175)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue (BeanDefinitionVisitor.java:296)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue (BeanDefinitionVisitor.java:217)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues (BeanDefinitionVisitor.java:147)
    at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition (BeanDefinitionVisitor.java:85)
    at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties (PlaceholderConfigurerSupport.java:225)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.processProperties (PropertySourcesPlaceholderConfigurer.java:182)
    at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory (PropertySourcesPlaceholderConfigurer.java:157)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:286)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors (PostProcessorRegistrationDelegate.java:166)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors (AbstractApplicationContext.java:705)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:531)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (ContextLoader.java:400)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext (ContextLoader.java:291)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized (ContextLoaderListener.java:103)
    at org.apache.catalina.core.StandardContext.listenerStart (StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start (LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call (ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call (ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
    at java.lang.Thread.run (Thread.java:844)
    10月 19, 2020 8:53:54 上午 org.apache.catalina.util.SessionIdGenerator createSecureRandom
    信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [224] milliseconds.
    10月 19, 2020 8:53:54 上午 org.apache.catalina.core.StandardContext startInternal
    严重: Context [] startup failed due to previous errors
    10月 19, 2020 8:53:54 上午 org.apache.catalina.core.ApplicationContext log
    信息: Closing Spring root WebApplicationContext
    10月 19, 2020 8:53:54 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    10月 19, 2020 8:53:54 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: The web application [] registered the JDBC driver [com.mysql.fabric.jdbc.FabricMySQLDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    10月 19, 2020 8:53:54 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: The web application [] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    10月 19, 2020 8:53:54 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: The web application [] registered the JDBC driver [com.alibaba.druid.mock.MockDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    10月 19, 2020 8:53:54 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
    严重: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoader (file:/D:/maven/repository/org/apache/tomcat/embed/tomcat-embed-core/7.0.37/tomcat-embed-core-7.0.37.jar) to field java.lang.Thread.threadLocals
    WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoader
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    10月 19, 2020 8:53:54 上午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["http-bio-80"]

    ignore-resource-not-found:如果属性文件找不到,是否忽略,默认false,即不忽略,找不到文件并不会抛出异常。 
    ignore-unresolvable:是否忽略解析不到的属性,如果不忽略,找不到将抛出异常。但它设置为true的主要原因是:

    理解:ignore-unresolvable为true时,配置文件${}找不到对应占位符的值 不会报错,会直接赋值'${}';如果设为false,会直接报错。 设置它为true的主要原因,是一个xml中有多个配置文件时的情况:

  • 相关阅读:
    在linux服务器上搭建nvidia-docker环境
    Mysql入门
    POSTMAN关联
    SQL之内连接与外连接
    JMeter线程组参数含义
    JMeter基本概念
    JMeter聚合报告参数含义
    JMeter录制脚本
    Mysql日期与时间类型及函数
    linux服务器上安装mysql
  • 原文地址:https://www.cnblogs.com/KingAndPig/p/13838334.html
Copyright © 2011-2022 走看看