我有一个 Wildfly 10 Ear 应用程序(在服务器容器中运行),它需要能够发布到另一个 Wildfly 服务器上托管的远程队列。为了实现这一点,我将这个 jar 从 wildfly\bin\client 文件夹复制到 Ear 的 lib 文件夹中。效果很好。
但是现在,在正式打包之后,当我启动 Wildfly 和应用程序时,我收到一条错误消息......有关此 jar 的 list 文件的信息。
设置应用程序以便各种类加载器可以找到该 jar 的最佳方法是什么?
看来jar可以复制到ear\lib,但是需要对 list 文件做一些事情?什么?
我假设另一个选择是在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.<init>(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 中进行以下配置:
<subsystem xmlns="urn:jboss:domain:ee:4.0">
<global-modules>
<module name="org.jboss.remote-naming"/>
</global-modules>
...
这允许通过 jms/RemoteConnectionFactory 查找另一台服务器上的远程 JMS 连接,例如see this example .
此外,您还需要 ActiveMQ 特定依赖项(例如ActiveMQJMSConnectionFactory)才能发布到远程队列。
我们通过在jboss-deployment-struct.xml中添加相应的模块作为依赖项来实现:
<dependencies>
<module name="org.apache.activemq.artemis" export="true"/>
</dependencies>
参见Class Loading in WildFly了解更多详情。
就是这样。
关于java - 在 Wildfly 10 应用程序中使用 jboss-client.jar 的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47417564/