zoukankan      html  css  js  c++  java
  • Spring部署报错:Could not open ServletContext resource [/jdbc.properties]

     1 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
     2 org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc:properties]
     3     at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:87)
     4     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
     5     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:656)
     6     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
     7     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
     8     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
     9     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
    10     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4728)
    11     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162)
    12     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    13     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    14     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    15     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    16     at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1069)
    17     at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1719)
    18     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    19     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    20     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    21     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    22     at java.lang.Thread.run(Thread.java:745)
    23 Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc:properties]
    24     at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:140)
    25     at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:181)
    26     at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
    27     at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
    28     ... 19 more
    复制代码

    解决方法:

    1
    2
    3
    在spring配置中加载文件的配置修改为
        <context:property-placeholder location="classpath:jdbc.properties">
    </context:property-placeholder>
  • 相关阅读:
    Django连接MySQL(二)
    Django框架,python2和python3共存的情况下,创建Django项目
    pycharm破解
    dbutils中实现数据的增删改查的方法,反射常用的方法,绝对路径的写法(杂记)
    Spring中的事物管理,基于spring的bean的配置
    Spring中的事物管理,用 @Transactional 注解声明式地管理事务
    Ajax中GET和POST的区别
    Spring对 JDBC 的支持,JdbcTemplate类的使用
    Spring AOP:面向切面编程,AspectJ,是基于spring 的xml文件的方法
    Spring AOP:面向切面编程,AspectJ,是基于注解的方法
  • 原文地址:https://www.cnblogs.com/Lawsky/p/6515760.html
Copyright © 2011-2022 走看看