谷歌图表查询语言抛出空指针异常

时间:2016-05-13 04:26:06

标签: google-visualization

这是我的代码,用于获取图形信息数据表。我无法找到这个问题的原因。

google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
    var sqlQuery = "sql?tq=select ProjectName, ExecutionDate, PassedWeekly, FailedWeekly &sqlQueryID=test_runs_week";
    var weeklyRunsQuery = new google.visualization.Query(sqlQuery);
    weeklyRunsQuery.send(handleWeeklyRunsResponse);
}
function handleWeeklyRunsResponse(queryWeeklyRunsResponse) {
    var responseDataTable = queryWeeklyRunsResponse.getDataTable();
    if (queryWeeklyRunsResponse.isError()) {
        alert(queryWeeklyRunsResponse.getDetailedMessage());
    }
    if (responseDataTable == null) {
        alert("Response is null");
        return;
    }
    if (responseDataTable.getNumberOfRows() < 0) {
        alert("Response has 0 rows");
    }
}
  1. 观察1:它给我以前访问过的图表页面的结果。
  2. 观察2:如果Tomcat服务器重新启动,它会给我一个&#34;错误消息作为内部错误&#34;
  3. 观察3:导航到其他图形页面并返回并执行此代码,它将为您提供之前访问过的页面。
  4. 这是WEBINF \ web.xml文件

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
    
        <description>
        </description>
    
        <servlet>
            <servlet-name>SqlDataSourceServlet</servlet-name>
            <description>SqlDataSourceServlet</description>
            <servlet-class>com.external.datasources.SqlDataSourceServlet</servlet-class>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>SqlDataSourceServlet</servlet-name>
            <url-pattern>/htm/sql</url-pattern>
        </servlet-mapping>
    
        <welcome-file-list>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>depreport.htm</welcome-file>
        </welcome-file-list>
    </web-app>
    

0 个答案:

没有答案