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

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

问题描述

我有一个Wildfly 10 ear应用程序(在服务器容器中运行),它需要能够发布到另一个wildfly服务器上托管的远程队列。为此,我将此jar从wildfly \ bin \client文件夹复制到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 wildfly\bin\client 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可能是复制到ear \lib,但是有关清单文件需要做些什么?什么?

我假设另一个选择是在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 ear\lib, 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客户端正在运行w在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连接 jms / RemoteConnectionFactory 那里,例如查看此示例

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中加载类以获取更多详细信息。

see Class Loading in WildFly for more details.

就是这样。

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

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