TWaver Forums
http://servasoft.com/forum/

GeoServer沒有運行的Warning修改
http://servasoft.com/forum/viewtopic.php?f=16&t=4769
Page 1 of 1

Author:  tai [ 2014-03-05 9:22 ]
Post subject:  GeoServer沒有運行的Warning修改

我在GIS物件init時會做底下動作:

map.addLayer("all_foxconn_map", TWaverGisConst.EXECUTOR_TYPE_GEOSERVER,
"http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/osm_taiwan/wms?");
map.addLayer("all_foxconn_map", TWaverGisConst.EXECUTOR_TYPE_GEOSERVER,
"http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/osm_lh/wms?");
map.addLayer("all_foxconn_map", TWaverGisConst.EXECUTOR_TYPE_GEOSERVER,
"http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/osm_tj/wms?");

但是當GeoServer沒有運行的狀態下會出現:
Attachment:
MWSnapshot003 2014-03-05, 09_06_15.jpg
MWSnapshot003 2014-03-05, 09_06_15.jpg [ 12.99 KiB | Viewed 9258 times ]


請問可以攔住並轉成自定的錯誤信息嗎?

Author:  Vic [ 2014-03-05 14:57 ]
Post subject:  Re: GeoServer沒有運行的Warning修改

Code:
TWaverUtil.errorHandler = new ErrorHandler(){
      public void handle(String errorMessage, Throwable exception) {
         if(errorMessage != null){
            System.err.println(errorMessage);
         }
         if(exception != null){
            exception.printStackTrace();
         }
      }
   };

Author:  tai [ 2014-03-05 18:42 ]
Post subject:  Re: GeoServer沒有運行的Warning修改

Vic wrote:
Code:
TWaverUtil.errorHandler = new ErrorHandler(){
      public void handle(String errorMessage, Throwable exception) {
         if(errorMessage != null){
            System.err.println(errorMessage);
         }
         if(exception != null){
            exception.printStackTrace();
         }
      }
   };



是這樣嗎???

try {
map.addLayer("all_foxconn_map", TWaverGisConst.EXECUTOR_TYPE_GEOSERVER,
"http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/osm_taiwan/wms?");
map.addLayer("all_foxconn_map", TWaverGisConst.EXECUTOR_TYPE_GEOSERVER,
"http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/osm_lh/wms?");
map.addLayer("all_foxconn_map", TWaverGisConst.EXECUTOR_TYPE_GEOSERVER,
"http://" + WMS_SERVER_IP + ":" + WMS_SERVER_PORT + "/geoserver/osm_tj/wms?");
} catch (Exception ex) {
ex.printStackTrace();
System.err.println("GeoServer尚未運行!");
}

TWaverUtil.errorHandler = new ErrorHandler() {
public void handle(String errorMessage, Throwable exception) {
if (errorMessage != null) {
System.err.println(errorMessage);
}
if (exception != null) {
exception.printStackTrace();
}
}
};

Page 1 of 1 All times are UTC + 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/