做项目时,启动tomcat报错
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.
可以正常运行项目,在网上查询解决方法,错误原因:就是spring-context.jar包中提供通过JMX来实时查看spring放在applicationContext里的bean列表功能,会在项目配置文件里找一个叫"spring.liveBeansView.mbeanDomain"的环境变量,没找到,就报错了。
解决办法就是在项目中的web.xml中添加如下配置:
1 <context-param> 2 <param-name>spring.profiles.active</param-name> 3 <param-value>dev</param-value> 4 </context-param> 5 <context-param> 6 <param-name>spring.profiles.default</param-name> 7 <param-value>dev</param-value> 8 </context-param> 9 <context-param> 10 <param-name>spring.liveBeansView.mbeanDomain</param-name> 11 <param-value>dev</param-value> 12 </context-param>