首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么weblogic不使用我的部署计划?

为什么weblogic不使用我的部署计划?
EN

Stack Overflow用户
提问于 2012-05-15 18:54:35
回答 1查看 8.1K关注 0票数 3

我在weblogic中尝试调整应用程序的部署设置时遇到了一些问题。我觉得我想要做的事情应该很简单,但它并没有像预期的那样工作。

我只是尝试覆盖weblogic.xml中的上下文根和数据源的JNDI名称,因此这两者都可以在部署时配置。

我已经从ear文件中删除了application.xml,所以这应该不会影响覆盖。

到目前为止,我所拥有的:

weblogic.xml:

代码语言:javascript
复制
<context-root>mosaic</context-root>

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

web.xml

代码语言:javascript
复制
<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

代码语言:javascript
复制
<?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>

当我使用部署计划时,没有发生任何事情,并且管理控制台中的部署计划配置屏幕下也没有出现任何变量。据我所知,至少应该要求我提供这些变量,因为我已经在部署计划中指定它们为空。

当我使用WLST浏览树时,我发现运行时配置只是部署描述符中的值。

我已经在管理控制台的general选项卡中验证了部署计划是否正在使用。

有人能帮我找出我哪里做错了吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-29 02:48:23

我看到您有两次"datasource_name“变量替换。这是故意的吗?您的xpath似乎不正确:

资源描述/[res-ref-name= etc.

应该是:

资源描述[res-ref-name= etc.

我的建议是一次更改一件事,例如,首先更改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 (查看底部附近的图表)。

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10599252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档