Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Javascript Error when run jtable.xaction

  1. #1
    Join Date
    Jun 2008
    Posts
    7

    Default Javascript Error when run jtable.xaction

    Hello,

    I am trying to debug an intermittent issue that I am experiencing with a dashboard I have created. I am using Pentaho 1.7 community edition with CDF 3.0. It is running in Tomcat 5.5, MySQL 5.0 and Java 1.5 on Debian.

    I have built a dashboard with a number of tablecomponents. Occasionally the jtable.xaction will fail with the following error message in pentaho.log

    2009-04-09 15:48:05,340 ERROR [org.pentaho.plugin.javascript.JavascriptRule] 57c1f5c5-253f-11de-8579-c74e431f33f1:COMPONENT:context-15886210-1239306485319:jtable.xactionJSRULE.ERROR_0003 - Javascript rule execution failed
    org.mozilla.javascript.EcmaError: TypeError: [JavaPackage org.json.JSONArray] is not a function, it is org.mozilla.javascript.NativeJavaPackage. (<cmd>#4)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3375)
    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3430)
    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3418)
    at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2129)
    at org.mozilla.javascript.gen.c648._c0(<cmd>:4)
    at org.mozilla.javascript.gen.c648.call(<cmd>)
    ...


    The jtable.xaction does not fail all the time, and will work without problem for a short time after a full reboot of tomcat.

    The Javascript code that it is failing on is
    // MDX to Relation result set, needed for the

    //var newResults = new Packages.org.json.JSONStringer();
    var values = new Packages.org.json.JSONArray();

    if (query_result != null)
    {

    var rsmd = query_result.getMetaData() ;
    var colHeaders = rsmd.getColumnHeaders() ;
    var rowHeaders = rsmd.getRowHeaders() ;
    var colCount = rsmd.getColumnCount() ;
    var rowCount = query_result.getRowCount() ;


    if(rowCount> 0)
    {
    //newResults.key("aaData");

    for (i=0; i<rowCount; i++)
    {

    var value = new Packages.org.json.JSONArray();

    for(j=0; j< colCount; j++)
    {
    var v = query_result.getValueAt(i,j)+"";
    value.put(v.replace(/Infinity/g,'0'));
    }

    values.put(value);
    }

    /*
    newResults.value(values);
    newResults.value(new Packages.org.json.JSONArray(headersArray.toString()));
    newResults.endObject();
    */
    }
    }

    var results = values.toString();

    results;
    The only thing that I have been able to track down is if I run a BiRT report from the BI-Server prior to running the dashboard this problem is more likely to occur.

    Any help or feedback would be greatly appreciated, and thank you in advance for any responses.

  2. #2
    Join Date
    Jul 2007
    Posts
    2,497

    Default

    Never saw a similar issue... you sure it's not something related to the data being returned?
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3
    Join Date
    Jun 2008
    Posts
    7

    Default

    I don't believe it is the data being returned because if I refresh the dashboard it will display the content most of the time.

    Would you have a suggestion on a way to debug if it is related to the data being returned?

  4. #4
    Join Date
    Jul 2007
    Posts
    2,497

    Default

    firebug, net tab, see the result
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  5. #5
    Join Date
    Jun 2008
    Posts
    7

    Default

    When I run firebug and look at the net tab and view the response from the failing object I get the following message.

    <html><head><title>Pentaho BI Platform - Error in Action</title><link rel="stylesheet" type="text/css"
    href="/pentaho-style/active/default.css"></head><body dir="LTR"><table cellspacing="10"><tr><td class
    ="portlet-section" colspan="3">Failed<hr size="1"/></td></tr><tr><td class="portlet-font" valign="top"
    ><span style="color:red">Error: JSRULE.ERROR_0003 - Javascript rule execution failed - org.mozilla.javascript
    .EcmaError: TypeError: [JavaPackage org.json.JSONArray] is not a function, it is org.mozilla.javascript
    .NativeJavaPackage. (<cmd>#4) (org.pentaho.plugin.javascript.JavascriptRule)</span><p/>Error: JSRULE
    .ERROR_0003 - Javascript rule execution failed - org.mozilla.javascript.EcmaError: TypeError: [JavaPackage
    org.json.JSONArray] is not a function, it is org.mozilla.javascript.NativeJavaPackage. (<cmd>#4) (org
    .pentaho.plugin.javascript.JavascriptRule)<br/>Error: RuntimeContext.ERROR_0012 - ActionDefinition for
    JavascriptRule did not execute successfully (org.pentaho.core.runtime.RuntimeContext)<br/>Error: SolutionEngine
    .ERROR_0007 - Action sequence execution failed (org.pentaho.core.solution.SolutionEngine)<br/></td><
    /tr></table><p>&nbsp;&nbsp;Server Version: Pentaho BI Platform 1.8.0.1023</body></html>

    The HTTP Status code returned is 200.

  6. #6
    Join Date
    Jun 2008
    Posts
    7

    Default

    Hello Pmalves,

    Since I haven't been able to track down the issue and since JSON is just a formatting like XML. I have tried to just build the text string in JSON format instead of calling the package. I have attached the code below please let me know if I am missing some critical piece of the puzzle. Thank you in advance


    Code:
    // MDX to Relation result set, needed for the 
            
    
    if (query_result != null)
        {
            var rsmd = query_result.getMetaData() ;
            var colHeaders = rsmd.getColumnHeaders() ;
            var rowHeaders = rsmd.getRowHeaders() ;
            var colCount = rsmd.getColumnCount() ;
            var rowCount = query_result.getRowCount() ;
    
            var values = "[";    
            
                    
            for (i=0; i<rowCount; i++)
            {
    
                var value = "[";
                
                for(j=0; j< colCount; j++)
                {
                    var v = '"'+query_result.getValueAt(i,j)+'"';
                      value = value + v.replace(/Infinity/g,'0');
                          
                      if ( j < colCount - 1 ) {
                          value = value + ",";
                      }
                }
                    
                value = value + "]";
                    
                if ( i > 0 ) {
                    values = values + ",";
                }                
                values = values + value;
            }
            values = values + "]";                    
    }
            
    var results = values;
            
    results;

  7. #7
    Join Date
    Jul 2007
    Posts
    2,497

    Default

    I don't understand the code you pasted
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.