You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jaspersoft安全文件配置报错:字段无法找到问题求助

Jaspersoft Domain安全文件部署报错:filterExpression字段无法找到

我在Jaspersoft实例部署新安全文件时,保存Domain遇到错误,已排除XML语法问题,错误提示多个filterExpression中的字段找不到:

There is a problem with the security file
The following field(s) can not be found:

The filter condition 'testProfileAttribute(dw_analytics_dim_faculty.faculty_username, 'username')' references one or more fields that cannot be found: ID [dw_analytics_dim_faculty.faculty_username].
The filter condition 'testProfileAttribute(dw_analytics_dim_graders_rls.grader_username, 'username')' references one or more fields that cannot be found: ID [dw_analytics_dim_graders_rls.grader_username].
The filter condition 'testProfileAttribute(dw_analytics_dim_coach.coach_username, 'username')' references one or more fields that cannot be found: ID [dw_analytics_dim_coach.coach_username].
The filter condition 'testProfileAttribute(dw_analytics_users_workspaces_rls.username, 'username')' references one or more fields that cannot be found: ID [dw_analytics_users_workspaces_rls.username].

安全文件XML配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<securityDefinition xmlns="http://www.jaspersoft.com/2007/SL/XMLSchema" version="1.0" itemGroupDefaultAccess="granted">
   <resourceAccessGrants>
      <resourceAccessGrantList id="JoinTree_1_resource_access_grant" label="aLabel" resourceId="JoinTree_1">
         <resourceAccessGrants>
            <resourceAccessGrant id="Jointree_1_row_access_grant_faculty">
               <principalExpression><![CDATA[authentication.getPrincipal().getRoles().any{it.getRoleName() in ['ROLE_FACULTY']}]]></principalExpression>
               <filterExpression>testProfileAttribute(dw_analytics_dim_faculty.faculty_username,'username')</filterExpression>
            </resourceAccessGrant>
            <resourceAccessGrant id="Jointree_1_row_access_grant_grader">
               <principalExpression><![CDATA[authentication.getPrincipal().getRoles().any{it.getRoleName() in ['ROLE_GRADER']}]]></principalExpression>
               <filterExpression>testProfileAttribute(dw_analytics_dim_graders_rls.grader_username,'username')</filterExpression>
            </resourceAccessGrant>
            <resourceAccessGrant id="Jointree_1_row_access_grant_coach">
               <principalExpression><![CDATA[authentication.getPrincipal().getRoles().any{it.getRoleName() in ['ROLE_COACH']} && !(attributesService.getAttribute('tenant','USER')?.getAttrValue().contains('brandman'))]]></principalExpression>
               <filterExpression>testProfileAttribute(dw_analytics_dim_coach.coach_username,'username')</filterExpression>
            </resourceAccessGrant>
            <resourceAccessGrant id="Jointree_1_row_access_grant_workspaces">
               <principalExpression><![CDATA[authentication.getPrincipal().getRoles().any{it.getRoleName() in ['ROLE_ADMIN','ROLE_COACH','ROLE_FACULTY','ROLE_GRADER']}]]></principalExpression>
               <filterExpression>testProfileAttribute(dw_analytics_users_workspaces_rls.username,'username')</filterExpression>
            </resourceAccessGrant>
         </resourceAccessGrants>
      </resourceAccessGrantList>
   </resourceAccessGrants>
</securityDefinition>

Domain已包含所有涉及的表和对应username字段,求排查思路。


排查思路

  • 核对字段在Domain中的实际ID
    Jaspersoft Domain中字段的引用ID不一定等于数据库原始列名,需检查Domain设计时给字段设置的ID。安全文件里必须使用Domain定义的字段ID,而非数据库表列名,比如若Domain中表ID设为faculty、字段ID设为username,则应写成testProfileAttribute(faculty.username,'username')。

  • 确认表归属的关联树
    安全文件中resourceId="JoinTree_1"指定了权限作用的关联树,需检查报错涉及的所有表是否都包含在JoinTree_1内,不在该关联树的表无法被权限系统识别。

  • 验证字段是否纳入逻辑层
    即使物理层存在表和字段,也要确保这些字段已添加到Domain的逻辑层(Logical Tables),仅存在于物理层的字段无法被权限过滤逻辑调用。

  • 检查大小写一致性
    Jaspersoft对大小写敏感,尤其在区分大小写的数据库(如PostgreSQL)中,需确保安全文件中的表名、字段名与Domain定义完全一致,包括大小写。

  • 清理Domain缓存重试
    Jaspersoft可能缓存Domain元数据,修改安全文件后可通过管理控制台清除Domain缓存,或重启服务器后再尝试保存。

内容的提问来源于stack exchange,提问作者SRahmani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 16:03:15