javax.naming.NameNotFoundException

2015-08-27 09:53:16,463 [localhost-startStop-1] DEBUG [org.springframework.jndi.JndiTemplate] - Looking up JNDI object with name [java:comp/env/spring.liveBeansView.mbeanDomain]
2015-08-27 09:53:16,463 [localhost-startStop-1] DEBUG [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].
2015-08-27 09:53:16,463 [localhost-startStop-1] DEBUG [org.springframework.jndi.JndiTemplate] - Looking up JNDI object with name [spring.liveBeansView.mbeanDomain]
2015-08-27 09:53:16,464 [localhost-startStop-1] DEBUG [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.


上面是爆出的异常信息,从中可以很清晰的看出异常来自JNDI的数据源配置,可是我的项目中没有配置使用JNDI,至于引起这个异常的原因,查阅了很多资料,有人说是jar的问题,有人说是spring配置的问题,国外有人分析称是spring内部的问题,具体什么因素造成的本人没有去研究,希望有看到的朋友,能留言,谢谢啦,ps(自我理解,不管对错都要勇敢说出来,不说永远不知道对错,阻碍思路的角度),这个项目本人使用的是:spring3.2+springMVC+druid+mybatis3.2.2/spring-mybatis1.2.0


下面附上两种解决方案:

1:从控制到打印的logo看,项目的日志级别应该至少有DEBUG级别:log4j.rootLogger = DEBUG,console,file

去配置文件中将debug级别换掉,或是用info。则不会再有此异常信息:log4j.rootLogger = info,console,file


2:在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>




你可能感兴趣的:(javax.naming.NameNotFoundException)