2012-05-15 32 views
2

我在嘗試在weblogic中調整應用程序的部署設置時遇到了一些麻煩。我覺得我正在努力做的事情應該很簡單,但並不像預期的那樣工作。爲什麼weblogic不使用我的部署計劃?

我只是想覆蓋weblogic.xml中的上下文根和數據源的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> 

什麼也沒有發生部署計劃,並沒有VA在管理控制檯中的部署計劃配置屏幕下會顯示可用的頁面。根據我的理解,我至少應該被要求提供這些變量,因爲我已經指定它們在部署計劃中爲空。

當我使用WLST瀏覽樹時,發現運行時配置只是作爲部署描述符中的值保留。

我已驗證部署計劃正在管理控制檯的常規選項卡中使用。

任何人都可以幫我找出我在這裏做錯了嗎?

+0

我從來沒有把它出現在控制檯中。 (也許幾年前)。嘗試刪除'xsi:nil'並提供一個值,即使你沒有在管理控制檯中看到它,它也會提取它。 –

回答

2

我看到你有兩次「datasource_name」變量替換。這是打算嗎?你的XPath似乎是不正確的:

資源描述/ [RES-REF-NAME = 等

它應該是:

資源描述[RES-REF-NAME = 等。

我的建議是在一次更改一件事情,例如,首先在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 (尋找接近底部圖)。

您的變量是「替換」還是「定義」?