Spring部署报错:Could not open ServletContext resource [/db.properties]
在使用Spring MVC过程中,部署项目报错,报错信息如下:
八月 15, 2016 5:02:04 下午 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.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/db.properties]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:151)
.......
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/db.properties]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:141)
at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:153)
... 51 more
...............................................................................................................................................................................
Maven项目,application-context.xml、db.properties文件均放置在src/main/resources目录下,Tomcat部署项目,src/main/resources目录下的配置文件默认位置为:{项目名}/WEB-INF/classes,而Spring却在项目根目录下寻找,肯定找不到,因此,配置时指定classpath目录下寻找即可。
解决方案如下:
<context:property-placeholder location="classpath:db.properties" />
Spring部署报错:Could not open ServletContext resource [/db.properties]的更多相关文章
- HTTP状态 500 - 内部服务器错误之Could not open ServletContext resource [/db.properties]或者 [/mybatis.xml]
报错原因是因为找不到db.properties或者mybatis.xml,但是我明明写了有.找了一下,才发现spring-dao.xml里面这两个配置文件地址有问题 Maven项目,applicati ...
- Openfire 代码部署报错: Variable references non-existent resource:${workspace_loc:openfire_src}
Variable references non-existent resource:${workspace_loc:openfire_src} -DopenfireHome=“${workspace_ ...
- 解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element
解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element 'beans'.Referenced file conta ...
- Spring Boot报错 MultipartException The temporary upload...
Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...
- Spring Boot 报错记录
Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = Dat ...
- Spring.之.报错:Caused by: java.lang.IllegalArgumentException: No Spring Session store is configured: set the 'spring.session.store-type' property
Spring.之.报错 No Spring Session store is configured springboot在启动的时候报如下错误: Error starting ApplicationC ...
- ionic报错: Failed to load resource
隔了一天,才发现是代码写错了 出错的原因是在ts 文件中使用这样的定义 data: [] = ['高新区', '经开区', '其他园区']; 错误在于这个定义的类型,不能是 [],修改成 any就没有 ...
- Nginx反向代理上传大文件报错(failed to load resource : net :: ERR_CONNECTION_RESET)
转自: https://blog.csdn.net/kinginblue/article/details/50753271?locationNum=14&fps=1 Nginx反向代理上传大文 ...
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...
随机推荐
- 实战:MySQL Sending data导致查询很慢的问题详细分析(转)
这两天帮忙定位一个MySQL查询很慢的问题,定位过程综合各种方法.理论.工具,很有代表性,分享给大家作为新年礼物:) [问题现象] 使用sphinx支持倒排索引,但sphinx从mysql查询源数据的 ...
- mysql数据库以加索引方式提高性能
数据库查询速率慢的情况下可以给对应的表加上对应的索引,能够有效的提高查询效率,mysql数据库添加索引的SQL入下: ALTER TABLE `table_name` ADD INDEX index_ ...
- Spring Boot 2.0官方文档之 Actuator(转)
执行器(Actuator)的定义 执行器是一个制造业术语,指的是用于移动或控制东西的一个机械装置,一个很小的改变就能让执行器产生大量的运动. An actuator is a manufacturin ...
- Android:EditText 属性
Android开发EditText属性 EditText 官网链接 EditText继承关系:View-->TextView-->EditText EditText 部分属性: XML 设 ...
- 通达OA 在工作流中直接查询表单内容的开发尝试(图文)
一个朋友提出要在工作里直接查询表单内容的需求,原来他们把工作流当做业务系统来用.也算把工作流用到极致了.为了实现像软件里直接的查询功能,他想在办理工作流的时候直接能查询到表单里面的内容. 通过研究通达 ...
- Synplify9.6.2破解(转帖)
Synplify9.6.2破解(转帖) 转载自:http://www.cnblogs.com/mark-sun/archive/2012/02/26/2368773.html Abstract本文 ...
- Java experts blog
https://blogs.oracle.com/poonam/ https://blogs.oracle.com/poonam/entry/updates_to_the_java_troublesh ...
- nyoj311 完全背包 经典背包问题
完全背包 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 直接说题意,完全背包定义有N种物品和一个容量为V的背包,每种物品都有无限件可用.第i种物品的体积是c,价值是w. ...
- 【转】VMware虚拟机中CentOS设置固定IP
因为需要配置固定IP,在网上找了很久终于找到一个可行的例子,自己配置成功了. 1.首先获取你的GATEWAY 方便后面在cento系统配置里使用选取菜单栏:Edit->Virtual Netwo ...
- 发布了listener报404
我刚才发布了这么一个listener package org.lxh.listenerdemo ; import javax.servlet.http.* ; public class HttpSes ...