我无法生成 myJasperReports.jasper 文件,因为它FileNotFoundException
试图读取文件并创建报告会花费一段时间。我正在使用 jasper-reports 3.7.5 和基于注释的 Spring。有人可以告诉问题可能是什么吗?
在 web.xml 文件中:
<bean id="myReportTemplate" class="org.springframework.core.io.ClassPathResource">
<constructor-arg value="mypackage/reports/jasper/template/SampleJasper.jasper"/>
</bean>
谢谢。
这是堆栈跟踪:
[ERROR] java.io.FileNotFoundException: class path resource [mypackage/reports/jasper/template/SampleJasper.jasper] cannot be resolved to URL because it does not exist
[ERROR] at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:179)
[ERROR] at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:48)
[ERROR] at mypackage/reports.ReportsServiceImpl.prepareChart(ReportsServiceImpl.java:93)
[ERROR]
我在 pom.xml 文件中使用的插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/jasper</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
</plugin>