zoukankan      html  css  js  c++  java
  • ArcGis Server 服务启动后自动停止的解决办法

    最近ArcGIS Server突然无法无法启动,启动后自动又停止了,网上找了很久,终于看到一位网友的解决办法:查看原文,但是这位大神给的代码有一些对于编程经验不足的人来说很致命的缺陷:中文字符以及转义字符导致程序直接运用是无效的。

    定位错误

    首先,我们需要知道具体是什么原因导致的错误,于是需要找到服务相关的日志位置,日志文件所在目录(Server安装目录下,我的在C盘):

    C:\Program Files\ArcGIS\Server\framework\etc\service\logs
    其中可以看到service.log和service_error.log两个文件,具体信息可以参考service_error.log

    java.lang.RuntimeException: com.esri.arcgis.discovery.json.JSONException: A JSONObject text must begin with ‘{’ at character 1 of
    at com.esri.arcgis.discovery.logging.impl.LogService.d(LogService.java:326)
    at com.esri.arcgis.discovery.logging.impl.LogService.(LogService.java:94)
    at com.esri.arcgis.discovery.util.JMXServerController.createLogService(JMXServerController.java:64)
    at com.esri.arcgis.discovery.nodeagent.impl.NodeAgent.registerLogService(NodeAgent.java:694)
    at com.esri.arcgis.discovery.nodeagent.impl.NodeAgent.start(NodeAgent.java:290)
    at com.esri.arcgis.discovery.nodeagent.impl.Main.start(Main.java:51)
    Caused by: com.esri.arcgis.discovery.json.JSONException: A JSONObject text must begin with ‘{’ at character 1 of
    at com.esri.arcgis.discovery.json.JSONTokener.syntaxError(JSONTokener.java:454)
    at com.esri.arcgis.discovery.json.JSONObject.(JSONObject.java:178)
    at com.esri.arcgis.discovery.json.JSONObject.(JSONObject.java:276)
    at com.esri.arcgis.discovery.logging.LogConfig.fromJSONString(LogConfig.java:208)
    at com.esri.arcgis.discovery.logging.impl.LogService.d(LogService.java:285)

    可以看到起具体错误为:
    ava.lang.RuntimeException: com.esri.arcgis.discovery.json.JSONException: A JSONObject text must begin with ‘{’ at character 1 of
    对于此错误,可以定位到 C:\Program Files\ArcGIS\Server\framework\etc 路径下(ArcGIS Server安装目录)的arcgis-logsettings.json文件,此时,文件用notepad打开为空,导致json解析错误,我们在该文件中添加如下内容即可解决:

    {
      "logDir":"D:\\arcgisserver\\logs\\"
    }

    其中,logDir是ArcGIS Server站点的日志文件保存位置,记得一定是双反斜杠,因为在程序中,反斜杠通常是用作特殊字符转义的,还有,这里的双引号必须是英文字符。

    如此,再次重启服务,就正常了。

  • 相关阅读:
    二叉树中和为某一值的路径
    二叉搜索树的后序遍历序列(important!)
    从上往下打印二叉树
    最小的k个数(important!)
    扑克牌顺子
    栈的压入、弹出序列(important!)
    和为s的连续正数序列(important!)
    数组中只出现一次的数字
    fgets()函数以及fputs()函数
    C语言中的指针
  • 原文地址:https://www.cnblogs.com/qiaoge0923/p/15606627.html
Copyright © 2011-2022 走看看