• 找不着 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中有多个配置文件时的情况:

  • 相关阅读:
    Js事件触发列表与解说(转)
    HTTP 头部解释,HTTP 头部详细分析,最全HTTP头部信息
    【转】php 数组 编码转换
    Cookie 的规范介绍
    PHP底层的运行机制与原理
    PHP为什么会被认为是草根语言?
    asp.net中读取带有加号(+)的Cookie,会自动把加号替换为空格
    git克隆某个分支到本地指定的目录中
    yq(json,yaml)格式转换工具安装和使用
    k8s中configmap的作用及使用方式
  • 原文地址:https://www.cnblogs.com/KingAndPig/p/13838334.html
Copyright © 2020-2023  润新知