【问题标题】:How to remote deploy an application in weblogic?如何在 weblogic 中远程部署应用程序?
【发布时间】:2023-03-05 21:07:01
【问题描述】:

我有两台计算机,我不想在我的开发计算机上安装 weblogic 和 oracle,它们占用太多内存,问题是我如何将开发计算机上的应用程序部署到另一台具有 oracle 和 weblogic 的免费计算机上安装?我正在使用 weblogic 10.3。

【问题讨论】:

  • 澄清一下:您想从车间内部部署还是从 ant/命令行/控制台部署?

标签: deployment weblogic weblogic-10.x


【解决方案1】:

我不想在我的开发计算机上安装 weblogic 和 oracle,它们消耗太多内存

即使不运行?

如何将我的应用程序从我的开发机器部署到另一台安装了 oracle 和 weblogic 的机器

您可以使用以下工具:

其他选项(如果您使用的是 maven):

【讨论】:

  • 做了一些测试 weblogic maven 插件这个答案是旧的 2010 有什么新消息吗?!
  • 这些选项是否允许自动将应用程序部署到远程 WebLogic 而无需在本地安装整个 WebLogic 包?
【解决方案2】:

如果您使用 Ant 任务,请务必包含 upload="true" 参数。这会将 war、ear 文件复制到远程 weblogic 系统,因此您不必这样做。

【讨论】:

    【解决方案3】:

    Wldeploy 就像一个魅力。配置如下。

        <target name="deploy">
            <wl.deploy.app archivepath="${ear.path}" name="${ear.deployment.name}"
                       wladminuser="${weblogic.admin.user}" wlserverhost="${weblogic.server.host}"
                       wlserverport="${weblogic.server.port}" wlservername="${test.server.name}"
                       wladminpassword="${weblogic.admin.password}"/>
        </target>
        <macrodef name="wl.deploy.app">
         <attribute name="archivepath"/>
         <attribute name="name"/>
         <attribute name="wladminuser"/>
         <attribute name="wladminpassword"/>
         <attribute name="wlserverhost"/>
         <attribute name="wlserverport"/>
         <attribute name="wlservername"/>
         <attribute name="sharedlibrary" default="false"/>
    
         <sequential>
            <wldeploy action="deploy" verbose="true" debug="true"
                      name="@{name}"
                      library="@{sharedlibrary}"
                      remote="true"
                      upload="true"
                      source="@{archivepath}"
                      user="@{wladminuser}" password="@{wladminpassword}"
                      adminurl="t3://@{wlserverhost}:@{wlserverport}"
                      targets="@{wlservername}"/>
         </sequential>
     </macrodef>
    

    只需正确指定所有属性,无论是本地主机还是远程机器。它应该可以工作。

    【讨论】:

      【解决方案4】:

      您可以使用 REST 接口部署 WebLogic 应用程序(我不确定它是否适用于所有 WLS 版本)。

      必须通过管理控制台启用 REST 接口(需要重新启动服务器):

      Settings / Configuration / General [Advanced] / Enable RESTful Management Services
      

      其实是一个基于 JSON 的 REST 接口,但是如果你需要上传一些东西,则使用 multipart/form-data 来代替。

      它的工作原理是这样的(在 WLS v12.2.1.4 上测试):

      curl -X POST 'http://<server>:7001/management/weblogic/latest/edit/appDeployments' 
      -u <username>:<password>
      --header 'Content-Type: multipart/form-data'
      --header 'X-Requested-By: <any_string>'
      --form 'sourcePath=@<local_path_to_war_file>'
      --form 'model={"name": "<application_name>"}'
      --form 'planPath=@<local_path_to_plan_xml_file>'
      

      不要忘记 X-Requested-By。 WebLogic 需要作为 CSRF 保护。


      WLS 版本 14 的 API 文档 https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/wlrer/index.html

      WLS 版本 12 的 API 文档:https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/wlrem/index.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-03-12
        • 2014-09-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多