developers

    Forum Stats

  • 3,873,852 Users
  • 2,266,621 Discussions
  • 7,911,645 Comments

Discussions

iReport 4.6.0 on Ubuntu server problem

Hi experts,
I am new at iReport develop., and I wrote a sample jsp for iReport in Windows+tomcat+iReport environment, the report shows fine.
But when I put the same report at Ubuntu linux server with tomcat+iReport , I get error all the time, any one knows why? pleas advise.
jsp=>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF8">
<title> JasperReports Web SAMPLE</title>
</head>
<body>
<%@ page language="java" session="false" %>
<%@ page import="net.sf.jasperreports.engine.*" %>
<%@ page import="net.sf.jasperreports.engine.export.*" %>
<%@ page import="com.JasperReportsWrapper" %>
<%
try
{
String path2JRXMLFile =
getServletContext().getRealPath(
"MonthlyCustomerInvoices.jrxml");
// Connect to DB and compile JRXML file
JasperReportsWrapper wrapper = new JasperReportsWrapper();
wrapper.connect2DB(wrapper.dbServerAdd, wrapper.dbServerPort,
wrapper.dbName, wrapper.dbUser, wrapper.dbPass);
// Compile JRXML file
JasperReport jasperReport =
wrapper.compileJRXMLFile(path2JRXMLFile);
JasperPrint jasperPrint =
wrapper.fillReport(jasperReport,
null, wrapper.getConnection());
// Set response content type
response.setContentType("application/pdf");
// Create and export PDF to browser window
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(
JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(
JRExporterParameter.OUTPUT_STREAM,
response.getOutputStream());
exporter.exportReport();
}
catch (Exception e)
{
e.printStackTrace();
}
%>
</body>
</html>

/**************** get error message *********************/
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: 1 in the generated java file
The type net.sf.jasperreports.engine.JasperReport cannot be resolved. It is indirectly referenced from required .class files

An error occurred at line: 1 in the generated java file
The type net.sf.jasperreports.engine.JasperPrint cannot be resolved. It is indirectly referenced from required .class files

An error occurred at line: 21 in the jsp file: /CustomerInvoicesReport.jsp
JasperReport cannot be resolved to a type
18: JasperReportsWrapper wrapper = new JasperReportsWrapper();
19: wrapper.connect2DB(wrapper.dbServerAdd, wrapper.dbServerPort,
20: wrapper.dbName, wrapper.dbUser, wrapper.dbPass);
21: JasperReport jasperReport =
22: wrapper.compileJRXMLFile(path2JRXMLFile);
23: JasperPrint jasperPrint =
24: wrapper.fillReport(jasperReport,

Answers

  • 941313
    941313 Member Posts: 2
    I fond that it just need to put the required jar files into physical WEB-INF/lib directory.
    You can not use symbolic link instead.
    after I do this:

    rm myAps/WEB-INF/lib # remove my symbolic link
    mkdir myAps/WEB-INF/lib
    cp ../myJarLib/*.jar myAps/WEB-INF/lib/

    restart tomcat

    It works fine now.

    Thanks
This discussion has been closed.
developers