Properties prop = new Properties(); try { String realPathSRC = PropertiesUtil.class.getClassLoader().getResource("/").getPath(); //判断文件是否存在,如果存在将属性及值取得放到Properties,关闭文件流 File file = new File(realPathSRC + "bppm.properties"); if (!file.exists()) file.createNewFile(); InputStream fis = new FileInputStream(file); prop.load(fis); fis.close();// 一定要在修改值之前关闭fis OutputStream fos = new FileOutputStream(PropertiesUtil.class.getClassLoader().getResource(PROPERTY_FILE).getPath()); prop.setProperty("TOKEN_ID", "tokenID"); prop.store(fos, ""); fos.close(); } catch (Exception e) { e.printStackTrace(); }
一月 11, 2016 6:47:01 下午 org.apache.catalina.core.ApplicationContext log
信息: Shutting down log4j
一月 11, 2016 6:47:01 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/nump_data_rest] appears to have started a thread named [FileWatchdog] but has failed to stop it. This is very likely to create a memory leak.
一月 11, 2016 6:47:01 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/nump_data_rest] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak.
一月 11, 2016 6:47:01 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/nump_data_rest] appears to have started a thread named [tmqiConnectionFlowControl-0] but has failed to stop it. This is very likely to create a memory leak.
一月 11, 2016 6:47:01 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/nump_data_rest] appears to have started a thread named [iMQReadChannel-0] but has failed to stop it. This is very likely to create a memory leak.
一月 11, 2016 6:47:01 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/nump_data_rest] appears to have started a thread named [tmqiConsumerReader-0-646-0] but has failed to stop it. This is very likely to create a memory leak.
log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.PoolingHttpClientConnectionManager).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
你 好我也遇到了相同的问题,修改properties 后,tomcat 直接就挂掉了 自动重起,调式进去,也没有看出为什么会这样。