使用部署计划覆盖weblogic.xml配置

时间:2014-11-01 14:17:26

标签: deployment weblogic weblogic-10.x

我有以下问题。我将WAR应用程序部署到多个环境。每个环境都有自己的主体名称,我想使用部署计划提供给WAR。 WAR应用程序包含用于将角色映射到主体的默认用户和weblogic.xml,如下所示:

...
<run-as-role-assignment>
   <role-name>sampleRole</role-name>
   <run-as-principal-name>defaultUser</run-as-principal-name>
</run-as-role-assignment>
...

用于在run-as-principal-name元素中替换值的部署计划如下:

<deployment-plan>
    ...
    <variable-definition>
        <variable>
            <name>runAsIdentity</name>
            <value>someEnvironmentSpecificUser</value>
        </variable>
    </variable-definition>
    <module-override>
        <module-descriptor external="false">
            <root-element>weblogic-web-app</root-element>
            <uri>WEB-INF/weblogic.xml</uri>
            ...
            <variable-assignment>
                <name>runAsIdentity</name>
                <xpath>/weblogic-web-app/run-as-role-assignment/run-as-principal-name</xpath>
                <operation>replace</operation>
            </variable-assignment>          
        </module-descriptor>
    </module-override>
</deployment-plan>

Principal defaultUser不存在于我的目标环境中,但someEnvironmentSpecificUser存在。但是,我无法覆盖weblogic.xml中的值,并且在部署期间会出现以下错误:

weblogic.management.DeploymentException: [HTTP:101256]The run-as user: defaultUser for the servlet: spring-ws for Web application: /sampleApp could not be resolved to a valid user in the system. Verify the user exists.

正如我上面所写,用户存在,xpath是正确的,但覆盖不起作用。如果我在weblogic.xml中更正用户并直接将替换someEnvironmentSpecificUser放在那里,一切都运行良好。

有人知道为什么会这样吗?有一些限制,例如我不能覆盖run-as-principal-name元素?看起来用户在实际更换之前已经过验证(如果甚至是部署计划执行了一次)。

感谢任何帮助/建议。 THX。

0 个答案:

没有答案
相关问题