hey! i get this error when i run the code (with slight changes in query)!
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 9 in the generated java file Only a type can be imported. org.jfree.chart.ChartUtilities resolves to a package
An error occurred at line: 10 in the generated java file Only a type can be imported. org.jfree.chart.JFreeChart resolves to a package
An error occurred at line: 11 in the generated java file Only a type can be imported. org.jfree.chart.plot.PlotOrientation resolves to a package
An error occurred at line: 13 in the generated java file Only a type can be imported. org.jfree.data.jdbc.JDBCCategoryDataset resolves to a package
An error occurred at line: 11 in the jsp file: /BarChart.jsp JDBCCategoryDataset cannot be resolved to a type 8: <%@ page import="org.jfree.data.jdbc.JDBCCategoryDataset"%> 9: <% 10: String query="SELECT db2admin.NOMINALROLL.NARRESTS,db2admin.NOMINALROLL.FNAME FROM db2admin.NOMINALROLL"; 11: JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:db2://localhost:50000/FPARK","com.ibm.db2.jcc.DB2Driver","db2admin","admin"); 12: dataset.executeQuery(query); 13: JFreeChart chart = ChartFactory.createBarChart3D("Test", "name", "no of arrests", dataset, PlotOrientation.VERTICAL,true, true, false); 14: try
An error occurred at line: 11 in the jsp file: /BarChart.jsp JDBCCategoryDataset cannot be resolved to a type 8: <%@ page import="org.jfree.data.jdbc.JDBCCategoryDataset"%> 9: <% 10: String query="SELECT db2admin.NOMINALROLL.NARRESTS,db2admin.NOMINALROLL.FNAME FROM db2admin.NOMINALROLL"; 11: JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:db2://localhost:50000/FPARK","com.ibm.db2.jcc.DB2Driver","db2admin","admin"); 12: dataset.executeQuery(query); 13: JFreeChart chart = ChartFactory.createBarChart3D("Test", "name", "no of arrests", dataset, PlotOrientation.VERTICAL,true, true, false); 14: try
An error occurred at line: 13 in the jsp file: /BarChart.jsp JFreeChart cannot be resolved to a type 10: String query="SELECT db2admin.NOMINALROLL.NARRESTS,db2admin.NOMINALROLL.FNAME FROM db2admin.NOMINALROLL"; 11: JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:db2://localhost:50000/FPARK","com.ibm.db2.jcc.DB2Driver","db2admin","admin"); 12: dataset.executeQuery(query); 13: JFreeChart chart = ChartFactory.createBarChart3D("Test", "name", "no of arrests", dataset, PlotOrientation.VERTICAL,true, true, false); 14: try 15: { 16: org.jfree.chart.ChartUtilities.saveChartAsJPEG(new File("C:/chart.jpg"), chart, 400, 300);
An error occurred at line: 13 in the jsp file: /BarChart.jsp ChartFactory cannot be resolved 10: String query="SELECT db2admin.NOMINALROLL.NARRESTS,db2admin.NOMINALROLL.FNAME FROM db2admin.NOMINALROLL"; 11: JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:db2://localhost:50000/FPARK","com.ibm.db2.jcc.DB2Driver","db2admin","admin"); 12: dataset.executeQuery(query); 13: JFreeChart chart = ChartFactory.createBarChart3D("Test", "name", "no of arrests", dataset, PlotOrientation.VERTICAL,true, true, false); 14: try 15: { 16: org.jfree.chart.ChartUtilities.saveChartAsJPEG(new File("C:/chart.jpg"), chart, 400, 300);
An error occurred at line: 13 in the jsp file: /BarChart.jsp PlotOrientation.VERTICAL cannot be resolved to a type 10: String query="SELECT db2admin.NOMINALROLL.NARRESTS,db2admin.NOMINALROLL.FNAME FROM db2admin.NOMINALROLL"; 11: JDBCCategoryDataset dataset=new JDBCCategoryDataset("jdbc:db2://localhost:50000/FPARK","com.ibm.db2.jcc.DB2Driver","db2admin","admin"); 12: dataset.executeQuery(query); 13: JFreeChart chart = ChartFactory.createBarChart3D("Test", "name", "no of arrests", dataset, PlotOrientation.VERTICAL,true, true, false); 14: try 15: { 16: org.jfree.chart.ChartUtilities.saveChartAsJPEG(new File("C:/chart.jpg"), chart, 400, 300);
An error occurred at line: 16 in the jsp file: /BarChart.jsp org.jfree.chart.ChartUtilities cannot be resolved to a type 13: JFreeChart chart = ChartFactory.createBarChart3D("Test", "name", "no of arrests", dataset, PlotOrientation.VERTICAL,true, true, false); 14: try 15: { 16: org.jfree.chart.ChartUtilities.saveChartAsJPEG(new File("C:/chart.jpg"), chart, 400, 300); 17: } 18: catch (IOException e) 19: {
Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439) org.apache.jasper.compiler.Compiler.compile(Compiler.java:349) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.32 logs.
Before importing jfreechart package, you need to download the jfreechart api and put the jsr file inside the lib folder of apache tomcat. Then restart the tomcat server.
Ads