incubator-chukwa-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Min Zhou <>
Subject problems about JSON
Date Thu, 04 Nov 2010 06:53:17 GMT
Hi all,

We deployed chukwa on a 5 nodescluster where hadoop's version is
hadoop 0.20.2 and chukwa's is 0.4.0.  After some logs of NameNode were
successfully collectected and processed by chukwa, we started hicc
server. The hicc produced files  listed below on HDFS,

# bin/hadoop dfs -lsr /chukwa/hicc/views/
drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
-rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
-rw-r--r--   2 root supergroup        236 2010-11-04 13:01
-rw-r--r--   2 root supergroup         46 2010-11-04 13:01
-rw-r--r--   2 root supergroup        103 2010-11-04 13:01
drwxr-xr-x   - root supergroup          0 2010-11-04 13:01

We digged into the hicc.log and found that it encountered some
exceptions about JSON.

2010-11-04 14:00:16,954 ERROR btpool0-3 ViewBean -
org.json.JSONException: JSONObject["owner"] not found.
        at org.json.JSONObject.get(
        at org.json.JSONObject.getString(
        at org.apache.hadoop.chukwa.datastore.ViewStore.list(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(
        at com.sun.jersey.spi.container.servlet.WebComponent.service(
        at org.mortbay.thread.QueuedThreadPool$

After further analysis, we found the problem is caused by at lines in

    String[] pathList = new String[2];
    JSONArray list = new JSONArray();
    for(String path : pathList) {
      Path viewFile = new Path(path);
      try {
        FileSystem fs = FileSystem.get(config);
        FileStatus[] fstatus = fs.listStatus(viewFile);
        if(fstatus!=null) {
          for(int i=0;i<fstatus.length;i++) {
            long size = fstatus[i].getLen();
            FSDataInputStream viewStream =[i].getPath());
            byte[] buffer = new byte[(int)size];
            try {
              ViewBean view = new ViewBean(new JSONObject(new String(buffer)));
              JSONObject json = new JSONObject();
              json.put("name", view.getName());
              json.put("type", view.getPermissionType());
              json.put("owner", view.getOwner());
              if(uid.intern()==view.getOwner().intern()) {
              } else {
            } catch (Exception e) {
      } catch (IOException ex) {

All files of /chukwa/hicc/views/public/ would be read and then parsed
into json objects.  After that, those json objects were passed to
ViewBean's constructor which will run
json.getString("owner").  But there is only one file(default.view) 's
json has this key. So the exception throwed.

Could anyone help me with this?

My research interests are distributed systems, parallel computing and
bytecode based virtual machine.

My profile:
My blog:

View raw message