Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting java.lang.NoSuchMethodError exception when using GWT + JasperReports
    text
    copied!<p>I have integrated <code>JasperReports</code> on my <code>NetBeans</code> platform and I am able to generate reports using the following code:</p> <pre class="lang-java prettyprint-override"><code>Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); 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); </code></pre> <p>This stuff works perfect.</p> <p>But not I'm trying to integrate <code>JasperReports</code> with <code>GWT</code>. I have my server as <code>GlassFish</code> server.</p> <p>I am getting the Connection object using the followind code:</p> <pre class="lang-java prettyprint-override"><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; } </code></pre> <p>and then </p> <pre class="lang-java prettyprint-override"><code>Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, getConnection()); JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest); JasperViewer.viewReport(jasperPrint); </code></pre> <p>but i always get an Error. Here is a stacktrace:</p> <pre><code>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‌​); </code></pre> <p>I am implementing this on Server. I am having RPC calls to get this method to work when a button is clicked.</p> <p>Can you please help me how to work on this. (That is to integrate <code>JasperReports</code> with <code>GWT</code>).</p> <p>I would highly appreciate any explanation with some code as i am just a beginner.</p> <p>Thanks </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload