I am using;

1. Tomcat 8
2. Jasper iReport 5.6 also tried Jasper Studio 6.1
3. Tomcat/lib/jasperreports-6.1.1
4. Tomcat/lib/mysql-connector-java-5.1.34-bin
5. Tomcat/lib/commons-beanutils-1.9.0.jar
6. Tomcat/lib/commons-collections-3.2.1.jar
7. Tomcat/lib/commons-digester-2.1.jar
8. Tomcat/lib/commons-logging-1.1.1.jar
9. Tomcat/lib/groovy-all-2.4.3.jar
10. itext-2.1.7.js3.jar

I have tried to display report in web server;

```
<%@ page  import="java.io.*"%> 
<%@ page  import="java.sql.Connection"%> 
<%@ page  import="java.sql.DriverManager"%>
<%@ page  import="java.util.HashMap"%>
<%@ page  import="java.util.Map"%>
<%@ page  import="net.sf.jasperreports.engine.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
    <h2>Hello World!</h2>
    <%
        Connection conn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "root", "root");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        File reportFile = new File(application.getRealPath("report.jasper"));
        Map parameters = new HashMap();
        byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, conn);

        response.setContentType("application/pdf");
        response.setContentLength(bytes.length);
        ServletOutputStream outStream = response.getOutputStream();
        outStream.write(bytes, 0, bytes.length);
        outStream.flush();
        outStream.close();
    %>
</body>
</html>

```

It gives me an attached error on page(jsp and report file in same folder)[![See the error screenshot](https://i.stack.imgur.com/dAys5.png)](https://i.stack.imgur.com/dAys5.png)

Any idea and suggestion highly appriciated.  

I have followed according to [this tutorial](http://www.javaknowledge.info/calling-jasper-report-from-java-web-application-using-jsp/)  

Thank you,  

Supun