当前位置: 首页 > 知识库问答 >
问题:

JasperReportsPdfView:包组织。springframework。网状物servlet。看法jasperreports不存在

端木夕
2023-03-14

我正在从4.3升级一个spring应用程序。x版本到5.1。x版本。在执行此操作时,我发现org中的JasperReportsPdfView类有一个错误。springframework。网状物servlet。看法jasperreports包。

在我们的应用程序中,我们还使用jasperreports-3.6.0 jar。

error: package org.springframework.web.servlet.view.jasperreports does not exist
public class PdfReportView extends JasperReportsPdfView{


    /**
     * Creating constructor
     * @param contractList
     */
    public PdfReportView(List contractList) throws JRException
    {
    }
    ;
    ;
    ;

}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.wellpoint.ewpd</groupId>
        <artifactId>ewpd-aggregator</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../ewpd-aggregator</relativePath>
    </parent>
    <artifactId>ebx-war</artifactId>
    <packaging>war</packaging>
    <name>ebx-war Project</name>
    <description>ebx-war Project</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <!-- Set to the Context Root - DO NOT REMOVE -->
                    <warName>ebx-war</warName>

                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
        <finalName>CrossWalks</finalName>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.class</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>

            <resource>
                <directory>src/main/resources</directory>
                <includes>                  
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <includes>
                    <include>**/*.class</include>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </testResource>
        </testResources>
    </build>
    <properties>
        <springframework.version>5.1.6.RELEASE</springframework.version>
    </properties>
    <dependencies>  
        <dependency>
            <groupId>aopalliance</groupId>
            <artifactId>aopalliance</artifactId>
            <version>1.0</version>

        </dependency>
        <dependency>
            <groupId>bsh</groupId>
            <artifactId>bsh</artifactId>
            <version>1.2b7</version>

        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.2</version>

        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.2</version>

        </dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <version>2.1</version>

        </dependency>
        <dependency>
            <groupId>commons-discovery</groupId>
            <artifactId>commons-discovery</artifactId>
            <version>0.4</version>

        </dependency>       

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>net.sf.ezmorph</groupId>
            <artifactId>ezmorph</artifactId>
            <version>1.0.6</version>

        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.28</version>

        </dependency>

        <dependency> 
            <groupId>com.wellpoint.eps.ewpd.tools.xmlbeans</groupId> 
            <artifactId>Get27XBenefitAccums5010-jar</artifactId> 
            <version>2.0.2</version> 
            <classifier>sources</classifier> 
        </dependency>

        <dependency>
            <groupId>org.owasp.esapi</groupId>
            <artifactId>esapi</artifactId>
            <version>2.1.0.1</version>
                    <exclusions>
                           <exclusion>
                                  <groupId>org.owasp.antisamy</groupId>
                                  <artifactId>antisamy</artifactId>
                             </exclusion>
                           <exclusion>
                                <groupId>org.apache.xmlgraphics</groupId>
                                  <artifactId>batik-css</artifactId>
                           </exclusion>
                      <exclusion>
                           <groupId>xom</groupId>
                           <artifactId>xom</artifactId>
                      </exclusion>
                     <exclusion>
                           <groupId>commons-beanutils</groupId>
                           <artifactId>commons-beanutils-core</artifactId>
                      </exclusion>
                     </exclusions> 

        </dependency>
        <dependency>
            <groupId>com.wellpoint.ets.ebx.schemas.V4</groupId>
            <artifactId>Get27XBenefitAccumsV4</artifactId>
            <version>1.0.0</version>
            <classifier>mystery</classifier>

        </dependency>

        <dependency>
             <groupId>com.lowagie</groupId>
                <artifactId>itext</artifactId>
             <version>2.1.7</version>  
             <exclusions>
             <exclusion>
                  <groupId>bouncycastle</groupId>
                  <artifactId>bcmail-jdk14</artifactId>
             </exclusion>
             <exclusion>
                  <groupId>bouncycastle</groupId>
                  <artifactId>bctsp-jdk14</artifactId>
             </exclusion>
             <exclusion>
                  <groupId>bouncycastle</groupId>
                  <artifactId>bcprov-jdk14</artifactId>
             </exclusion>
           </exclusions>
       </dependency>    

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk14</artifactId>
            <version>1.60</version>
            </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcmail-jdk14</artifactId>
            <version>1.60</version>
            </dependency>   

        <dependency>
            <groupId>com.wellpoint.libraries.eps.epds.business</groupId>
            <artifactId>jakarta-poi</artifactId>
            <version>1.0.0</version>            
        </dependency>

        <dependency>
          <groupId>net.sf.jasperreports</groupId>
          <artifactId>jasperreports</artifactId>
          <version>3.6.0</version>

        </dependency>

        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>          
            <classifier>jdk13</classifier>          
        </dependency>

        <dependency>
            <groupId>com.wellpoint.libraries.eps.epds.web</groupId>
            <artifactId>jsr173_1.0_api</artifactId>
            <version>1.0</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jsr173_api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>

<dependency>
            <groupId>com.keyoti</groupId>
            <artifactId>RapidSpellWeb</artifactId>
            <version>2.4.2</version>
        </dependency>
        <dependency>
            <groupId>apache-xerces</groupId>
            <artifactId>resolver</artifactId>
            <version>2.9.1</version>

        </dependency>

        <dependency>
            <groupId>com.ibm.faces</groupId>
            <artifactId>jsf-ibm</artifactId>
            <version>3.0.10</version>
        </dependency>

        <dependency>
            <groupId>xmlbeans</groupId>
            <artifactId>xbean_xpath</artifactId>
            <version>2.2.0</version>

        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans-qname</artifactId>
            <version>2.5.0</version>

        </dependency>

        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.10</version>

        </dependency>
        <dependency>
            <groupId>org.apache.xbean</groupId>
            <artifactId>xbean</artifactId>
            <version>3.15</version>
             <type>pom</type>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>

        </dependency>

        <dependency>
            <groupId>org.apache.taglibs</groupId>
            <artifactId>taglibs-standard-impl</artifactId>
            <version>1.2.5</version>

        </dependency>
        <dependency>
            <groupId>xmlbeans</groupId>
            <artifactId>xmlpublic</artifactId>
            <version>2.2.0</version>

        </dependency>

        <dependency>
            <groupId>xpp3</groupId>
            <artifactId>xpp3_min</artifactId>
            <version>1.1.4c</version>

        </dependency>

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.3</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.jndi</groupId>
            <artifactId>springutil</artifactId>
            <version>1.0.0</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jms</artifactId>
            <version>2.5.6</version>

        </dependency>

        <!-- <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.6</version>
        </dependency>
         -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.3.02</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>stax</groupId>
            <artifactId>stax-api</artifactId>
            <version>1.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.12.0</version>
            <scope>provided</scope>
        </dependency>


        <dependency>
            <groupId>com.wellpoint.ewpd</groupId>
            <artifactId>ewpd-jar</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>provided</scope>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.5.4</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
        </dependency>

        <dependency>
            <groupId>jexcelapi</groupId>
            <artifactId>jxl</artifactId>
            <version>2.6</version>
        </dependency>

        <dependency>
            <groupId>com.wellpoint</groupId>
            <artifactId>adapter</artifactId>
            <version>1.4.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.wellpoint.ets.ewpd</groupId>
            <artifactId>admin-method-validation</artifactId>
            <version>1.0</version>
            <classifier>mystery</classifier>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.ajaxanywhere</groupId>
            <artifactId>ajaxanywhere</artifactId>
            <version>1.1.0.6</version>
            <classifier>mystery</classifier>
        </dependency>
        <!--  
        <dependency>
            <groupId>com.blazesoft.oes</groupId>
            <artifactId>benefitRule</artifactId>
            <version>1.0</version>
            <classifier>mystery</classifier>
        </dependency>-->
                <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.5</version>
        </dependency>


        <dependency>
            <groupId>com.wellpoint.wpd</groupId>
            <artifactId>ecidrep</artifactId>
            <version>1.0</version>
            <classifier>mystery</classifier>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>3.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>myfaces</groupId>
            <artifactId>tomahawk</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3.3</version>
        </dependency>   

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.1</version>

        </dependency>

    </dependencies>
</project>

我还可以在spring 4.3.24中看到jasperreports包。释放。

https://docs.spring.io/spring/docs/4.3.24.RELEASE/javadoc-api/

但我无法从5.0.0中看到。向前释放。

https://docs.spring.io/spring/docs/5.0.0.RELEASE/javadoc-api/

>

  • 请帮我解决这个问题。

    此外,请建议一些示例url,以获取有关这方面的知识。

    还建议一些步骤,我可以按照升级这个jar从3.6.0到6.7.1版本。

  • 共有2个答案

    巫马瀚漠
    2023-03-14

    根据您的POM更改此依赖项:

    <dependency>
          <groupId>net.sf.jasperreports</groupId>
          <artifactId>jasperreports</artifactId>
          <version>3.6.0</version>
    
        </dependency>
    

    对于这个:

    <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>5.0.1</version>
    </dependency>
    

    此外,当更改依赖项时,我总是从我的IDE(IntelliJ或Eclipse)重建项目,因为有时它不能正确解决所有包(您的问题)。

    您可以随时在此处查找更新的依赖项。

    顾骏祥
    2023-03-14

    一般来说,从Spring低版本升级到高版本(例如:Spring-4. x. x到Spring-5. x. x)时,我们需要考虑以下几点。

    • 新功能

    从Spring框架github wiki和其他文章中可以确认,对JasperReports的支持已从Spring 5中删除。x版本。因此,建议从应用程序代码中删除使用Japser报告的代码,或者使用核心jasper报告库来支持它们。

    Spring-5。x-github-wiki

    Spring-guru-5。x-链接

    Dzon-Spring-5. x-功能和支持

     类似资料:
    • 在rest servlet中。xml进行以下配置。。 出现以下错误。。有谁能提供解决方案吗。提前感谢 严重:StandardWrapper。可丢弃的组织。springframework。豆。工厂BeanCreationException:创建名为“org”的bean时出错。springframework。网状物servlet。看法在ServletContext资源[WEB-INF/rest ser

    • 我正在打一个服务来查找一个人的详细信息,响应是xml格式的,如下所示: 我正在使用Spring RestTempate并将响应映射到以下POJO, 我使用rest模板调用服务, 但我一直得到异常,org.springframework.web.client.RestClientExcture:无法提取响应:没有找到适合的HttpMessageConzer响应类型[类[Lcom.cdk.datalo

    • 通用方法 (以下)管制员工作正常 另一个跟上面一样的控制器,但给出了一个例外 例外是 例外组织。springframework。刀。InvalidDataAccessApiUsageException:对象引用未保存的临时实例-在刷新之前保存临时实例:com。软的企业资源计划赞成的意见。模型ProPurchaseOrderModel;嵌套的异常是org。冬眠TransientObjectExcep

    • 获取Spring Rest控制器Web服务的以下异常:- org.springframework.web.client.HttpClientError异常: 415org.springframework.web.client.不支持的媒体类型默认响应错误andler.java:91org.springframework.web.client.的错误(默认响应错误andler.java:91)RES

    • 我试图用Spring DI创建一个简单的HelloWorld应用程序。我创建了一个Java项目并导入了一些教程类,其中一个很简单: 然而,我得到了以下错误:。我正在使用Eclipse Spring Tool Suite 3.7.2,当我单击“修复项目设置”时,我认为通过使用这个Eclipse版本,它会为我添加这些依赖项。我在这里做错了什么?即使在STS中,我也需要手动添加这些依赖项吗?如果是,正确

    • 我正在尝试编辑一些开源文件。在其中一个文件中,有一个“import org.apache.regexp.RE”导致错误“package org.apache.regexp”不存在 在我的Android Studio中,在哪里包括这个软件包,以便文件可以工作。非常感谢。 这是我下载jakarta-regexp.jar文件后的gradle文件