Get ClassCastException when generating report with Struts2

0

 

I put *.jasper* file in my web content folder of my project and in my action class there is only execute method and my *struts.xml* has following code:
 
<!-- language: lang-xml -->
 
    <action name="myJasperTest" class="com.acme.test.action.JasperAction">
    <result name="success" type="jasper">
    <param name="location">/our_jasper_template.jasper</param>
    <param name="dataSource">myList</param>
    <param name="reportParameters">reportParams</param>
    <param name="format">PDF</param>
    </result>
    <result name="error">/Error.jsp</result>
    </action>
 
 
And while running this program it gives me error: 
 
    java.lang.ClassCastException: cannot assign instance of
    net.sf.jasperreports.engine.base.JRBaseStyle to field
    net.sf.jasperreports.engine.base.JRBaseParagraph.paragraphContainer of type
    net.sf.jasperreports.engine.JRParagraphContainer in instance of
    net.sf.jasperreports.engine.base.JRBaseParagraph
 
Can anybody help me how to resolve this problem?
Akshay Jadhav's picture
Joined: Oct 9 2012 - 7:01am
Last seen: 2 years 2 months ago

1 Answer:

0

This error occur due to improper jars in projects lib folder.

Akshay Jadhav's picture
Joined: Oct 9 2012 - 7:01am
Last seen: 2 years 2 months ago

The Jar files in the projects lib folder should be matching the version of iReport
I had the same problem and it has been solved by using correct jar files.
you can take a look at the link below:
http://sourceforge.net/projects/jasperreports/files/jasperreports/

AhmadNasrElKaffas - 6 years 8 months ago
Feedback