[#14156] - JasperServer PRO 8.0.0: Error loading scriptlet class / ClassNotFoundException

Category:
Bug report
Priority:
Normal
Status:
New
Project: Severity:
Block
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I tested the newest available JasperReports Server PRO 8.0.0 version with a really simple Report with a Scriptlet. The Report works flawlessly in JasperStudio 6.18.1 and on Community version jasperreports-server-cp-7.8.0. On the PRO server the report execution fails with the following error (shortened):

ERROR SecureExceptionHandlerImpl,http-nio-8081-exec-7:125 - Auf dem Server ist ein Fehler aufgetreten. Versuchen Sie es erneut, oder wenden Sie sich an die Siteadministratoren. (Fehler-UID: 2b582daf-0109-4aee-9b04-b309e3e82285). Error loading scriptlet class: de.teampb.scriptlets.TestScriptlet. com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Error loading scriptlet class: de.teampb.scriptlets.TestScriptlet.
at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriptlet(DefaultScriptletFactory.java:114)
at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriplets(DefaultScriptletFactory.java:89)
at net.sf.jasperreports.engine.fill.JRFillDataset.createScriptlets(JRFillDataset.java:538)
...
Caused by: java.lang.ClassNotFoundException: de.teampb.scriptlets.TestScriptlet
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:208)
at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:148)
at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriptlet(DefaultScriptletFactory.java:109)
... 230 more

Steps to reproduce:
- Create a simple java class extending JRDefaultScriptlet
- Create a simple report
- Assign Scriptlet in Report
- Export Scriptlet class as JAR file
- Publish Report to JasperReports Server
- Upload JAR file as additional ressource to report unit on the JasperServer
- Start report execution on server

JasperServer 8.0.0 PRO Version: failure
JasperServer 7.8.0 Community Version: works as expected

AttachmentSize
File testscriptlet.java331 bytes
Binary Data jartestreport.jrxml1.49 KB
File scriptlettest.jar1.24 KB
v8.0.0
JasperReports Server
oh's picture
oh
8
Joined: Sep 6 2016 - 2:52am
Last seen: 8 hours 5 min ago

3 Comments:

#1

The workaround for JasperServer Pro is to edit WEB-INF/applicationContext-adhoc.xml and add the following property somewhere inside the adhocEngineService bean:

<property name="reportUnitClassLoadingEnabled" value="true"/>

Regards,
Lucian

#2

Thanks! The "workaround" works. :-)

So is the default behavior of not-working scriptlets a bug or a feature? And if it was a feature, is there any documentation (like JasperServer Pro Installation Guide) about that?

#3

It's a bug.

Feedback
randomness