3

weblogic でアプリケーションのデプロイメント設定を調整しようとすると、問題が発生します。私がやろうとしていることは非常に単純であるべきだと思いますが、期待どおりに機能していません。

weblogic.xml の context-root とデータ ソースの JNDI 名をオーバーライドしようとしているだけなので、これらは両方ともデプロイ時にコンフィグレーションできます。

ear ファイルから application.xml を削除したので、オーバーライドに影響することはありません。

私がこれまでに持っているもの:

weblogic.xml:

<context-root>mosaic</context-root>

<resource-description>
  <res-ref-name>jdbc/LogicalDS</res-ref-name>
  <jndi-name>LogicalDS</jndi-name>
</resource-description>

web.xml

<resource-ref>
  <description>A logical reference to the datasource - mapped in deployment plan</description>
  <res-ref-name>jdbc/LogicalDS</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

plan.xml

<?xml version="1.0" encoding="UTF-8"?>
 <wls:deployment-plan xmlns:wls="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_1_4.xsd" global-variables="true">
 <!--weblogic-version:10.3.5-->
 <wls:application-name>mosaic.ear</wls:application-name>
 <wls:variable-definition>
    <wls:variable>
        <wls:name>datasource_name</wls:name>
        <wls:value xsi:nil="true"></wls:value>
        <wls:description>The name of the datasource to map to the mosaic application</wls:description>
    </wls:variable>
    <wls:variable>
        <wls:name>new_context_root</wls:name>
        <wls:value xsi:nil="true"></wls:value>
        <wls:description>URL to deploy Mosaic at</wls:description>
    </wls:variable>
 </wls:variable-definition>
<wls:module-override>
    <wls:module-name>mosaic.war</wls:module-name>
    <wls:module-type>war</wls:module-type>
    <wls:module-descriptor>
        <wls:root-element>weblogic-web-app</wls:root-element>
        <wls:uri>WEB-INF/weblogic.xml</wls:uri>
        <wls:variable-assignment>
            <wls:name>new_context_root</wls:name>
            <wls:xpath>/weblogic-web-app/context-root</wls:xpath>
            <wls:operation>replace</wls:operation>
        </wls:variable-assignment>
        <wls:variable-assignment>
            <wls:description>Data source for mosaic application</wls:description>
            <wls:name>datasource_name</wls:name>
            <wls:xpath>/weblogic-web-app/resource-env-description/resource-env-ref-name</wls:xpath>
            <wls:operation>replace</wls:operation>
        </wls:variable-assignment>
        <wls:variable-assignment>
            <wls:name>datasource_name</wls:name>
            <wls:xpath>/weblogic-web-app/resource-description/[res-ref-name="jdbc/LogicalDS"]/jndi-name</wls:xpath>
            <wls:operation>replace</wls:operation>
        </wls:variable-assignment>
    </wls:module-descriptor>
  </wls:module-override>
</wls:deployment-plan>

デプロイメント プランを使用しても何も起こらず、管理コンソールのデプロイメント プラン設定画面に変数が表示されません。私が理解していることから、デプロイ プランでこれらの変数が null であることを指定しているため、少なくともこれらの変数を求められるはずです。

WLST を使用してツリーを参照すると、ランタイム コンフィグレーションがデプロイメント記述子の値のままであることがわかります。

管理コンソールの [全般] タブで展開計画が使用されていることを確認しました。

ここで私が間違っていることを誰かが見つけるのを手伝ってくれますか?

4

1 に答える 1

3

「datasource_name」変数を2回置き換えているようです。それは意図されていますか?xpathが正しくないようです:

resource-description /[res-ref-name=など。

それは次のようになります:

resource-description[res-ref-name=など。

私の提案は、一度に1つのことを変更することです。たとえば、最初にWebアプリのコンテキストを変更し、テストします。Webアプリのコンテキストは管理コンソールでも設定できるため、そこに値が表示されます。

展開計画に関する優れた記事はほとんどありません。

https://blogs.oracle.com/jamesbayer/entry/11gr1_update_and_a_deployment

http://m-button.blogspot.com/2008/08/how-to-use-deployment-plan.html

優れたリソースマッピングドキュメント:

http://docs.oracle.com/cd/E15523_01/web.1111/e13737/packagedjdbc.htm (下部の図を探してください)。

あなたの変数は「置換」または「定義」ですか?

于 2012-06-28T18:48:23.067 に答える