title: Jasper report net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $F{id
body: <p>I have faced org.xml.sax.SAXParseException: Premature end of file. exception while compiling the .jrxml file.</p>
  
  <p>I have kept my jrxml file under the resources folder.</p>
  
  <pre><code>File file = ResourceUtils.getFile("classpath:report.jrxml");
  JasperReport report=JasperCompileManager.compileReport(file.getAbsolutePath());
  </code></pre>
  
  <p>while compiling it throw the below error</p>
  
  <p>Parse Fatal Error at line 1 column 1: Premature end of file.</p>
  
  <p>After try to fill the report i have facing the below issue.
  JasperPrint print = JasperFillManager.fillReport(report, map,dataSource);</p>
  
  <p>net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $F{id}
      at net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:284)
      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:316)
      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:673)
      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:641)
      at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1169)
      at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:545)
      at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:530)
      at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383)
      at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:548)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2597)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:823)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
      at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:433)
      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:162)
      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:145)
      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:758)
      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:1074)
      at com.kousik.formentrygst.service.ReportService.exportReport(ReportService.java:47)
      at com.kousik.formentrygst.controller.CalculationController.generateReport(CalculationController.java:150)
      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 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
      at report1_1591247150649_828124.evaluate(report1_1591247150649_828124:173)
      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:302)
      ... 69 more</p>