使用 ant-cli 部署生产 mobilefirst 7.1 环境时出现 404 错误

Posted

技术标签:

【中文标题】使用 ant-cli 部署生产 mobilefirst 7.1 环境时出现 404 错误【英文标题】:404 error deploying production mobilefirst 7.1 environment with ant-cli 【发布时间】:2016-02-23 14:07:39 【问题描述】:

我正在尝试使用与本地开发人员服务器配合良好的 ant 脚本进行部署,当我转向生产时购买,这是我遇到的错误:

deploy-environments:
     [echo] **************Deploying all environments*************
    [wladm] Error accessing http://127.0.0.1:9080/worklightadmin/management-apis/1.0/runtimes/RUNTIME/applications?locale=en_US: HTTP/1.1 404 Not Found

BUILD FAILED
/opt/IBM/Compilacion/scripts/app/build.xml:44: com.ibm.worklight.admin.restclient.RESTException: Error accessing http://127.0.0.1:9080/worklightadmin/management-apis/1.0/runtimes/RUNTIME/applications?locale=en_US: HTTP/1.1 404 Not Found
    at com.ibm.worklight.admin.restclient.RESTClient.getResponse(RESTClient.java:1282)
    at com.ibm.worklight.admin.restclient.RESTClient.getResponseWithTimeout(RESTClient.java:1359)
    at com.ibm.worklight.admin.restclient.RESTClient.getPOSTResponse(RESTClient.java:1477)
    at com.ibm.worklight.admin.restclient.RESTClient.getPOSTFileResponse(RESTClient.java:1499)
    at com.ibm.worklight.admin.commands.DeployApp.getResponse(DeployApp.java:41)
    at com.ibm.worklight.admin.restclient.ActionClient.execute(ActionClient.java:93)
    at com.ibm.worklight.admin.ant.types.AbstractActionElement.executeCommand(AbstractActionElement.java:77)
    at com.ibm.worklight.admin.ant.types.ActionElement.executeCommands(ActionElement.java:43)
    at com.ibm.worklight.admin.ant.WladmTask.executeCommands(WladmTask.java:734)
    at com.ibm.worklight.admin.ant.WladmTask.execute(WladmTask.java:473)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:853)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Total time: 3 seconds

这是我在 buil.xml 中配置部署的部分

 <target name="deploy-environments">
  <echo message="**************Deploying all environments*************"/> 
    <wladm url="$wl.server.url.deploy$wl.admserverpath" user="$wl.user" password="$wl.pass" secure="false">
      <deploy-app runtime="$wl.runtime" file="$app.output.folder/APP_NAME-android-1.0.wlapp"/>
    </wladm>
  </target> 

【问题讨论】:

【参考方案1】:

$wl.admserverpath 变量错误,worklight 管理员更改为 wladmin

【讨论】:

您使用的新网址是什么?

以上是关于使用 ant-cli 部署生产 mobilefirst 7.1 环境时出现 404 错误的主要内容,如果未能解决你的问题,请参考以下文章

在生产环境使用Docker部署应用

使用 Wordpress 部署 Vue 生产环境

生产环境部署部署项目到生产环境Linux下

如何使用 webpack 捆绑 puppeteer 进行生产部署?

如何使用 webpack 和 angular2 为生产部署代码

FastAPI环境部署