properties can not find in classpath 财富值49

2017-08-20 16:18发布

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.PropertyBundle.<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;     }

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

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
3条回答

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

一周热门 更多>