{"id":2763,"date":"2022-08-30T15:27:34","date_gmt":"2022-08-30T15:27:34","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/08\/java-lang-noclassdeffounderror-with-ejb-and-jasperreports-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:27:34","modified_gmt":"2022-08-30T15:27:34","slug":"java-lang-noclassdeffounderror-with-ejb-and-jasperreports-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/java-lang-noclassdeffounderror-with-ejb-and-jasperreports-collection-of-common-programming-errors\/","title":{"rendered":"java.lang.NoClassDefFoundError: with EJB and JasperReports-Collection of common programming errors"},"content":{"rendered":"<p>I need to generate a report using <em>iReport 5.0<\/em> for my EJB application.<\/p>\n<p>When I&#8217;m calling report from my front end it works fine but when I&#8217;m trying to call same report in my EJB module it gives me a no class def found error.<\/p>\n<p>This is how I call my report:<\/p>\n<pre><code>Map parameters = new HashMap();\n\nparameters.put(\"Emp_ID\", empNo);\nparameters.put(\"From\", startDate);\nparameters.put(\"To\", endDate);\n\nConnection conn = DB_Conn.getDataBasConnection();\nJasperDesign jDesign = JRXmlLoader.load(\"C:\\\\SalesRep_Sales_Sub01.jrxml\");\n\nJasperReport jasperReport = JasperCompileManager.compileReport(jDesign);\nJasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,conn);\nJasperViewer.viewReport(jasperPrint,false);\n<\/code><\/pre>\n<p>And these are the libraries I use:<\/p>\n<ul>\n<li>jasperreports-4.5.0<\/li>\n<li>commons-beanutils-1.8.2<\/li>\n<li>commons-collections-3.2.1<\/li>\n<li>commons-digester-1.7<\/li>\n<li>commons-javaflow-20060411<\/li>\n<li>commons-logging-1.1<\/li>\n<li>groovy-all-1.7.5<\/li>\n<li>jcommon-1.0.15<\/li>\n<li>jfreechart-1.0.12<\/li>\n<\/ul>\n<p>Can someone please tell me what is the method to call my report from EJB and is there any additional libraries i should use.<\/p>\n<p>Error report generate in output:<\/p>\n<pre><code>Exception in thread \"AWT-EventQueue-0\" javax.ejb.EJBException\n    at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5215)\n    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5113)\n    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4901)\n    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2045)\n    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1994)\n    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:213)\n    at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:79)\n    at $Proxy175.getEmployeeSales(Unknown Source)\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n    at java.lang.reflect.Method.invoke(Method.java:601)\n    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:144)\n    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:174)\n    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:528)\n    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:199)\n    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1624)\n    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1486)\n    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:990)\n    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:214)\n    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:742)\n    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:539)\n    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2324)\n    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:497)\n    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:540)\nCaused by: java.lang.NoClassDefFoundError: org\/apache\/commons\/digester\/Digester\n    at BeansPerf.EmployeePerformance.getEmployeeSales(EmployeePerformance.java:75)\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n    at java.lang.reflect.Method.invoke(Method.java:601)\n    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)\n    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)\n    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)\n    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)\n    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)\n    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)\n    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)\n    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)\n    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\n    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n    at java.lang.reflect.Method.invoke(Method.java:601)\n    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)\n    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)\n    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)\n    at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)\n    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)\n    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:206)\n    ... 19 more\nCaused by: java.lang.ClassNotFoundException: org.apache.commons.digester.Digester\n    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)\n    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)\n    at java.security.AccessController.doPrivileged(Native Method)\n    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)\n    at com.sun.enterprise.v3.server.AppLibClassLoaderServiceImpl$URLClassFinder.findClass(AppLibClassLoaderServiceImpl.java:158)\n    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)\n    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)\n    ... 42 more\n<\/code><\/pre>\n<p>Simply I cannot call any method from imported jasperReport libraries.<\/p>\n<p id=\"rop\"><small>Originally posted 2014-02-08 16:01:58. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I need to generate a report using iReport 5.0 for my EJB application. When I&#8217;m calling report from my front end it works fine but when I&#8217;m trying to call same report in my EJB module it gives me a no class def found error. This is how I call my report: Map parameters = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2763","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2763"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2763\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}