Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何从@LdapIdentityStoreDefinition的环境属性/Payara容器中读取bindDnPassword值_Java_Ldap_Payara - Fatal编程技术网

Java 如何从@LdapIdentityStoreDefinition的环境属性/Payara容器中读取bindDnPassword值

Java 如何从@LdapIdentityStoreDefinition的环境属性/Payara容器中读取bindDnPassword值,java,ldap,payara,Java,Ldap,Payara,设置LdapIdentityStoreDefinition属性如下: 在Payara服务器中创建别名somepasword,如下所示: create-password-alias somepassword Enter the alias password> Enter the alias password again> Command create-password-alias executed successfully. [2019-11-26T14:46:42.101-050

设置LdapIdentityStoreDefinition属性如下:

在Payara服务器中创建别名somepasword,如下所示:

create-password-alias somepassword
Enter the alias password>
Enter the alias password again>
Command create-password-alias executed successfully.
 [2019-11-26T14:46:42.101-0500] [Payara 5.191] [WARNING] [] [javax.enterprise.system.container.web.com.sun.web.security] [tid: _ThreadID=29 _ThreadName=http-thread-pool::http-listener-1(2)] [timeMillis: 1574797602101] [levelValue: 900] [[
      JASPIC: http msg authentication fail
    javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'somepassword'
 at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:68)
        at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:126)
        at com.sun.el.parser.AstAssign.getValue(AstAssign.java:57)
        at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
        at javax.el.ELProcessor.getValue(ELProcessor.java:129)
在运行应用程序时将异常获取为:

create-password-alias somepassword
Enter the alias password>
Enter the alias password again>
Command create-password-alias executed successfully.
 [2019-11-26T14:46:42.101-0500] [Payara 5.191] [WARNING] [] [javax.enterprise.system.container.web.com.sun.web.security] [tid: _ThreadID=29 _ThreadName=http-thread-pool::http-listener-1(2)] [timeMillis: 1574797602101] [levelValue: 900] [[
      JASPIC: http msg authentication fail
    javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'somepassword'
 at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:68)
        at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:126)
        at com.sun.el.parser.AstAssign.getValue(AstAssign.java:57)
        at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
        at javax.el.ELProcessor.getValue(ELProcessor.java:129)

据我所知,您不能在
@LdapIdentityStoreDefinition
中直接使用环境属性。但是,通过MicroporFile配置API有一个解决方法


请参阅此论坛帖子以获取参考:

@LdapIdentityStoreDefinition注释尝试将
bindDnPassword
的值解释为EL表达式。这与alias的Payara表达式冲突,并给您一个异常

解决方法是定义引用别名的系统属性,然后从EL表达式检索此系统属性

例如,您可以在Payara服务器配置中指定系统属性
passwordproperty
,该属性使用以下asadmin命令引用别名:

create-system-properties --target=server-config passwordproperty=${ALIAS\=somepassword}
请记住,您必须以配置为目标,例如
服务器配置
。如果目标实例(例如,
服务器
),则不会计算别名

在管理控制台中,您可以在
server config->System properties
中定义属性。不在
服务器(管理服务器)->Properties->System Properties
中,不会对别名进行评估

然后可以定义
bindDnPassword=“${System.getProperty('passwordproperty')}”
并将其计算为系统属性的值,该值将计算为别名的值


我希望有一种从EL表达式计算别名的直接方法,但是没有。您可以在Payara github上提出增强请求,从EL表达式计算Payara表达式似乎是一个有用的功能。

这是正确的。根据规范文档,此注释将值解释为EL表达式:。Payara语法与EL语法冲突,您指定的值被解释为EL表达式而不是Payara表达式。谢谢,在服务器配置->系统属性中添加属性作为键/值对起作用。在java中,我正在阅读您提到的这个属性-bindDnPassword=“${System.getProperty('passwordproperty')}”