Multiple cast errors. Cannot cast from URL to String / Integer to String/etc

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. Cannot cast from URL to String
                value = (java.lang.String)(((java.net.URL)parameter_logo.getValue())); //$JR_EXPR_ID=29$
                        <----------------------------------------------------------->
2. Cannot cast from Integer to String
                value = (java.lang.String)(((java.lang.Integer)field_poliza46endoso.getValue())); //$JR_EXPR_ID=31$
                        <---------------------------------------------------------------------->
3. Cannot cast from Date to String
                value = (java.lang.String)(((java.util.Date)field_vigenciaDesde.getValue())); //$JR_EXPR_ID=32$
                        <------------------------------------------------------------------>
4. Cannot cast from Date to String
                value = (java.lang.String)(((java.util.Date)field_vigenciaHasta.getValue())); //$JR_EXPR_ID=33$
                        <------------------------------------------------------------------>
5. Cannot cast from URL to String
                value = (java.lang.String)(((java.net.URL)parameter_firmaPresidente.getValue())); //$JR_EXPR_ID=79$
                        <---------------------------------------------------------------------->
6. Cannot cast from URL to String
                value = (java.lang.String)(((java.net.URL)parameter_logo.getValue())); //$JR_EXPR_ID=29$
                        <----------------------------------------------------------->
7. Cannot cast from Integer to String
                value = (java.lang.String)(((java.lang.Integer)field_poliza46endoso.getOldValue())); //$JR_EXPR_ID=31$
                        <------------------------------------------------------------------------->
8. Cannot cast from Date to String
                value = (java.lang.String)(((java.util.Date)field_vigenciaDesde.getOldValue())); //$JR_EXPR_ID=32$
                        <--------------------------------------------------------------------->
9. Cannot cast from Date to String
                value = (java.lang.String)(((java.util.Date)field_vigenciaHasta.getOldValue())); //$JR_EXPR_ID=33$
                        <--------------------------------------------------------------------->
10. Cannot cast from URL to String
                value = (java.lang.String)(((java.net.URL)parameter_firmaPresidente.getValue())); //$JR_EXPR_ID=79$
                        <---------------------------------------------------------------------->
11. Cannot cast from URL to String
                value = (java.lang.String)(((java.net.URL)parameter_logo.getValue())); //$JR_EXPR_ID=29$
                        <----------------------------------------------------------->
12. Cannot cast from Integer to String
                value = (java.lang.String)(((java.lang.Integer)field_poliza46endoso.getValue())); //$JR_EXPR_ID=31$
                        <---------------------------------------------------------------------->
13. Cannot cast from Date to String
                value = (java.lang.String)(((java.util.Date)field_vigenciaDesde.getValue())); //$JR_EXPR_ID=32$
                        <------------------------------------------------------------------>
14. Cannot cast from Date to String
                value = (java.lang.String)(((java.util.Date)field_vigenciaHasta.getValue())); //$JR_EXPR_ID=33$
                        <------------------------------------------------------------------>
15. Cannot cast from URL to String
                value = (java.lang.String)(((java.net.URL)parameter_firmaPresidente.getValue())); //$JR_EXPR_ID=79$
                        <---------------------------------------------------------------------->
15 errors

    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:191)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:215)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:131)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:113)
    at com.jaspersoft.jasperreports.toolkit.JRCompiler.main(JRCompiler.java:52)
Compilation terminated
 

pablo.duchovny's picture
Joined: Jul 6 2021 - 12:34pm
Last seen: 1 year 6 months ago

1 Answer:

you need to check your expressions.  You cannot direct cast those types in java.  You will need to use the correct methods to do those type conversions  if applicable. or .toString() if applicable.

rmeadows's picture
1428
Joined: Feb 10 2016 - 8:00am
Last seen: 1 year 1 week ago
Feedback
randomness