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

升级Liferay 7.4后JSONWS add-user-with-workflow调用失败求助

Liferay CE 7.4升级后JSON Web Service调用故障问题

升级背景与核心问题

从Liferay CE 7.3升级至7.4后,调用add-user-with-workflow接口的应用程序出现故障,Liferay日志及接口响应均未提供详细错误信息。调用通过Java HTTP Client发起,请求URL如下:

https://[hostname]/api/jsonws/user/add-user-with-workflow?
companyId=10157&
autoPassword=true&
-password1=&
-password2=&
autoScreenName=true&
-screenName=&
emailAddress=liferay.api.prod10%40mcintoshes.com&
-locale=&
firstName=Scott&
-middleName=&
lastName=McIntosh&
prefixId=0&
suffixId=0&
male=true&
birthdayMonth=0&
birthdayDay=0&
birthdayYear=0&
jobTitle=%7B%22isBatch%22%3A%22true%22%7D&
-groupIds=&
organizationIds=77377&
-roleIds=&
-userGroupIds=&
sendEmail=true

Postman测试结果

使用Postman测试上述URL时,得到如下响应:

{
    "exception": "No JSON web service action with path /user/add-user-with-workflow and method GET for null",
    "throwable": "com.liferay.portal.kernel.jsonwebservice.NoSuchJSONWebServiceException: No JSON web service action with path /user/add-user-with-workflow and method GET for null",
    "error": {
        "message": "No JSON web service action with path /user/add-user-with-workflow and method GET for null",
        "type": "com.liferay.portal.kernel.jsonwebservice.NoSuchJSONWebServiceException"
    }
}

初步排查情况

  • 检查/api/jsonws UI,确认该服务及对应参数仍存在
  • 改用POST请求调用,问题依然存在
  • 怀疑Liferay 7.4是否不再支持-parameter的语法来表示空值(该语法在7.3版本中可正常运行)

补充权限问题

调用根据邮箱获取用户的getUserIdByEmailAddress接口时,未出现“无JSON Web服务”的错误,但返回权限拒绝:

{
    "exception": "Access denied to com.liferay.portal.kernel.service.UserService#getUserIdByEmailAddress",
    "throwable": "java.lang.SecurityException: Access denied to com.liferay.portal.kernel.service.UserService#getUserIdByEmailAddress",
    "error": {
        "message": "Access denied to com.liferay.portal.kernel.service.UserService#getUserIdByEmailAddress",
        "type": "java.lang.SecurityException"
    }
}

Service Access Policy配置检查

管理控制台中的Service Access Policy有两个条目:

  • SYSTEM_DEFAULT:仅允许getCountries和getRegions接口,测试这两个接口可正常调用
  • SYSTEM_USER_PASSWORD:设置Service Class为*、Method Name为空,理论上认证用户可访问所有服务

其他异常现象

确认凭证传递无问题,但在已登录的/api/jsonws服务测试UI中,除getCountries和getRegions外,其他方法调用均返回{},且无报错信息。

疑问

是否存在Liferay 7.4新增的portal property未配置,导致出现上述问题?


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 11:00:22