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

来源:互联网 发布:全国出生缺陷监测数据 编辑:程序博客网 时间:2024/06/01 11:15

修改项目的配置文件,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笑)============

4 0
原创粉丝点击