Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find

简介: 修改项目的配置文件,log4j的日志输出级别修改为DEBUG,打印详细的错误信息后,启动项目控制台输出有以下异常信息:[org.springframework.jndi.JndiTemplate]-Looking up JNDI object with name [java:comp/env/spring.

修改项目的配置文件,log4j的日志输出级别修改为DEBUG,打印详细的错误信息后,

启动项目控制台输出有以下异常信息:

[org.springframework.jndi.JndiTemplate]-Looking up JNDI object with name [java:comp/env/spring.liveBeansView.mbeanDomain]
[org.springframework.jndi.JndiLocatorDelegate]-Converted JNDI name [java:comp/env/spring.liveBeansView.mbeanDomain] not found - trying original name [spring.liveBeansView.mbeanDomain]. javax.naming.NameNotFoundException: Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find [spring.liveBeansView.mbeanDomain].
[org.springframework.jndi.JndiTemplate]-Looking up JNDI object with name [spring.liveBeansView.mbeanDomain]
[org.springframework.jndi.JndiPropertySource]-JNDI lookup for name [spring.liveBeansView.mbeanDomain] threw NamingException with message: Name [spring.liveBeansView.mbeanDomain] is not bound in this Context. Unable to find [spring.liveBeansView.mbeanDomain].. Returning null.
[org.springframework.core.env.PropertySourcesPropertyResolver]-Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
[org.springframework.core.env.PropertySourcesPropertyResolver]-Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
[org.springframework.core.env.PropertySourcesPropertyResolver]-Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null]
[org.springframework.web.servlet.DispatcherServlet]-Published WebApplicationContext of servlet 'SpringMVC' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.SpringMVC]
[org.springframework.web.servlet.DispatcherServlet]-FrameworkServlet 'SpringMVC': initialization completed in 1138 ms
[org.springframework.web.servlet.DispatcherServlet]-Servlet 'SpringMVC' configured successfully
三月 22, 2017 11:45:12 上午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/yuyi] is completed
这个异常倒是不影响项目运行。

错误原因:

就是提供通过JMX来实时查看Spring放在application context里的bean列表功能的一个包,他会在你的配置文件里找一个叫"spring.liveBeansView.mbeanDomain"的环境变量,没找到,就报错了。

解决方法

如果你不使用任何 profiles 或 mbeans,可以在web.xml 中添加以下内容:

<context-param>  
    <param-name>spring.profiles.active</param-name>  
    <param-value>dev</param-value>  
</context-param>  
<context-param>  
    <param-name>spring.profiles.default</param-name>  
    <param-value>dev</param-value>  
</context-param>
<context-param>  
    <param-name>spring.liveBeansView.mbeanDomain</param-name>  
    <param-value>dev</param-value>  
</context-param>  

希望有人能提供比这更好的解决方案。

参考:

https://www.zhihu.com/question/21477643

http://stackoverflow.com/questions/23750619/spring-jndi-namingexception-name-spring-livebeansview-mbeandomain-is-not-boun

======================文档信息========================

版权声明:非商用自由转载-保持署名-注明出处

署名(BY) :testcs_dn(微wx笑)

文章出处:[无知人生,记录点滴](http://blog.csdn.NET/testcs_dn)

==============欢迎关注我的个人微信订阅号(微wx笑)============

目录
相关文章
|
设计模式 Java 开发者
【小家Spring】面向切面编程之---Spring AOP的原理讲解以及源码分析(Cannot find current proxy: Set 'exposeProxy' property on )(下)
【小家Spring】面向切面编程之---Spring AOP的原理讲解以及源码分析(Cannot find current proxy: Set 'exposeProxy' property on )(下)
【小家Spring】面向切面编程之---Spring AOP的原理讲解以及源码分析(Cannot find current proxy: Set 'exposeProxy' property on )(下)
|
2月前
|
Java Spring
spring-doc报错Unable to render this definition
spring-doc报错Unable to render this definition
165 0
|
NoSQL Java Redis
Spring cloud Gateaway : Unable to find GatewayFilterFactory with name RequestRateLimiter
Spring cloud Gateaway : Unable to find GatewayFilterFactory with name RequestRateLimiter
Spring cloud Gateaway : Unable to find GatewayFilterFactory with name RequestRateLimiter
|
NoSQL Redis Sentinel
redisson-spring-boot-starter Unable to connect to Redis server: 127.0.0.1/127.0.0.1:6381
redisson-spring-boot-starter Unable to connect to Redis server: 127.0.0.1/127.0.0.1:6381
redisson-spring-boot-starter Unable to connect to Redis server: 127.0.0.1/127.0.0.1:6381
|
Java 开发者 Spring
【小家Spring】面向切面编程之---Spring AOP的原理讲解以及源码分析(Cannot find current proxy: Set 'exposeProxy' property on )(上)
【小家Spring】面向切面编程之---Spring AOP的原理讲解以及源码分析(Cannot find current proxy: Set 'exposeProxy' property on )(上)
|
Spring Java
Spring cloud Hystrix仪表盘之Unable to connect to Command Metric Stream.
springboot 2.0需要添加 ServletRegistrationBean 因为springboot的默认路径不是 "/hystrix.stream",只要在自己的项目里配置上下面的servlet就可以了 @Bean public ServletRegistrationBean ...
3434 0
使用 spring-cloud-starter-zuul 报错 :0 can't find referenced pointcut hystrixCommandAnnotationPointcut
使用 spring-cloud-starter-zuul 报错 :0 can't find referenced pointcut hystrixCommandAnnotationPointcut 原因: org/aspectj/weaver/ 的 JDK 版本与项目的 JDK 版本 不一致。
1429 0
|
28天前
|
Java 应用服务中间件 Maven
SpringBoot 项目瘦身指南
SpringBoot 项目瘦身指南
41 0
|
1月前
|
缓存 安全 Java
Spring Boot 面试题及答案整理,最新面试题
Spring Boot 面试题及答案整理,最新面试题
111 0