当我尝试通过ant在本地主机mobilefirst服务器上部署适配器时,它会抛出404 notfound error.did任何人都遇到此问题。请帮助
我的ant build.xml脚本:
在build.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
但是这个对我也有帮助。
答案 0 :(得分:1)
这部分对我来说不对:
<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
元素中的“sample”。你应该指向“worklightadmin”。
你的运行时(项目名称)“样本”,不(并且不应该)与wladm相同。
<wladm url="http://localhost:10080/sample" secure="false" user="admin" password="admin">
答案 1 :(得分:0)
我输入的网址错了。以下内容对我有用
<wladm url="http://localhost:10080/worklightadmin" secure="false" user="admin" password="admin">
感谢Idan的帮助。你们非常乐于助人。