Hi all we are planning to upgrade our project from Java 8 to Java 11. Therefore Spring version of the project shall be changed from Spring 4x to Spring 5x
The view resolving was done in Spring 4x as follows
1) spring xml configuration:
<bean class="org.springframework.web.servlet.view.XmlViewResolver">
<property name="location" value="/WEB-INF/jasper-view.xml"/>
<property name="order" value="0"/>
</bean>
2) jasper-view.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!--here all the url value should contains the valid path for the jrxml file-->
<bean id="purchasePdf"
class="org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView"
p:url="classpath:reports/purchaseReport.jrxml"
p:reportDataKey="datasource" />
So with the upgrade Spring version was updated to 5.2.5.RELEASE and jasper version was updated as follows:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.4.0</version>
</dependency>
The project is building without and error but gives the following error when deploying in Tomcat server:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView] for bean with name 'purchasePdf' defined in ServletContext resource [/WEB-INF/jasper-view.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView
It seems Spring 5 has dropped it's Jasper support
https://github.com/spring-projects/spring-framework/issues/17884
Is there an alternative solution for this?