Getting java.lang.NoSuchMethodError exception when using GWT + JasperReports

I integrated JasperReportson my platform NetBeansand I can generate reports using the following code:

Map<String, Object> params = new HashMap<String, Object>();
Connection conn = DriverManager.getConnection("databaseUrl", "userid", "password");
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, conn);
JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest);
JasperViewer.viewReport(jasperPrint);

This stuff works great.

But I'm not trying to integrate JasperReportswith GWT. I have a server as a server GlassFish.

I get a Connection object using the following code:

public static Connection getConnection() {
    try {
        String JNDI = "JNDI name";
        InitialContext initCtx = new InitialContext();
        javax.sql.DataSource ds = (javax.sql.DataSource) initCtx.lookup(JNDI);
        Connection conn = (Connection) ds.getConnection();
        return conn;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return null;
}

and then

Map<String, Object> params = new HashMap<String, Object>();
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, getConnection());
JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest);
JasperViewer.viewReport(jasperPrint);

but I always get an error message. Here is the stack:

com.google.gwt.user.server.rpc.UnexpectedException: 
Service method 'public abstract java.lang.Boolean com.client.service.GenerateReport()'
threw an unexpected exception: java.lang.NoSuchMethodError: 
net.sf.jasperreports.engine.fonts.SimpleFontFamily.setExportFonts(Ljava/util/Map‌​);

I implement this on the server. I have RPC calls to make this method work when a button is clicked.

Could you help me with this. (That is, for integration JasperReportswith GWT).

I would really appreciate any explanation with some code, as I'm just a beginner.

thank

+3
1

, Google App Engine eclipse. GAE .

GAE, .

-1

Source: https://habr.com/ru/post/1744545/


All Articles