使用configureApplicationServer ANT任务安装WAR文件在Tomcat上不工作?

使用configureApplicationServer ANT任务安装WAR文件在Tomcat上不工作?,ant,war,ibm-mobilefirst,mobilefirst-server,devops,Ant,War,Ibm Mobilefirst,Mobilefirst Server,Devops,上下文: 我们在Linux系统上运行的Tomcat(v7.0.57)上使用MFPv6.3。我们希望使用MFP ANT任务来自动将MFP工件部署到我们的开发和暂存MFP服务器。具体来说,我们希望为MFP应用程序自动部署WAR文件 在安装WAR文件之前,我们使用unconfigureApplicationServer ANT任务删除WAR文件的Tomcat服务器上可能存在的任何以前的安装。然后,我们使用configureDatabase ANT任务创建两个必需的数据库。最后,我们使用configur

上下文: 我们在Linux系统上运行的Tomcat(v7.0.57)上使用MFPv6.3。我们希望使用MFP ANT任务来自动将MFP工件部署到我们的开发和暂存MFP服务器。具体来说,我们希望为MFP应用程序自动部署WAR文件

在安装WAR文件之前,我们使用unconfigureApplicationServer ANT任务删除WAR文件的Tomcat服务器上可能存在的任何以前的安装。然后,我们使用configureDatabase ANT任务创建两个必需的数据库。最后,我们使用configureApplicationServer ANT任务来安装/部署WAR文件

问题: 我们可以执行上述所有ANT任务(即,取消配置重新应用服务器、配置数据库、配置应用服务器),而不会出现任何错误。我们还可以在Tomcat webapps文件夹下的文件系统中看到WAR文件。但是,在此之后,尝试部署任何适配器或wlapp 文件抛出一个错误,指出必要的WAR文件不存在。我们还重新启动了Tomcat服务器,但这没有什么不同。访问MFP控制台不会显示MFP应用程序的条目。此外,如果启动configurationTool.sh工具,也不会看到运行时的条目

为了验证WAR文件没有问题,我们使用configurationTool.sh工具来部署它。使用configurationTool.sh工具部署WAR文件工作正常(尽管需要重新启动Tomcat…)

在阅读了KnowledgeCenter上的MFP文档后,我们了解到,我们可以使用ANT任务在MFP服务器(tomcat)上自动部署(卸载和安装)MFP WAR文件,只需将正确的参数传递给它们即可。我们还希望,无论何时安装或更新WAR文件,都不需要重新启动服务器(tomcat)

对可能出现的问题有什么看法吗?谢谢

代码: 我们使用Gradle调用不同的ANT任务:

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."
}

task uninstallMFPArtifacts这是一个随机猜测,但很可能的错误是MobileFirst管理已使用“environmentID”(服务器配置工具默认使用和environmentID)部署,而您没有在ant参数中使用它


请参阅部署运行时war后的第1步,控制台中是否有该war,或者该war是否表示没有可用的运行时?如果运行时不可用,服务器启动时可能有问题。