Name spring.profiles.active is not bound in this Context

wl8685 wl8685 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
要修改一个项目,用的技术有springMVC,maven等,部署到tomcat下,启动时报错。项目中使用的连接池连接数据库,没有使用JNDI,为什么启动时老是去查找JNDI?
applicationContext.xml中定义了项目的环境:

<!-- local development环境 -->
<beans profile="development">
<context:property-placeholder ignore-resource-not-found="true"
location="classpath*:/application.properties" />

<!-- Tomcat JDBC连接池 -->
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="defaultAutoCommit" value="false" />
</bean>
</beans>


pom.xml中设置了spring.profiles.active

<!-- jetty插件, 设定context path与spring profile -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<systemProperties>
<systemProperty>
<name>spring.profiles.active</name>
<value>development</value>
</systemProperty>
</systemProperties>
<useTestClasspath>true</useTestClasspath>

<webAppConfig>
<contextPath>/${project.artifactId}</contextPath>
</webAppConfig>
</configuration>
</plugin>

==========启动日志==========
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [servletConfigInitParams]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [servletContextInitParams]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [jndiProperties]
13:57:46.586 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.profiles.active]
13:57:46.586 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.profiles.active] not found - trying original name [spring.profiles.active]. javax.naming.NameNotFoundException: Name spring.profiles.active is not bound in this Context
13:57:46.586 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.profiles.active]
13:57:46.586 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [spring.profiles.active] threw NamingException with message: Name spring.profiles.active is not bound in this Context. Returning null.
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [systemProperties]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [systemEnvironment]
13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source. Returning [null]

.....
......
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [environmentProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [servletConfigInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [servletContextInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [jndiProperties]
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.driver]
13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.driver] not found - trying original name [jdbc.driver]. javax.naming.NameNotFoundException: Name jdbc.driver is not bound in this Context
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.driver]
13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.driver] threw NamingException with message: Name jdbc.driver is not bound in this Context. Returning null.
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [systemProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [systemEnvironment]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.driver' in any property source. Returning [null]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [localProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.driver' in [localProperties] with type [String] and value 'com.mysql.jdbc.Driver'
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [environmentProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [servletConfigInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [servletContextInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [jndiProperties]
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.url]
13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.url] not found - trying original name [jdbc.url]. javax.naming.NameNotFoundException: Name jdbc.url is not bound in this Context
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.url]
13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.url] threw NamingException with message: Name jdbc.url is not bound in this Context. Returning null.
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [systemProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [systemEnvironment]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.url' in any property source. Returning [null]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [localProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.url' in [localProperties] with type [String] and value 'jdbc:mysql://127.0.0.1:3306/drolohq?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull'
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [environmentProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [servletConfigInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [servletContextInitParams]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [jndiProperties]
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.username]
13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.username] not found - trying original name [jdbc.username]. javax.naming.NameNotFoundException: Name jdbc.username is not bound in this Context
13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.username]
13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.username] threw NamingException with message: Name jdbc.username is not bound in this Context. Returning null.
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [systemProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [systemEnvironment]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.username' in any property source. Returning [null]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [localProperties]
13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.username' in [localProperties] with type [String] and value 'root'
...全文

相关推荐

Spring Boot实战:流浪动物管理系统开发教程

Java Web开发中,Spring Boot凭借自动化配置与内嵌容器特性,已成为构建企业级应用的主流选择。它降低了项目搭建门槛,让开发者专注于业务逻辑,同时结合MyBatis实现灵活的数据持久化,MySQL存储结构化数据,能高效支撑管理类系统的快速开发。从宠物领养到企业资产管理,这类分层架构的系统在课程设计、毕业设计及实际工程中均有广泛应用。本文以一个完整的流浪动物管理系统为例,从需求分析、数据库设计到后端接口与前端页面整合,系统梳理了Spring Boot + MyBatis + MySQL的项目实现全

weixin_30333885

SpringBoot+Vue3图书管理系统:前后端分离实战与部署指南

在Java Web开发领域,前后端分离架构已成为构建现代Web应用的主流模式。其核心原理是后端通过RESTful接口提供数据服务,前端通过HTTP请求调用并渲染界面,二者独立开发、独立部署,有效提升团队协作效率与系统可维护性。SpringBoot作为Java生态中轻量级的微服务开发框架,结合Vue3这一渐进式前端框架,能够快速搭建出结构清晰、交互流畅的管理类系统。这套技术组合广泛应用于课程设计、毕业设计以及个人简历项目,尤其适合初学者完整理解从数据库建模到接口联调的全流程。图书管理系统作为经典CRUD应用,

njit_peiyuan

SpringBoot+Vue实战:学生宿舍报修系统开发全流程解析

在软件开发领域,前后端分离架构已成为构建现代Web应用的主流范式。其核心原理在于将应用的前端展示层与后端业务逻辑层解耦,后端通过RESTful API提供数据服务,前端则专注于用户交互与界面渲染。这种架构模式的技术价值在于提升了开发效率、增强了系统可维护性,并支持团队并行协作。它广泛应用于各类管理后台、电商平台及企业级应用。本文聚焦于一个典型应用场景——学生宿舍报修管理系统,深入剖析如何运用SpringBoot与Vue技术栈实现一个功能闭环、开箱即用的实战项目。通过拆解其环境搭建、代码结构及核心模块,特别是

weixin_33805992

【信息科学与工程学】计算机科学与自动化-——第十五篇云计算 12 公有云里的“多Region + 多AZ“ 02 运营算法01

算法逐步思考推理思考(含数学方程式、对象、资源、任务、进程/协程/线程及对应的代数、约束、目标函数/传递函数/依赖函数、参数及参数的数值范围及边界条件、逐步推理的数学方程式列表、上下文切换、并发/串行/随机/乱序/顺序)算法逐步思考推理思考(含数学方程式、对象、资源、任务、进程/协程/线程及对应的代数、约束、目标函数/传递函数/依赖函数、参数及参数的数值范围及边界条件、逐步推理的数学方程式列表、上下文切换、并发/串行/随机/乱序/顺序)云厂商提高闲置资源利用率。算法复杂度为O(N),N为实例数量。

flyair_China

战国BC298年世界历史地图矢量文件SHP格式.zip

本资源为《战国BC298年世界历史地图矢量文件SHP格式》压缩包,文件大小约 2.29 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。

白水先森
评论 2
收藏 已收藏
分享
返回顶部
wl8685
Java EE 67,535 成员 225,843 内容