如何在 batchManager 提交命令调用中识别 Liberty 中的批处理应用程序名称

How to identify the batch application name in Liberty on the batchManager submit command invocation

我是 Liberty 的新手,正在试用 Batch (352) 功能。我无法通过搜索引擎或 Whosebug 找到这个问题,所以我显然遗漏了一些明显的东西......

我在 Liberty 8.5.5.9 中创建了一个简单的测试应用程序。它具有结构:

EAR 已通过通常的 Add/Remove 菜单选择添加到服务器。

我现在正尝试使用以下命令从命令行提交作业:

batchManager submit --batchManager=localhost:9443 --user=<> --password=<> --trustSslCertificates --jobXMLName=TestProcessor.xml --applicationName=testbatch

然后我收到一条消息 (t运行cated):

Error: Server returned HTTP response code: 500 for URL: https://localhost:9443/ibm/api/batch/jobinstances: [Error 500:  com.ibm.ws.jbatch.rest.bridge.BatchContainerAppNotFoundException: Failed to load the application context for application testbatch#testbatch.war. Verify the application is installed.

我已经尝试过 testbatch、testbatchEAR、testbatchWAR,但是从消息的 "testbatch#testbatch.war" 部分来看,它似乎只是对 EAR 和 [=54= 使用了相同的名称],我认为这是不可能的,是吗?

我漏掉了哪一部分?它一定就在我面前,但我找到的每个示例或解决方案都在使用裸体 WAR,这是我做不到的。在自由的任何地方我可以找到应用程序名称吗?我应该在某处定义名称吗(server.xml?)?

提前致谢!

* 编辑:附加信息 *

如果我 运行 从 Eclipse 运行 配置 > Java EE 批处理作业部分,它会 运行 它,并执行 batchManager listJobs 显示应用程序命名为 testbatchEAR#testbatchWAR.war.

所以我想我真正的问题是如何将这个名称放入 batchManager.bat 的 --applicationName 选项中?它需要并从中生成#.war。我尝试输入 listJobs 中的全名,但它不允许使用“#”字符...

在 EAR 应用程序中同时指定 --applicationName 和 --moduleName

(如您所见),如果批处理应用程序打包在 EAR 中的 WAR 中,您通常必须同时指定 --applicationName--模块名称,例如:

batchManager submit --batchManager=localhost:9443 ... --applicationName=testbatch --moduleName=testbatchWAR.war ...

在 WAR 应用程序中仅指定 --applicationName

您可能已经看到过仅需要 --applicationName 的示例,例如here.

此语法适用于批处理应用程序打包为 WAR(但不是 EAR 中的 WAR)的情况。

这里的“utility project”名称不相关,没有EJB所以也没有--componentName相关。

文档确实在 here 部分中提到了这一点:

POST /ibm/api/batch/jobinstances

...

The applicationName identifies the batch application. It is required unless moduleName is specified, in which case the applicationName is derived from the moduleName by trimming off the .war or .jar suffix of the moduleName. For example, if you provide no applicationName and moduleName=SimpleBatchJob.war, then applicationName defaults to SimpleBatchJob.

The moduleName identifies the module within the batch application that contains the job artifacts, such as the JSL. The job is submitted under the module's component context. The moduleName is required unless applicationName is specified, in which case the moduleName is derived from the applicationName by appending .war to the applicationName. For example, if you provide applicationName=SimpleBatchJob and no moduleName, then moduleName defaults to SimpleBatchJob.war.

但是如果您在 WDT 这样的工具中同时创建 Web 项目和 EAR 项目,您将无法轻易地为项目指定相同的名称(因为它们会发生冲突),因此这实际上只在没有单独的 EAR 项目的情况下才有效。当EAR项目存在时,这两个参数都需要。