优艾设计网

properties can not find in classpath?

优艾设计网 https://www.uibq.com 2023-04-06 19:19 出处:网络 作者:在线设计
java.lang.ExceptionInInitializerError at com.sohu.smc.wechat.applet.server.WechatAppletServer.<clinit>(WechatAppletServer.java:27) Caused by: com.sohu.smc.config.conf.ResourceLoadException: Reso

java.lang.ExceptionInInitializerError at com.sohu.smc.wechat.applet.server.WechatAppletServer.<clinit>(WechatAppletServer.java:27) Caused by: com.sohu.smc.config.conf.ResourceLoadException: Resource file [smc-api-memcached.properties] can not find in classpath. at com.sohu.smc.config.conf.PropertyBundle.loadConfig(PropertyBundle.java:57) at com.sohu.smc.wechat.applet.server.ApiSystemProperty.loadConfig(ApiSystemProperty.java:21) at com.sohu.smc.config.conf.P优艾设计网_设计百科ropertyBundle.<init>(PropertyBundle.java:31) at com.sohu.smc.wechat.applet.server.ApiSystemProperty.<init>(ApiSystemProperty.java:16) at com.sohu.smc.wechat.applet.server.ApiBaseConfig.<clinit>(ApiBaseConfig.java:17) ... 1 more Exception in thread "main"

public Properties loadConfig(String fileName) { Properties props = new Properties(); InputStreamReader reader = null;try { InputStream ins = PropertyBundle.class.getClassLoader().getResourceAsStream(fileName); if(ins == null) { System.out.println("Resource file [" + fileName + "] can not find in classpath."); throw new ResourceLoadException("Resource file [" + fileName + "] can not find in classpath."); }reader = new InputStreamReader(ins, "UTF-8"); props.load(reader); } catch (UnsupportedEncodingException var13) { throw new ServerException("Encoding UTF-8 is not supported.", var13); } catch (IOException var14) { throw new ServerException("Resource file [" + fileName + "] cat not be loaded.", var14); } finally { if(reader != null) { try { reader.close(); } catch (IOException var12) { ; } }}return props; }

它是根据选项加载的 不是手写输入的


淡然一笑wwc 优艾设计网_设计百科 2022-04-24 22:05

检查下编译完后target目录下有没有这文件吧


Sunshine 优艾设计网_PS交流 2022-04-24 22:08

ide是idea的话,你的resources文件夹不是资源文件夹,右键将resources文件夹标记为资源文件夹


1598445034dcs 2022-04-24 22:24

优艾设计网_Photoshop交流

你输入的不是完整路径,应该是 online/smc-api-memcached.properties 试试看是不是这个原因


0

精彩评论

暂无评论...
验证码 换一张
取 消