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

如何通过命令行更新Payara服务器上的字符串类型JNDI变量testVar

命令行更新Payara服务器的JNDI字符串变量问题

我希望通过命令行更新Payara服务器上一个名为testVar的字符串类型JNDI变量。我在Oracle文档中看到了如下更新示例,但该示例看起来混乱不清:

asadmin> set server.resources.custom-resource.custom/my-custom-resource.property.value=2010server.resources.custom-resource.custom/my-custom-resource.property.value=2010

这明显是多条命令混在一起的错误内容。我尝试了多种变体,但始终遇到如下错误:

remote failure: invalid name value pair server.resources.custom.custom-resource.myresource. Missing expected equal sign

正确的命令格式及解决方案

  1. 明确资源路径结构
    Payara中通过asadmin set命令修改自定义JNDI资源属性的正确路径格式为:
asadmin set [目标节点].resources.custom-resource.[资源标识符].property.value="你的新字符串值"
  • [目标节点]:单机环境用server,集群环境替换为集群名(如cluster1)或具体实例名(如instance1)
  • [资源标识符]:是创建testVar自定义资源时指定的标识,通常是其JNDI名称去掉前缀(比如JNDI名为java:comp/env/custom/testVar,则标识符为custom/testVar)
  1. 针对testVar的具体更新命令
    假设testVar对应的资源标识符是custom/testVar,单机环境下的更新命令应为:
asadmin set server.resources.custom-resource.custom/testVar.property.value="新的字符串内容"
  1. 错误原因解析
    你遇到的invalid name value pair错误,大概率是因为:
  • 资源路径拼写错误,比如错误嵌套了custom.custom-resource层级(正确层级是custom-resource直接在resources下)
  • 命令中缺少关键的等号,或者值的位置格式错误

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.14 20:25:30