zoukankan      html  css  js  c++  java
  • java.util.MissingResourceException: Can't find bundle for base name init, locale zh_CN问题的处理

    一、问题描述

        项目开发使用的是SSM框架,项目那个正常运行,开发一个新功能后,添加了一些配置文件,再重新运行项目抛出异常,找不到name为init的bean。

    二、异常信息详细

    六月 30, 2018 8:49:56 下午 org.apache.catalina.core.StandardWrapperValve invoke
    严重: Servlet.service() for servlet [springServlet] in context with path [/cyd_online] threw exception [Handler processing failed; nested exception is java.lang.ExceptionInInitializerError] with root cause
    java.util.MissingResourceException: Can't find bundle for base name init, locale zh_CN
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
        at com.cyd.modules.cyd.fuiou.utils.ConfigReader.<clinit>(ConfigReader.java:11)
        at com.cyd.modules.cyd.fuiou.base.Constants.<clinit>(Constants.java:55)
        at com.cyd.modules.cyd.fuiou.service.NewProOrderService.order(NewProOrderService.java:79)
        at com.cyd.modules.cyd.service.AccountRechargeService.getNewProOrder(AccountRechargeService.java:86)
        at com.cyd.modules.cyd.service.AccountRechargeService$$FastClassBySpringCGLIB$$ce1e5ee.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    ...
    ...
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.util.MissingResourceException: Can't find bundle for base name init, locale zh_CN
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
        at com.cyd.modules.cyd.fuiou.utils.ConfigReader.<clinit>(ConfigReader.java:11)
        ... 55 more

    三、问题处理

        此处的问题,是因为配置文件init.properties放在了开发模块fuiou下,而bean的路径资源路径是classpath:/init.properties,导致项目运行时加载不到给配置文件而无法初始实例化bean。

        此处将配置文件init.properties放在跟资源目录下即可。

     

  • 相关阅读:
    2073: [POI2004]PRZ
    BZOJ 3669: [Noi2014]魔法森林
    Dominator Tree & Lengauer-Tarjan Algorithm
    BZOJ 3526: [Poi2014]Card
    BZOJ 2733: [HNOI2012]永无乡
    BZOJ 2929: [Poi1999]洞穴攀行
    BZOJ 3730: 震波
    BZOJ 1778: [Usaco2010 Hol]Dotp 驱逐猪猡
    BZOJ 1195: [HNOI2006]最短母串
    BZOJ 4030: [HEOI2015]小L的白日梦
  • 原文地址:https://www.cnblogs.com/niaonao/p/9249051.html
Copyright © 2011-2022 走看看