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>  
  • 相关阅读:
    轻松处理高于平常10倍的视频需求,还能节省60%的IT成本,蓝墨做对了什么?
    支付宝研究员王益的建议:“学好语文,才能写好代码”
    Flutter+FaaS一体化任务编排的思考与设计
    开放下载!《大促背后的前端核心业务实践》
    揭秘!信息检索技术高端玩法
    秒懂云通信:如何用阿里云语音通知服务(小白指南)
    卡顿人生,如何拯救?
    阿里云荣获可信云容器安全能力先进级认证, ACK/ACR为企业级安全护航
    飞天大数据产品价值解读— SaaS模式云数据仓库MaxCompute
    阿里产品专家:高情商的技术人,如何做沟通?
  • 原文地址:https://www.cnblogs.com/jepson6669/p/9034391.html
Copyright © 2011-2022 走看看