This discussion is archived
4 Replies Latest reply: Mar 29, 2011 12:06 AM by 839840 RSS

java.lang.reflect.InvocationTargetException  Error

843810 Newbie
Currently Being Moderated
When I am creating an object of
net.sf.jasperreports.engine.design.JRDesignDataset in this way
net.sf.jasperreports.engine.design.JRDesignDataset lobj = new net.sf.jasperreports.engine.design.JRDesignDataset();

It s giving java.lang.reflect.InvocationTargetException Error.

What should be the problem. I am just creating object of that classes. stil m not calling any method throug that object.

Please help me out
  • 1. Re: java.lang.reflect.InvocationTargetException  Error
    EJP Guru
    Currently Being Moderated
    That exception contains a nested exception. What is it?
  • 2. Re: java.lang.reflect.InvocationTargetException  Error
    843810 Newbie
    Currently Being Moderated
    Yes , NoClassDefFound



    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.tcs.sgv.core.service.ServiceImpl.executeService(ServiceImpl.java:49)
         at com.tcs.sgv.core.service.ServiceLocator.executeService(ServiceLocator.java:94)
         at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
         at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
         at org.springframework.security.ui.x509.X509ProcessingFilter.doFilter(X509ProcessingFilter.java:137)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
         at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
         at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
         at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
         )
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/design/JRDesignDataset
         at com.tcs.sgv.jasper.service.CommonReportService.generateReportJasper(CommonReportService.java:27)
         at com.tcs.sgv.dss.report.DSSReportImpl.generateReportData(DSSReportImpl.java:856)
         at com.tcs.sgv.dss.report.DSSReportImpl.findReportData(DSSReportImpl.java:510)
         at com.tcs.sgv.common.business.reports.ReportsBO.getReportData(ReportsBO.java:296)
         at com.tcs.sgv.common.delegate.reports.ReportsManagerDelegate.getReportData(ReportsManagerDelegate.java:186)
         at com.tcs.sgv.common.requesthandler.reports.ReportRequestHandler.getReportData(ReportRequestHandler.java:2187)
         at com.tcs.sgv.common.requesthandler.reports.ReportRequestHandler.processRequest(ReportRequestHandler.java:651)
         at com.tcs.sgv.reports.service.ReportServiceImpl.serviceReportRequest(ReportServiceImpl.java:98)
         ... 72 more
    Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.design.JRDesignDataset
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)





    But , in eclipse IDE , I am able to import this class , with this line

    import net.sf.jasperreports.engine.design.JRDesignDataset;


    So , it does mean that , class is there in Jar file , but still it s giving that clas not found , how s it possible ?
  • 3. Re: java.lang.reflect.InvocationTargetException  Error
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    But , in eclipse IDE , I am able to import this class , with this line

    import net.sf.jasperreports.engine.design.JRDesignDataset;
    Which doesn't mean much.

    >
    So , it does mean that , class is there in Jar file , but still it s giving that clas not found , how s it possible ?
    Because compiling is not the same as running. Both have a class path. Both must have the same items in it. Your compilation has it and your run environment doesn't.
  • 4. Re: java.lang.reflect.InvocationTargetException  Error
    839840 Newbie
    Currently Being Moderated
    Download and add this jar file in your classpath. Try this .I had this Error But after adding that jar ,It works



    http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/S-3.7M5-201101272034/swt-3.7M5-win32-win32-x86.zip