0
votes

Context: We are using MFP v6.3 on Tomcat (v7.0.57) running on a Linux system. We’d like to use the MFP ANT tasks to automate the deployment of MFP artifacts to our development and staging MFP servers. Specifically, we want to automate the deployment of the WAR file for MFP applications.

Before installing the WAR file, we use the unconfigureApplicationServer ANT task to remove any previous installations that may exist on the Tomcat server of the WAR file. Then we use the configureDatabase ANT task to create the two required databases. Finally, we use the configureApplicationServer ANT task to install/deploy the WAR file.

Problem: We can execute all of the above ANT tasks (i.e., unconfigureApplicationServer, configureDatabase, configureApplicationServer) without any errors. We can also see the WAR file on the file system under the Tomcat webapps folder. However, after this, attempting to deploy any adapters or wlapp files throws an error stating that the necessary WAR file does not exist. We also restarted the Tomcat server but this made no difference. Accessing the MFP console does not show an entry for the MFP app. Also, if we launch the configurationTool.sh tool, we don’t see an entry for the runtime either.

To verify that there is not a problem with the WAR file, we used the configurationTool.sh tool to deploy it. Using the configurationTool.sh tool to deploy the WAR file works just fine (though a Tomcat restart was needed…).

After reading the MFP documentation on the KnowledgeCenter, we understood that we could use ANT tasks to automate the deployment (uninstall and install) of MFP WAR files on the MFP server (tomcat) by simply passing the right parameters to them. We are also expecting that a server (tomcat) restart is not required whenever a WAR file is installed or updated.

Any ideas on what could be wrong? Thanks.

Code: We are using Gradle to invoke the different ANT tasks:

task uninstallMFPArtifacts << {
    ant.unconfigureApplicationServer(contextRoot: contextRoot) {
        "project"(warfile: warFile)
        "applicationserver"() {
            "tomcat"(installdir: installDir)
        }
        "database"(kind: "Worklight") {
            "mysql"(database: dbPrefix + '_MFP',
                server: "localhost",
                user: dbUser,
                password: dbUser)
            "driverclasspath"() {
                "pathelement"(location : mySQLJarPath)
            }
        }        
        "database"(kind: "WorklightReports") {
            "mysql"(database: dbPrefix + '_MFP_RPT',
                server: "localhost",
                user: dbUser,
                password: dbUser)
            "driverclasspath"() {
                "pathelement"(location : mySQLJarPath)
            }
        }
    }
    println "Uninstalled: $appShortName"
}

task setupMFPDBs << {
    // Create databases
    ant.configureDatabase(kind: "Worklight") {
        "mysql"(database: dbPrefix + '_MFP',
            server: "localhost",
            user: dbUser,
            password: dbUser) {
            "dba"(user: dbaUser,
                password: dbaPassword)
            "client"(hostname: 'localhost')
            "client"(hostname: '127.0.0.1')
           }
        "driverclasspath"() {
            "pathelement"(location : mySQLJarPath)
        }
    }    
    println "Created $dbPrefix" + '_MFP database.'

    ant.configureDatabase(kind: "WorklightReports") {
        "mysql"(database: dbPrefix + '_MFP_RPT',
            server: "localhost",
            user: dbUser,
            password: dbUser) {
            "dba"(user: dbaUser,
                password: dbaPassword)
            "client"(hostname: 'localhost')
            "client"(hostname: '127.0.0.1')
        }
        "driverclasspath"() {
            "pathelement"(location : mySQLJarPath)
        }
    }
    println "Created $dbPrefix" + '_MFP_RPT database.'
}

task deployMFPArtifacts << {

    // Install WAR file
    ant.configureApplicationServer(contextRoot: contextRoot) {
        "project"(warfile: warFile)
        "applicationserver"() {
            "tomcat"(installdir: installDir)
        }
        "database"(kind: "Worklight") {
            "mysql"(database: dbPrefix + '_MFP',
                server: "localhost",
                user: dbUser,
                password: dbUser)
            "driverclasspath"() {
                "pathelement"(location : mySQLJarPath)
            }
        }        
        "database"(kind: "WorklightReports") {
            "mysql"(database: dbPrefix + '_MFP_RPT',
                server: "localhost",
                user: dbUser,
                password: dbUser)
            "driverclasspath"() {
                "pathelement"(location : mySQLJarPath)
            }
        }
    }
    println "Installed $warFile file."
}
1
After you deploy the runtime war is it available in the console or does it says that there is no runtime available ? Maybe there is something wrong in the server startup if the runtime is not available.Leandro David

1 Answers

0
votes

This is a random guess, but a very possible error could be that the MobileFirst Administration has been deployed with an 'environmentID' (the Server Configuration Tool uses and environmentID by default) , and you don't use it in your ant parameters.

See step 1 of https://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.deploy.doc/devref/t_ant_tasks_configure_appserver.html