当我尝试通过 ant 在本地主机 MobileFirst 服务器上部署适配器时,它抛出 404 notfound 错误。有没有人遇到这个问题.请帮忙
我的蚂蚁构建.xml脚本:
构建.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="deployadp" name="sample">
<property environment="env" />
<property name="ECLIPSE_HOME" value="../../Downloads/eclipse/" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.7" />
<property name="source" value="1.7" />
<taskdef resource="com/worklight/ant/deployers/antlib.xml">
<classpath>
<!-- Change this to the path of the worklight-ant-deployer.jar available in the
server installation folder -->
<pathelement location="/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/worklight-ant-deployer.jar"/>
</classpath>
</taskdef>
<target name="deployadp" >
<echo message=" deploy adapter start" />
<wladm url="http://localhost:10080/sample" secure="false" user="admin"
password="admin">
<deploy-adapter runtime="sample"
file="/Users/rahulc/workspace2/sample/bin/sample2.adapter" />
</wladm>
<echo message="deploy adapter end" />
</target>
</project>
构建后出现错误:
Buildfile: /Users/rahulc/workspace2/sample/build.xml
deployadp:
[echo] deploy adapter start
[wladm] Error accessing http://localhost:10080/sample/management-apis/1.0/runtimes/sample/adapters?locale=en_US: HTTP/1.1 404 Not Found
BUILD FAILED
/Users/rahulc/workspace2/sample/build.xml:19: com.ibm.worklight.admin.restclient.RESTException: Error accessing http://localhost:10080/sample/management-apis/1.0/runtimes/sample/adapters?locale=en_US: HTTP/1.1 404 Not Found
at com.ibm.worklight.admin.restclient.RESTClient.getResponse(RESTClient.java:1189)
at com.ibm.worklight.admin.restclient.RESTClient.getPOSTResponse(RESTClient.java:1326)
at com.ibm.worklight.admin.restclient.RESTClient.getPOSTFileResponse(RESTClient.java:1348)
at com.ibm.worklight.admin.commands.DeployAdapter.getResponse(DeployAdapter.java:41)
at com.ibm.worklight.admin.restclient.ActionClient.execute(ActionClient.java:85)
at com.ibm.worklight.admin.ant.types.AbstractActionElement.executeCommand(AbstractActionElement.java:76)
at com.ibm.worklight.admin.ant.types.ActionElement.executeCommands(ActionElement.java:43)
at com.ibm.worklight.admin.ant.WladmTask.executeCommands(WladmTask.java:533)
at com.ibm.worklight.admin.ant.WladmTask.execute(WladmTask.java:382)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
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:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
我查看了 IBM 网站,发现很少有这样的解决方法:
http://www-01.ibm.com/support/docview.wss?uid=swg21680420
但这对我也有帮助。
这部分对我来说看起来是错误的:
<target name="deployadp" >
<echo message=" deploy adapter start" />
<wladm url="http://localhost:10080/sample" secure="false" user="admin"
password="admin">
<deploy-adapter runtime="sample"
file="/Users/rahulc/workspace2/sample/bin/sample2.adapter" />
</wladm>
<echo message="deploy adapter end" />
</target>
您指向wladm
元素中的"示例"。您应该指向"worklightadmin"。
您的运行时(项目名称("sample"与 wladm 不同(也不应该(。
<wladm url="http://localhost:10080/sample" secure="false" user="admin" password="admin">
我输入的网址是错误的。以下对我有用
<wladm url="http://localhost:10080/worklightadmin" secure="false" user="admin" password="admin">
感谢您的帮助,Idan.你非常乐于助人。