Jboss EAP 7-如何从部署中排除隐式模块(javax.jms)? [英] Jboss EAP 7 - How to exclude implicit modules from deployment (javax.jms)?

查看:84
本文介绍了Jboss EAP 7-如何从部署中排除隐式模块(javax.jms)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不认为我会在这里结束,但是经过大量Google和StackOverflow搜索之后,我才来到这里.

I didn't think I would end up here but after a lot of Google and StackOverflow searches here I'm.

这是我的确切问题,除了我付不起代码修改的费用.

This is my exact problem except that I can't afford to make code changes.

我要部署的WAR包括一个JMS库(即 javax.jms ,我不能排除它形成WAR.)默认情况下,Jboss EAP 7已经加载了该库. jar的路径类似于此jboss/modules/system/layers/base/javax/jms/api/ain/jboss-jms-api_2.0_spec-1.0.0.Final-redhat-1.jar.由于加载了相同类的两个不同版本,因此我得到了 ClassCastException .

The WAR I'm trying to deploy includes a JMS library (i.e. javax.jms, which I cannot exclude form the WAR.) which is already loaded by Jboss EAP 7 by default. The path to jar is something like this jboss/modules/system/layers/base/javax/jms/api/ain/jboss-jms-api_2.0_spec-1.0.0.Final-redhat-1.jar. Because of this two different versions of the same classes loading I'm getting ClassCastException.

org.apache.activemq-ra.ActiveMQConnectionFactory cannot to be cast to javax.jms.ConnectionFactory

因此,我希望Jboss 加载 javax.jms ,以便我的应用程序可以使用WAR附带的JAR.

So, I want Jboss to NOT load javax.jms so that my application can use the JAR included with the WAR.

因此,我想知道是否有任何方法可以全局(对于所有WAR部署)排除该模块.

So, I was wondering if there was any way to exclude the module globally (for all WAR deployments).

在每个部署中排除它也会起作用.而且我确实知道可以使用 jboss-deployment-structure.xml 实现它,但是我无法使其正常工作.

Excluding it per deployment would work too. And I do realize it can be acheivd using jboss-deployment-structure.xml but I can't get it to work.

这是我尝试过的:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure
        xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="javax" />
            <subsystem name="javax.jms" />
        </exclude-subsystems>
    </deployment>
</jboss-deployment-structure>

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure
    xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclusions>
            <module name="javax" />
            <module name="javax.jms" />
            <module name="javax.jms.api" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

我将文件放在 WEB-INF 目录中.没用它仍然从Jboss EAP的 modules 文件夹中加载JMS类.那么,如何正确执行此操作?

I placed the file in WEB-INF directory. It didn't work. It still loaded the JMS class from modules folder of Jboss EAP. So, how do I correctly do this?

推荐答案

正确的jboss-deployment-structure.xml在这里:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="messaging-activemq"></subsystem>
        </exclude-subsystems>
        <exclusions>
            <module name="javax.jms.api"></module>
        </exclusions>
    </deployment>
</jboss-deployment-structure>

通过这种方式,您既可以排除消息传递子系统又可以排除JMS api.

This way you exclude both messaging subsystem and the JMS api.

这篇关于Jboss EAP 7-如何从部署中排除隐式模块(javax.jms)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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