- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我搜索了几天来修复这个错误,没有什么新东西。
我有一份报告,其中包含多级子报告,在 iReport 3.7.5
上一切正常。我在第一级使用 subreport.jasper
作为子报表表达式,在第二级使用 subreportA.jasper
和 subreportB.jasper
并将所有(主报表和子报表)放在同一路径中。
当我尝试在我的 JasperServer
上部署它时出现的问题。
当我尝试上传第一个主报告时,iReport
向导让我将第一个 subreport.jrxml
附加到资源文件夹中,并使用 repo:subreport.jrxml
或 repo:subreport.jasper
访问它。
然后我手动上传二级子报表并做同样的事情将子报表表达式更改为 repo:subreportA.jasper
和 repo:subreportB.jasper
。
我收到编译错误:Unable to locate the subreport with expression: ""repo:subreport.jasper"". java.lang.Exception: repo:subreport.jrxml not found.
我尝试了十几种解决方案,但没有任何效果。
使用:SUBREPORT_DIR@开头,
使用完整路径: repo:/Circuit_Reports/Connectivity/Connectivity_files/
,
在 .jasper
和 .jrxml
之间切换。
使用 lib 文件夹中的 jasperserver_api_engine_impl_0_fix.jar
作为此错误的修复,
我还搜索了数据库记录以确保它们位于同一文件夹中并具有相同的父文件夹。
最佳答案
在 Longtalk 之前的 Smalltalk ;)
(当然,我不想鼓励你阅读这篇长篇详细文章的所有内容! 粗体标记可能已经足以解决你的问题 但我发现更详细地记录这个棘手的东西是值得的!)
由于我在这方面又投入了几个小时(几周前我解决了这个问题之后,现在进行了更改,但是忘记正确记录它,忘记了我是如何做的并且无法以任何形式再次检索此信息 - 在上传和配置时到/在 JasperServer 中)……这里有一些在各种站点上提到的关于子报告引用的聚合功能,它是如何工作的以及可以尝试什么……
(如果有希望的话,我会在这里更新我的或其他发现)
捷径细节/最佳实践?!4
直到 Jasper 功能本身提供了类似的“包装”解决方案......
为了解决与在预览模式下本地或在 JasperServer 上远程运行 *.jrxml、*.jasper 文件相关的所有问题,我现在使用以下方法, 只允许使用单个 *.jrxml 文件,这将在多开发人员环境中无需修改即可在本地和远程工作,支持对每个环境 的目录结构(路径、名称)进行独立重构(= 应该如此;-)):
Project->Properties->Java Build Path->Libraries->Add
) ../jasperserver/WEB-INF/lib/
文件夹 jr.utl.EnvScriptlet
在你的主报告中执行丑陋的子报告路径/引用魔术REPORT_SCRIPTLET
: 报告属性 -> 报告 -> 数据集 -> Scriptlet 类:jr.utl.EnvScriptlet jr.utl.properties
或以其他方式提供的系统属性 (设置 Java 系统属性的任何其他方式也可以正常工作 - 已经设置的属性将覆盖加载的文件属性)来配置不同的环境,包括您的jr.utl.env
属性(prod、myOsUsrName、test、demo、staging、local,...)../jasperserver/WEB-INF/classes/jr.utl.properties
jr.utl.env=prod
mycompany.local.jr.gui.rep.subrep1.parentdir=repo:/x/y/z/
mycompany.local.jr.gui.rep.subrep2.parentdir=repo:/x/y/z/
mycompany.local.jr.gui.rep.subrep3.parentdir=repo:/x/y/foobar/
../myrepproject/src/java/jr.utl.properties
jr.utl.env=dietrian
mycompany.local.jr.gui.rep.subrep1.parentdir=D:/reporting/src/reports/
mycompany.local.jr.gui.rep.subrep2.parentdir=D:/reporting/src/reports/
mycompany.local.jr.gui.rep.subrep3.parentdir=D:/reporting/src/reports.otherdir/
local.properties
文件生成它们,基于这个想法:|- build.xml (containing the ANT build magic) |- build.properties (containing global properties) |- local.properties (ignored in version control, e.g. .hgignore, user-specific generated from local.template.properties)|- local.template.properties (source for ANT build task generating the local.properties above) |- mycomp.local.proj.reporting.dir=D:/reporting|- src/reports |- jr.utl.properties (ignored in version control, user-specificly generated based on template below) |- jr.utl.template.properties (source for ANT build task generating the jr.utl.properties above) jr.utl.env=${user.name} mycompany.local.jr.gui.rep.subrep1.parentdir=${mycomp.local.proj.reporting.dir}/src/reports/ mycompany.local.jr.gui.rep.subrep2.parentdir=${mycompany.local.jr.gui.rep.subrep1.parentdir} mycompany.local.jr.gui.rep.subrep3.parentdir=${mycomp.local.proj.reporting.dir}/src/reports.otherdir/
defining your BASE_DIR
master report parameters as e.g. $P{REPORT_SCRIPTLET}.getProp("mycompany.allsubreports.parentdir")
(matching some environment-dependent property in your jr.utl.properties
file)
jr.utl.EnvScriptlet.getSubrepPath( $P{BASE_DIR}, "subrep1.jrxml")
jr.utl.EnvScriptlet.getSubrepPathByPropKey( $P{BASE_DIR}, "mycompany.local.jr.gui.rep.subrep1.name")
jr.utl.EnvScriptlet.getSubrepPathByPropKeys( "mycompany.local.jr.gui.rep.subrep1.parentdir", "mycompany.local.jr.gui.rep.subrep1.name")
$P{REPORT_SCRIPTLET}.getSubrepPath(...)
does not work here :-( (I don't know why)(4: Of course I am still seeing some minor improvements here, but it seems much better than all the ugly solutions I found till now. Improvements I would see:
REPORT_SCRIPTLET
or scriptlet functionality may not be the best way to go, but it will probably work in the vast majority of use cases(5: the relevant special handling is encoded here: EnvScriptlet.java/getSubrepPath(String,String,boolean,String[]))
First thing to know is that the handling/setup in JasperStudio is quite different from the handling on Jasper Server (Repository)5 ...
suppose we have the following enviroments:
C:\eclipse\
C:\workspace\
C:\workspace\report-project\
C:\workspace\report-project\src/reports
C:\workspace\report-project\src/reports/masterrep.jrxml
C:\workspace\report-project\src/reports/subrep1.jrxml
C:\workspace\report-project\src/reports/somesubdir/subrep2.jrxml
BASE_DIR
(explained in next section) in our workspace master report is set to C:\workspace\report-project\src/reports/
/x/y/z/
(which is not to-be-confused with the visual named-path, e.g. which could be Financial Reports/Expenses/Current Year
)(and other "Jasper runtime environments" like custom Java Jasper package usage):
BASE_DIR
/
may be included1 because there are cases where you may have/want to use it in a way where it should be an empty or "unslashed" path expression
$P{BASE_DIR} + "subrep1.jrxml"
which should resolve torepo:subrep1.jrxml
SUBREPORT_DIR
)(1: which I personally find a bad practice in general (not looking at Jasper Reports in this respect) when dealing with directory-like structures)
(the official IReport successor with loads of more functionality)
(if you do not use the preview functionality this may be uninteresting to you)
BASE_DIR
do not work since the working directory is the eclipse dir, e.g. C:\eclipse
Eclipse->Window->Preferences->JasperStudio->Properties->Add
e.g. my.base.dir
new java.io.File(System.getProperty("my.base.dir")).getCanonicalPath() + "/"
for our BASE_DIR
expression (these props may be only used by the designer itself, but not set in preview runs)Eclipse->Window->Preferences->JasperStudio->Report Execution->Virtualizer Temporary Path
is something unrelated (not useful here) dealing with the storage of the report result "caching"*.jrxml
files (as I do3) you have to reference some subrep1.jrxml
like this: net.sf.jasperreports.engine.JasperCompileManager.compileReport($P{BASE_DIR} + "subrep1.jrxml")
(3: I don't need the *.jasper
files explicitely and do not see why I want to deal with them. BTW the JasperServer WebGUI only seems to support the upload of *.jrxml
files)
(e.g. provided by some Tomcat application server and storing its data in some postgres database)
subrep1.jrxml
from above is uploaded with a resource id of subrep1.jrxml
(thus making the handling of local design references and server references less complicated)BASE_DIR
to repo:
in the to-be-uploaded master report
$P{BASE_DIR} + "subrep1.jrxml"
and $P{BASE_DIR} + "somesubdir/subrep2.jrxml"
should work on the server as wellrepo:/x/y/z/masterrep.jrxml_files/masterrep.jrxml_
(2: which I would not recommend in this case; it's undocumented and may change; better put your subreports then into the "GUI repo path" as described below)
suppose we upload our subreports to the master repo id-path /x/y/z/
(as shown on top)
again we have to differentiate two different use cases
we do NOT want to use the subreport as a standalone report (it will always only be included in other master reports)
in this case we should upload it using Add Resource->File->JRXML
and reference it
../subrep1.jrxml
or ./subrep1.jrxml
do not work since it seems the underlying logic cannot handle the relative path expression ..
(and likely .
not as well) (which would actually be nice :-( )
so what we have to do here is to supply an absolute canonical path in the BASE_DIR
of our masterrep.jrxml, e.g. repo:/x/y/z/
we want to use the subreport as a standalone report as well
in this case we should upload it using Add Resource->JasperReport
this obviously creates a hidden folder repo:/x/y/z/subrep1.jrxml_files
containing the report itself and other resources
that's why we not only have to adjust the BASE_DIR
(as above), but also the subreport expression to, e.g. $P{BASE_DIR} + "subrep1.jrxml_files/subrep1.jrxml_"
(which points to the subreport itself)
and maybe remove the net.sf.jasperreports.engine.JasperCompileManager.compileReport(...)
wrapper function, because the server does this automatically for *.jrxml
files
I did not fully investigate some other likely incorrectly used approaches which did not work for me to solve the mentioned problems (maybe somebody else has some outcome/corrections here):
$P{REPORT_FILE_RESOLVER}.resolveFile("subrep1.jrxml")
(NullPointerException)$P{REPORT_CONTEXT}.getRealPath("subrep1.jrxml")
$P{REPORT_CONTEXT}.getProperty("REPORT_FILE_RESOLVER").resolveFile("subrep1.jrxml")
Since I like to automate the report design and deployment process as much as it makes sense I wrote some ANT tasks that handle the local *.jrxml file to deployable *.jrxml file transformations regarding the BASE_DIR
and the other transformations.
SQL helpful to easily investigate the resource id path structures in a jasper server postgres meta database (following something like jdbc:postgresql://myjasperhost/jasperserver
connecting e.g. with the postgres user):
select
f.id as folder_id,
r.id as res_id,
case when f.hidden = true then 1 else 0 end as hidden,
f.uri||case when f.uri = '/' then '' else '/' end||coalesce(r.name,'') as res_uri,
r.resourcetype,
r.creation_date,
r.update_date,
f.uri,
r.name,
-- less important
r.version,
r.parent_folder,
r.childrenfolder,
f.parent_folder,
f.version,
f.name
-- select *
from jiresourcefolder f
left outer join jiresource r on (r.parent_folder = f.id)
where not f.uri like '/themes%'
order by f.uri||coalesce(r.name,'')
关于jasper-reports - JasperServer:无法定位子报表异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4364205/
是否可以创建一个 sql 语句来动态生成 3 行而无需任何表..这些将包括 value1 : 10 | value2: 10 value2 : 11 | value2: 11 value3 : 12
近日,葡萄城正式发布了SpreadJS最新版本 V17.1,为前端表格控件市场带来了一系列令人瞩目的新特性和功能增强。本次更新旨在进一步提升用户在计算引擎、报表生成和分析等方面的体验,为各行业的开发者
我正在使用 Visual Studio 的 Crystal 报告,我创建了一个需要有背景图像的报告。我找不到像 Microsoft Report Viewer Report 这样的背景图像的方法。有办
我正在开发一个使用 Crystal Reports 生成 pdf、excel 和 word 报告文件的大型 C# 项目。 项目位于 SVN 存储库下,我们有主干和一个单独的分支。 我们每周都会将主干合
我以正确的格式放置了我的 super 语句,但我唯一的错误是它指出类 java.lang.object 中的构造函数对象不能应用于这部分代码的给定类型: super (openFile
我正在使用 Visual Studio 2008 并希望在报告中显示以下 SQL 查询: select name, count(*) from mytable group by name; 我可以通过
我使用 C# 在我的 CR 上正确地导入了一个图像。现在我需要在同一页面上显示包含 4 种不同产品的报告,类似这样: | P1 | P2 | | P3 | P4 | 为此,我创建了一个报告并将选项 R
我正在使用 C#.net 2010,我想使用两个表创建发票。一个表 Order 包含客户订购的东西,如类别、数量、费率、总金额,另一个表 Details 包含最终支付金额的详细信息,如 Vat、Fin
我正在使用 C# 创建一个 Crystal Report,我必须在 320 个不同的参数中复制一个简单的公式,但始终具有相同的条件,如下所示: if ({Precios.AhorroE1}[1] =
我在 vs2010 中创建了一个项目,然后创建了一个已部署的安装项目。当我在我的 PC 上运行应用程序时,它显然运行良好,但对于客户端计算机,应用程序运行良好,除了 crystal报道。我制作了安装项
我正在使用 Visual Studio、.NET 创建一个使用 Crystal 报表的 Web 应用程序,除了手动拖放之外,有什么方法可以让我以有组织的方式格式化这些报表? 谢谢 最佳答案 是的,报告
我正在使用 Visual Studio 2010 创建一个使用 Crystal Reports 的 Web 应用程序。 我目前使用 odp.NET 连接到 oracle 数据库并且一切正常,当我通过
我在 Windows 窗体应用程序 C# 中有 mysql 数据库,我想使用 Crystal 报告进行报告,但我想在没有报告向导的情况下连接到数据库,因为我希望我的应用程序独立于数据库服务器地址,并且
我正在开发一个超过 200 个表的大项目,我使用 MySQL(Percona)、Java 和 Crystal Report JRC。我有一些报告非常大并且多个表之间有很多连接。在Java客户端中,我通
我有一份报告和一份带有法语国际化资源包的子报告。没有抛出任何错误或警告,但是当我使用此报告创建 pdf 时,出现奇怪的字符,因为编码错误(É 代表 é 是一个例子)。 我仍在调查那个问题,但我猜它与子
我在让 Crystal Reports 与我们的应用程序很好地协同工作时遇到了一些问题。而且我似乎找不到任何资源来回答我的问题。 基本上,我们有一个 Crystal 报表,在 Crystal 报表应用
我正在为 Winform 使用 VS 2008。我在元素中有 Crystal 报表,我想在 CSS 的帮助下对其进行格式化。 谁能给我指出正确的教程来开始这个? 最佳答案 Visual Studio
我是java和crysal报告的新手。两天以来,我尝试使用 java 和 jsf 创建 Crystal 报告 pdf。一切正常,但是当我在代码中包含参数传递时,出现错误 *HTTP Status 5
我是这个工具的新手,所以我不知道如何获取类的数据并显示在报告中。 我没有数据库,我的信息存储在类内的变量中。像这样(文件夹 Objetos): 我的程序执行以下操作:读取 XML、使用 XSD 验证、
我需要在只有一个独立数据集(未连接到任何类型的数据库)的应用程序中使用 Crystal Reports 生成报告。此外,我需要根据 DataTable 中的值生成报告。 你能帮我看看吗,我是新手。我有
我是一名优秀的程序员,十分优秀!