Skip to content

Commit caed6ed

Browse files
committed
SVYX-905 unable to resolve class
net.sf.jasperreports.compilers.GroovyEvaluator
1 parent 7adf558 commit caed6ed

2 files changed

Lines changed: 29 additions & 11 deletions

File tree

src/com/servoy/plugins/jasperreports/JasperReportsPlugin.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,15 @@ public IJasperReportsService connectJasperService() {
8585
Debug.trace("JasperTrace: service connection initialize");
8686
// create if not yet created
8787
if (jasperReportService == null) {
88-
ClassLoader savedCl = Thread.currentThread().getContextClassLoader();
89-
try
90-
{
91-
Thread.currentThread().setContextClassLoader(getIClientPluginAccess().getPluginManager().getClassLoader());
88+
try {
9289
jasperReportService = (IJasperReportsService) application.getServerService("servoy.IJasperReportService");
9390
if (jasperReportsDirectory == null) jasperReportsDirectory = jasperReportService.getReportDirectory();
9491
if (jasperExtraDirectories == null) jasperExtraDirectories = jasperReportService.getExtraDirectories();
95-
}
96-
catch (Exception ex)
97-
{
92+
} catch (Exception ex) {
9893
Debug.error(ex);
9994
throw new RuntimeException(
10095
"JasperTrace: Jasper Exception: Cannot connect to service-server");
10196
}
102-
finally
103-
{
104-
Thread.currentThread().setContextClassLoader(savedCl);
105-
}
10697
}
10798

10899
// in case the server is not started in developer

src/com/servoy/plugins/jasperreports/JasperReportsServer.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,33 @@ private String getAbsolutePath(String path, String relativeDir)
256256
}
257257

258258
public boolean jasperCompile(String clientID, String report, String destination, String repdir) throws Exception {
259+
boolean compiled = false;
260+
261+
ClassLoader savedCl = Thread.currentThread().getContextClassLoader();
262+
try
263+
{
264+
Thread.currentThread().setContextClassLoader(application.getPluginManager().getClassLoader());
265+
compiled = _jasperCompile(clientID, report, destination, repdir);
266+
}
267+
catch (Error err)
268+
{
269+
Debug.error(err);
270+
throw new Exception(err.getMessage());
271+
}
272+
catch (Exception ex)
273+
{
274+
Debug.error(ex);
275+
throw new Exception(ex.getMessage());
276+
}
277+
finally
278+
{
279+
Thread.currentThread().setContextClassLoader(savedCl);
280+
}
281+
282+
return compiled;
283+
}
284+
285+
private boolean _jasperCompile(String clientID, String report, String destination, String repdir) throws Exception {
259286

260287
repdir = getCheckedRelativeReportsPath(repdir);
261288

0 commit comments

Comments
 (0)