You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chukwa.apache.org by "Eric Yang (JIRA)" <ji...@apache.org> on 2010/11/05 00:56:41 UTC

[jira] Created: (CHUKWA-543) JSONException in hicc.log file

JSONException in hicc.log file
------------------------------

                 Key: CHUKWA-543
                 URL: https://issues.apache.org/jira/browse/CHUKWA-543
             Project: Chukwa
          Issue Type: Bug
          Components: User Interface
    Affects Versions: 0.4.0
            Reporter: Eric Yang
            Assignee: Eric Yang


Quote from mailing list:

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
/chukwa/hicc/views/public
-rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
/chukwa/hicc/views/public/default.view
-rw-r--r--   2 root supergroup        236 2010-11-04 13:01
/chukwa/hicc/views/public/newview.tpl
-rw-r--r--   2 root supergroup         46 2010-11-04 13:01
/chukwa/hicc/views/public/view.permission
-rw-r--r--   2 root supergroup        103 2010-11-04 13:01
/chukwa/hicc/views/public/workspace_view_list.cache
drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
/chukwa/hicc/views/users

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(JSONObject.java:283)
       at org.json.JSONObject.getString(JSONObject.java:409)
       at org.apache.hadoop.chukwa.rest.bean.ViewBean.<init>(ViewBean.java:62)
       at org.apache.hadoop.chukwa.datastore.ViewStore.list(ViewStore.java:217)
       at org.apache.hadoop.chukwa.rest.resource.ViewResource.getUserViewList(ViewResource.java:159)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
       at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
       at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:166)
       at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
       at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:74)
       at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
       at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:66)
       at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:658)
       at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
       at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
       at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
/pathList
       at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

After further analysis, we found the problem is caused by at lines in
ViewStore.list()

   String[] pathList = new String[2];
   pathList[0]=viewPath.toString();
   pathList[1]=publicViewPath;
   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 = fs.open(fstatus[i].getPath());
           byte[] buffer = new byte[(int)size];
           viewStream.readFully(buffer);
           viewStream.close();
           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()) {
               json.put("editable","true");
             } else {
               json.put("editable","false");
             }
             list.put(json);
           } catch (Exception e) {
             log.error(ExceptionUtil.getStackTrace(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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CHUKWA-543) JSONException in hicc.log file

Posted by "Eric Yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CHUKWA-543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Yang updated CHUKWA-543:
-----------------------------

    Attachment: ViewStore.java

Patch for checking view file for .view extendsion before parsing.

> JSONException in hicc.log file
> ------------------------------
>
>                 Key: CHUKWA-543
>                 URL: https://issues.apache.org/jira/browse/CHUKWA-543
>             Project: Chukwa
>          Issue Type: Bug
>          Components: User Interface
>    Affects Versions: 0.4.0
>            Reporter: Eric Yang
>            Assignee: Eric Yang
>         Attachments: ViewStore.java
>
>
> Quote from mailing list:
> 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
> /chukwa/hicc/views/public
> -rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
> /chukwa/hicc/views/public/default.view
> -rw-r--r--   2 root supergroup        236 2010-11-04 13:01
> /chukwa/hicc/views/public/newview.tpl
> -rw-r--r--   2 root supergroup         46 2010-11-04 13:01
> /chukwa/hicc/views/public/view.permission
> -rw-r--r--   2 root supergroup        103 2010-11-04 13:01
> /chukwa/hicc/views/public/workspace_view_list.cache
> drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
> /chukwa/hicc/views/users
> 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(JSONObject.java:283)
>        at org.json.JSONObject.getString(JSONObject.java:409)
>        at org.apache.hadoop.chukwa.rest.bean.ViewBean.<init>(ViewBean.java:62)
>        at org.apache.hadoop.chukwa.datastore.ViewStore.list(ViewStore.java:217)
>        at org.apache.hadoop.chukwa.rest.resource.ViewResource.getUserViewList(ViewResource.java:159)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
>        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:166)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:74)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:66)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:658)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
>        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
> /pathList
>        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> After further analysis, we found the problem is caused by at lines in
> ViewStore.list()
>    String[] pathList = new String[2];
>    pathList[0]=viewPath.toString();
>    pathList[1]=publicViewPath;
>    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 = fs.open(fstatus[i].getPath());
>            byte[] buffer = new byte[(int)size];
>            viewStream.readFully(buffer);
>            viewStream.close();
>            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()) {
>                json.put("editable","true");
>              } else {
>                json.put("editable","false");
>              }
>              list.put(json);
>            } catch (Exception e) {
>              log.error(ExceptionUtil.getStackTrace(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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CHUKWA-543) JSONException in hicc.log file

Posted by "Eric Yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CHUKWA-543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Yang updated CHUKWA-543:
-----------------------------

    Fix Version/s: 0.5.0
           Status: Patch Available  (was: Open)

> JSONException in hicc.log file
> ------------------------------
>
>                 Key: CHUKWA-543
>                 URL: https://issues.apache.org/jira/browse/CHUKWA-543
>             Project: Chukwa
>          Issue Type: Bug
>          Components: User Interface
>    Affects Versions: 0.4.0
>            Reporter: Eric Yang
>            Assignee: Eric Yang
>             Fix For: 0.5.0
>
>         Attachments: ViewStore.java
>
>
> Quote from mailing list:
> 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
> /chukwa/hicc/views/public
> -rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
> /chukwa/hicc/views/public/default.view
> -rw-r--r--   2 root supergroup        236 2010-11-04 13:01
> /chukwa/hicc/views/public/newview.tpl
> -rw-r--r--   2 root supergroup         46 2010-11-04 13:01
> /chukwa/hicc/views/public/view.permission
> -rw-r--r--   2 root supergroup        103 2010-11-04 13:01
> /chukwa/hicc/views/public/workspace_view_list.cache
> drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
> /chukwa/hicc/views/users
> 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(JSONObject.java:283)
>        at org.json.JSONObject.getString(JSONObject.java:409)
>        at org.apache.hadoop.chukwa.rest.bean.ViewBean.<init>(ViewBean.java:62)
>        at org.apache.hadoop.chukwa.datastore.ViewStore.list(ViewStore.java:217)
>        at org.apache.hadoop.chukwa.rest.resource.ViewResource.getUserViewList(ViewResource.java:159)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
>        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:166)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:74)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:66)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:658)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
>        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
> /pathList
>        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> After further analysis, we found the problem is caused by at lines in
> ViewStore.list()
>    String[] pathList = new String[2];
>    pathList[0]=viewPath.toString();
>    pathList[1]=publicViewPath;
>    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 = fs.open(fstatus[i].getPath());
>            byte[] buffer = new byte[(int)size];
>            viewStream.readFully(buffer);
>            viewStream.close();
>            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()) {
>                json.put("editable","true");
>              } else {
>                json.put("editable","false");
>              }
>              list.put(json);
>            } catch (Exception e) {
>              log.error(ExceptionUtil.getStackTrace(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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CHUKWA-543) JSONException in hicc.log file

Posted by "Eric Yang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CHUKWA-543?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Yang updated CHUKWA-543:
-----------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

I just committed this, thanks Ahmed.

> JSONException in hicc.log file
> ------------------------------
>
>                 Key: CHUKWA-543
>                 URL: https://issues.apache.org/jira/browse/CHUKWA-543
>             Project: Chukwa
>          Issue Type: Bug
>          Components: User Interface
>    Affects Versions: 0.4.0
>            Reporter: Eric Yang
>            Assignee: Eric Yang
>             Fix For: 0.5.0
>
>         Attachments: ViewStore.java
>
>
> Quote from mailing list:
> 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
> /chukwa/hicc/views/public
> -rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
> /chukwa/hicc/views/public/default.view
> -rw-r--r--   2 root supergroup        236 2010-11-04 13:01
> /chukwa/hicc/views/public/newview.tpl
> -rw-r--r--   2 root supergroup         46 2010-11-04 13:01
> /chukwa/hicc/views/public/view.permission
> -rw-r--r--   2 root supergroup        103 2010-11-04 13:01
> /chukwa/hicc/views/public/workspace_view_list.cache
> drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
> /chukwa/hicc/views/users
> 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(JSONObject.java:283)
>        at org.json.JSONObject.getString(JSONObject.java:409)
>        at org.apache.hadoop.chukwa.rest.bean.ViewBean.<init>(ViewBean.java:62)
>        at org.apache.hadoop.chukwa.datastore.ViewStore.list(ViewStore.java:217)
>        at org.apache.hadoop.chukwa.rest.resource.ViewResource.getUserViewList(ViewResource.java:159)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
>        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:166)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:74)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:66)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:658)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
>        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
> /pathList
>        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> After further analysis, we found the problem is caused by at lines in
> ViewStore.list()
>    String[] pathList = new String[2];
>    pathList[0]=viewPath.toString();
>    pathList[1]=publicViewPath;
>    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 = fs.open(fstatus[i].getPath());
>            byte[] buffer = new byte[(int)size];
>            viewStream.readFully(buffer);
>            viewStream.close();
>            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()) {
>                json.put("editable","true");
>              } else {
>                json.put("editable","false");
>              }
>              list.put(json);
>            } catch (Exception e) {
>              log.error(ExceptionUtil.getStackTrace(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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CHUKWA-543) JSONException in hicc.log file

Posted by "Ahmed Fathalla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CHUKWA-543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934160#action_12934160 ] 

Ahmed Fathalla commented on CHUKWA-543:
---------------------------------------

Any progress on this issue, I have this exact same problem preventing me from getting any data displayed in HICC (I am using Chukwa 0.5 with HBase). If anyone can provide some guidance on the issue I can tackle it.

> JSONException in hicc.log file
> ------------------------------
>
>                 Key: CHUKWA-543
>                 URL: https://issues.apache.org/jira/browse/CHUKWA-543
>             Project: Chukwa
>          Issue Type: Bug
>          Components: User Interface
>    Affects Versions: 0.4.0
>            Reporter: Eric Yang
>            Assignee: Eric Yang
>
> Quote from mailing list:
> 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
> /chukwa/hicc/views/public
> -rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
> /chukwa/hicc/views/public/default.view
> -rw-r--r--   2 root supergroup        236 2010-11-04 13:01
> /chukwa/hicc/views/public/newview.tpl
> -rw-r--r--   2 root supergroup         46 2010-11-04 13:01
> /chukwa/hicc/views/public/view.permission
> -rw-r--r--   2 root supergroup        103 2010-11-04 13:01
> /chukwa/hicc/views/public/workspace_view_list.cache
> drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
> /chukwa/hicc/views/users
> 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(JSONObject.java:283)
>        at org.json.JSONObject.getString(JSONObject.java:409)
>        at org.apache.hadoop.chukwa.rest.bean.ViewBean.<init>(ViewBean.java:62)
>        at org.apache.hadoop.chukwa.datastore.ViewStore.list(ViewStore.java:217)
>        at org.apache.hadoop.chukwa.rest.resource.ViewResource.getUserViewList(ViewResource.java:159)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
>        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:166)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:74)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:66)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:658)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
>        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
> /pathList
>        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> After further analysis, we found the problem is caused by at lines in
> ViewStore.list()
>    String[] pathList = new String[2];
>    pathList[0]=viewPath.toString();
>    pathList[1]=publicViewPath;
>    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 = fs.open(fstatus[i].getPath());
>            byte[] buffer = new byte[(int)size];
>            viewStream.readFully(buffer);
>            viewStream.close();
>            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()) {
>                json.put("editable","true");
>              } else {
>                json.put("editable","false");
>              }
>              list.put(json);
>            } catch (Exception e) {
>              log.error(ExceptionUtil.getStackTrace(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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CHUKWA-543) JSONException in hicc.log file

Posted by "Ahmed Fathalla (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CHUKWA-543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934201#action_12934201 ] 

Ahmed Fathalla commented on CHUKWA-543:
---------------------------------------

I tried this patch and this exception is no longer being displayed.

> JSONException in hicc.log file
> ------------------------------
>
>                 Key: CHUKWA-543
>                 URL: https://issues.apache.org/jira/browse/CHUKWA-543
>             Project: Chukwa
>          Issue Type: Bug
>          Components: User Interface
>    Affects Versions: 0.4.0
>            Reporter: Eric Yang
>            Assignee: Eric Yang
>             Fix For: 0.5.0
>
>         Attachments: ViewStore.java
>
>
> Quote from mailing list:
> 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
> /chukwa/hicc/views/public
> -rw-r--r--   2 root supergroup      22177 2010-11-04 13:01
> /chukwa/hicc/views/public/default.view
> -rw-r--r--   2 root supergroup        236 2010-11-04 13:01
> /chukwa/hicc/views/public/newview.tpl
> -rw-r--r--   2 root supergroup         46 2010-11-04 13:01
> /chukwa/hicc/views/public/view.permission
> -rw-r--r--   2 root supergroup        103 2010-11-04 13:01
> /chukwa/hicc/views/public/workspace_view_list.cache
> drwxr-xr-x   - root supergroup          0 2010-11-04 13:01
> /chukwa/hicc/views/users
> 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(JSONObject.java:283)
>        at org.json.JSONObject.getString(JSONObject.java:409)
>        at org.apache.hadoop.chukwa.rest.bean.ViewBean.<init>(ViewBean.java:62)
>        at org.apache.hadoop.chukwa.datastore.ViewStore.list(ViewStore.java:217)
>        at org.apache.hadoop.chukwa.rest.resource.ViewResource.getUserViewList(ViewResource.java:159)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:156)
>        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:166)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:74)
>        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:114)
>        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:66)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:658)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:616)
>        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:607)
>        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
> /pathList
>        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
> After further analysis, we found the problem is caused by at lines in
> ViewStore.list()
>    String[] pathList = new String[2];
>    pathList[0]=viewPath.toString();
>    pathList[1]=publicViewPath;
>    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 = fs.open(fstatus[i].getPath());
>            byte[] buffer = new byte[(int)size];
>            viewStream.readFully(buffer);
>            viewStream.close();
>            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()) {
>                json.put("editable","true");
>              } else {
>                json.put("editable","false");
>              }
>              list.put(json);
>            } catch (Exception e) {
>              log.error(ExceptionUtil.getStackTrace(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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.