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>  
  • 相关阅读:
    Blazor 服务端组件 Render, RenderFragment ,RenderTreeBuilder, CascadingValue/CascadingParameter
    Git Submodule管理项目子模块
    使用Try.NET创建可交互.NET文档
    开包即食的教程带你浅尝最新开源的C# Web引擎 Blazor
    搞懂Xamarin.Forms布局,看这篇应该就够了吧
    【译】.NET 跨平台界面框架和为什么你首先要考虑再三
    Roslyn 语法树中的各种语法节点及每个节点的含义
    数组的子集
    查找字符串中的最长无重复字符的子串
    双通道无限蓝屏
  • 原文地址:https://www.cnblogs.com/jepson6669/p/9034391.html
Copyright © 2011-2022 走看看