Applet Loading Error - Jasper Report

Posted by Mihir on Stack Overflow See other posts from Stack Overflow or by Mihir
Published on 2012-12-05T17:01:17Z Indexed on 2012/12/05 17:03 UTC
Read the original article Hit count: 622

Filed under:
|
|

I encountered very silly error , but any way i can not figure out solution.i am loading java applet which encompass a simple jasper viewer in it. when the applet is loaded it throws following exception.

SEVERE: Servlet.service() for servlet JasperReportServlet threw exception
java.lang.ClassNotFoundException: org.apache.commons.collections.ReferenceMap
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.<init>(DefaultExtensionsRegistry.java:96)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at net.sf.jasperreports.engine.util.ClassUtils.instantiateClass(ClassUtils.java:59)
    at net.sf.jasperreports.extensions.ExtensionsEnvironment.createDefaultRegistry(ExtensionsEnvironment.java:80)
    at net.sf.jasperreports.extensions.ExtensionsEnvironment.<clinit>(ExtensionsEnvironment.java:68)
    at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:76)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:182)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:87)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:57)
    at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:78)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
    at com.dbhl.app.report.generator.JobUpdateGenerator.getJasperPrintObject(JobUpdateGenerator.java:279)
    at com.dbhl.app.report.JasperReportServlet.processJobUpdate(JasperReportServlet.java:153)
    at com.dbhl.app.report.JasperReportServlet.getJasperPrintObjectByLedgerType(JasperReportServlet.java:79)
    at com.dbhl.app.report.JasperReportServlet.service(JasperReportServlet.java:50)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)

below is my applet configuration, i am loading applet using standard java deployment toolkit.

<script type="text/javascript"
            src="<%=basePath%>js/deployJava.js">
</script>



        <script>

var user = '<%=request.getParameter("user")%>';


var attributes = {
    code : 'applet.EmbeddedViewerApplet.class',
    archive : '<%=basePath%>resources/appletviewer.jar,<%=basePath%>resources/jasperreports-applet-4.0.0.jar,<%=basePath%>resources/jasperreports-4.0.0.jar,<%=basePath%>resources/commons-collections-3.2.1.jar,<%=basePath%>resources/commons-logging-1.0.4.jar,<%=basePath%>resources/commons-beanutils-1.8.0.jar,<%=basePath%>resources/commons-digester-1.7.jar,<%=basePath%>resources/commons-javaflow-20060411.jar,<%=basePath%>resources/org-netbeans-core.jar',
    width : "100%",
    height : 600
};
var parameters = {
    fontSize : 16,
    REPORT_URL : '<%=basePath%>servlet/JasperReportServlet?startDate=<%=request.getParameter("startDate")%>&endDate=<%=request.getParameter("endDate")%>&user=' + user + '&reportType=<%=request.getParameter("reportType")%>'
};
var version = '1.4';
deployJava.runApplet(attributes, parameters, version);
</script>

every jar i referred in the applet attributes exist the resource folder of my webroot, which are

  • appletviewer.jar commons-beanutils-1.8.0.jar commons-collections-3.2.1.jar commons-digester-1.7.jar commons-javaflow-20060411.jar commons-logging-1.0.4.jar jasperreports-4.0.0.jar jasperreports-applet-4.0.0.jar org-netbeans-core.jar

all the jars are signed today, so no validity expires. i have double check all the things. but it always shows the above error. in iReport i can view the report and it is compiled to jasper object with no error.

the java console from control panel

http://pastebin.com/Xt6303tT

My question is why the classNotFound Exception happens ? i check in the temp cache that the collections file is downloaded succesfully and in the above console log it shows that the jars are successfully downloaded to the host computer.

Thank You Mihir Parekh

© Stack Overflow or respective owner

Related posts about java

Related posts about applet