Search code examples
antibm-mobilefirstmobilefirst-adapters

MobileFirst 6.3 adapter deploy through ant throws error


when i am trying to deploy adapter on the local host mobilefirst server through ant it throws 404 notfound error.did any one got this issue .Please help

My ant build.xml script :

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>

Error I am getting after build:

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)

I looked into Ibm website and found few work arounds like this:

http://www-01.ibm.com/support/docview.wss?uid=swg21680420

But this dint help me as well.


Solution

  • This section looks wrong to me:

    <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>
    

    You are pointing to "sample" in the wladm element. You should point to "worklightadmin" instead.

    Your runtime (projet name) "sample", is not (and should not be) the same as the wladm.

    <wladm url="http://localhost:10080/sample" secure="false" user="admin" password="admin">