fix bug: server.ip not found

This commit is contained in:
judy0131 2020-03-23 15:44:38 +08:00
parent a2109eb2f6
commit ab29f7ac06
4 changed files with 14 additions and 3 deletions

View File

@ -74,7 +74,8 @@
"properties":{
"csvSavePath":"hdfs://10.0.86.89:9000/xjzhu/phdthesis_result.csv",
"header":"true",
"delimiter":","
"delimiter":",",
"partition": "1"
}
}
],

View File

@ -59,7 +59,8 @@
"properties":{
"csvSavePath":"hdfs://10.0.86.191:9000/xjzhu/phdthesis_result.csv",
"header":"true",
"delimiter":","
"delimiter":",",
"partition": "1"
}
}
],

View File

@ -12,6 +12,11 @@ object FileUtil {
def writeFile(text: String, path: String) = {
val file = new File(path)
if(!file.exists()){
file.createNewFile()
}
val writer = new PrintWriter(new File(path))
writer.write(text)
writer.close()

View File

@ -1,6 +1,6 @@
package cn.piflow.util
import java.io.{FileInputStream, InputStream}
import java.io.{File, FileInputStream, InputStream}
import java.net.InetAddress
import java.util.Properties
@ -13,6 +13,10 @@ object ServerIpUtil {
val userDir = System.getProperty("user.dir")
path = userDir + "/server.ip"
val file = new File(path)
if(!file.exists()){
file.createNewFile()
}
prop.load(new FileInputStream(path))
} catch{
case ex: Exception => ex.printStackTrace()