2012-05-15 30 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 (寻找接近底部图)。

您的变量是“替换”还是“定义”?