在 Wildfly 10 应用程序中使用 jboss-client.jar 的最佳方法是什么? [英] what's the best way to use the jboss-client.jar in a Wildfly 10 application?

查看:27
本文介绍了在 Wildfly 10 应用程序中使用 jboss-client.jar 的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Wildfly 10 ear 应用程序(在服务器容器中运行),它需要能够发布到托管在另一台 Wildfly 服务器上的远程队列.为此,我将这个 jar 从 wildflyinclient 文件夹复制到了 ear 的 lib 文件夹中.效果很好.

I have a Wildfly 10 ear application (runs in the server container) which needs to be able to publish to a remote queue hosted on another wildfly server. To accomplish that I copied this jar from the wildflyinclient folder into the ear's lib folder. That worked fine.

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

But now, after official packaging, when i start Wildfly and the application, I get an error message... something about the manifest file of this jar.

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

What's the best way to set up the apllication so that this jar is found by the various class loaders?
it seems the jar could be copied to the earlib, but something needs to be done about the manifest file? what?
i assume Another option is to specify something in the standalone-full.xml that tells the wildfly class loader to include the wildfly/bin/client folder in its classpath. How do you that? And thirdly, i assume the file can just be copy-pasted into a folder that is already in wildfly classpath.
A forth option, i assume is to add something to my ear producing pom.xml which will add this jar to the 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 实例上的远程队列的所有必要依赖项.

Once your JMS client is running within a WildFly application - you don't need for the the jboss-client.jar at all - WildFly modules by themselves contain all necessary dependencies for publishing to a remote queue on another WildFly instance.

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

In our projects the best way for remote EJB and JMS connections is the following config in the standalone-full.xml:

<subsystem xmlns="urn:jboss:domain:ee:4.0">
            <global-modules>
                <module name="org.jboss.remote-naming"/>
            </global-modules>
...

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

This allows to lookup for a remote JMS connection on another server through the jms/RemoteConnectionFactory there, e.g. see this example.

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

Additionally you need the ActiveMQ specific dependencies (e.g. ActiveMQJMSConnectionFactory) to publish to a remote queue.
We did it by adding the corresponding module as a dependency in the jboss-deployment-structure.xml:

<dependencies>
      <module name="org.apache.activemq.artemis" export="true"/>
</dependencies>

查看WildFly 中的类加载了解更多详情.

就是这样.

这篇关于在 Wildfly 10 应用程序中使用 jboss-client.jar 的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆