zoukankan      html  css  js  c++  java
  • javax.naming.NameNotFoundException

    springmvc和mybatis整合项目debug启动,抛出下面的异常。

    07:51:36,521 DEBUG JndiLocatorDelegate:101 - Converted JNDI name [java:comp/env/spring.profiles.default] not found - trying original name [spring.profiles.default]. javax.naming.NameNotFoundException: Name [spring.profiles.default] is not bound in this Context. Unable to find [spring.profiles.default].
    07:51:36,521 DEBUG JndiTemplate:150 - Looking up JNDI object with name [spring.profiles.default]
    07:51:36,521 DEBUG JndiPropertySource:90 - JNDI lookup for name [spring.profiles.default] threw NamingException with message: Name [spring.profiles.default] is not bound in this Context. Unable to find [spring.profiles.default].. Returning null.
    
    
    
    07:51:36,521 DEBUG JndiLocatorDelegate:101 - 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. Unable to find [spring.profiles.active].
    07:51:36,521 DEBUG JndiTemplate:150 - Looking up JNDI object with name [spring.profiles.active]
    07:51:36,521 DEBUG JndiPropertySource:90 - JNDI lookup for name [spring.profiles.active] threw NamingException with message: Name [spring.profiles.active] is not bound in this Context. Unable to find [spring.profiles.active].. Returning null.
    
    
    
    07:51:37,099 DEBUG JndiLocatorDelegate:101 - 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].
    07:51:37,099 DEBUG JndiTemplate:150 - Looking up JNDI object with name [spring.liveBeansView.mbeanDomain]
    07:51:37,099 DEBUG JndiPropertySource:90 - 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配置的内部问题,这里我并没有取深究具体的问题。

    如果不想看到上面抛出异常的日志信息,我们有两种解决办法。

    方法一:修改log4j日志信息的级别为info级别,就不会看到上面的信息了

    修改为:

    方法二:修改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>  
  • 相关阅读:
    20180831 租房子(管理员) 增加 删除 修改 发布
    租房子(用户登录) 最主要的 查!!!!!!(只显示查的页面代码)
    20180825 ajax PHP html js 实现 三级联动(省 市 区)
    20180823 连接数据库 把数据库的内容呈现到js上面 重点牢记
    20180821 PHP环境下 数组 函数
    20180820 PHP 基本环境 变量 常量 数据类型 运算符
    移动端h5列表页上拉分页加载更多
    JS中的if和else的用法以及基础语法
    JS数组方法大全
    7.7PHP所学知识总结
  • 原文地址:https://www.cnblogs.com/jepson6669/p/9034391.html
Copyright © 2011-2022 走看看