在Wildfly 10应用程序中使用jboss-client.jar的最佳方法是什么?

我有一个Wildfly 10 ear应用程序(在服务器容器中运行),它需要能够发布到另一个wildfly服务器上托管的远程队列。 为此,我将此jar从wildfly \ bin \ client文件夹复制到ear的lib文件夹中。 这工作得很好。

但是现在,在官方打包之后,当我启动Wildfly和应用程序时,我收到一条错误消息……关于这个jar的清单文件。

设置应用程序的最佳方法是什么,以便各种类加载器找到这个jar?
似乎jar可以复制到ear \ lib,但是需要对manifest文件做些什么? 什么?
我假设另一个选择是在standalone-full.xml中指定一些东西,告诉wildfly类加载器在其类路径中包含wildfly / bin / client文件夹。 那你怎么样? 第三,我假设文件只能被复制粘贴到已经在wildfly类路径中的文件夹中。
第四个选项,我假设是在我的耳朵上添加一些产生pom.xml的东西,它会将这个jar添加到ear / lib ….

最好的方法是什么?

我得到的错误是:

14:54:45,578 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."InSyncEar.ear".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."InSyncEar.ear".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment "InSyncEar.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0161: Failed to get manifest for deployment "/C:/MyComp/Purch/deployments/InSyncEar.ear/lib/jboss-client.jar" at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.getManifest(ManifestAttachmentProcessor.java:78) at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:65) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147) ... 5 more Caused by: java.util.zip.ZipException: invalid literal/lengths set at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122) at org.jboss.vfs.util.PaddedManifestStream.read(PaddedManifestStream.java:39) at java.io.InputStream.read(InputStream.java:170) at java.util.jar.Manifest$FastInputStream.fill(Manifest.java:441) at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:375) at java.util.jar.Manifest$FastInputStream.readLine(Manifest.java:409) at java.util.jar.Attributes.read(Attributes.java:376) at java.util.jar.Manifest.read(Manifest.java:199) at java.util.jar.Manifest.(Manifest.java:69) at org.jboss.vfs.VFSUtils.readManifest(VFSUtils.java:243) at org.jboss.vfs.VFSUtils.getManifest(VFSUtils.java:227) at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.getManifest(ManifestAttachmentProcessor.java 

一旦您的JMS客户端在WildFly应用程序中运行 – 您根本不需要jboss-client.jar – WildFly模块本身包含发布到另一个WildFly实例上的远程队列的所有必要依赖项。

在我们的项目中, 远程 EJB和JMS连接的最佳方法是standalone-full.xml中的以下配置:

     ... 

这允许通过那里的jms/RemoteConnectionFactory在另一个服务器上查找远程JMS连接,例如, 参见此示例 。

此外,您需要ActiveMQ特定依赖项(例如ActiveMQJMSConnectionFactory )才能发布到远程队列。
我们通过在jboss-deployment-structure.xml中添加相应的模块作为依赖项来完成它:

    

有关详细信息,请参阅WildFly中的类加载 。

而已。