使用module标签加载Artemis资源适配器失败求助
咱们一步步来解决这个问题。你现在想要在WildFly的resource-adapter子系统里用module标签替代archive来部署Artemis资源适配器,但遇到了WFLYJCA0073错误,核心原因是系统找不到META-INF/ra.xml文件。结合你提供的配置和尝试的操作,我来帮你排查问题:
首先,你的module.xml里有两个关键错误
- 拼写错误:
<inclue path="META-INF/ra.xml" />里的inclue应该是include,这个低级错误会导致系统无法正确导出ra.xml文件,自然找不到它。 - 多余的资源根目录配置:你单独加了
<resource-root path="META-INF"/>,但实际上artemis-ra-2.6.0.jar本身已经包含了META-INF/ra.xml文件,单独配置这个目录反而会干扰类加载逻辑,导致系统找不到正确的ra.xml路径。
为什么官方模块能正常工作?
WildFly自带的Artemis RA模块只把jar作为资源根目录,jar内部自带META-INF/ra.xml,同时模块的exports配置正确导出了这个文件和RA相关的类,所以资源适配器子系统能正常加载它。
修正后的module.xml配置
把你的module.xml改成下面这样,修复拼写错误并调整资源和导出配置:
<module name="org.apache.activemq.artemis.ra" slot="2.6.0" xmlns="urn:jboss:module:1.5"> <properties> <property name="jboss.api" value="private"/> </properties> <resources> <!-- 只保留jar作为资源根,它内部已经包含META-INF/ra.xml --> <resource-root path="artemis-ra-2.6.0.jar"/> </resources> <dependencies> <module name="io.netty" slot="4.1.24"/> <module name="javax.api"/> <module name="javax.jms.api"/> <module name="javax.resource.api"/> <module name="org.apache.activemq.artemis" slot="2.6.0"/> <module name="org.jboss.as.transactions"/> <module name="org.jboss.jboss-transaction-spi"/> <module name="org.jboss.jts"/> <module name="org.jboss.logging"/> <!-- allow to create a RA that connects to a remote Artemis server --> <module name="org.wildfly.naming-client" optional="true"/> <module name="org.jgroups" slot="3.6.13"/> <module name="org.wildfly.extension.messaging-activemq" services="import"/> </dependencies> <exports> <!-- 修正拼写错误,确保导出ra.xml --> <include path="META-INF/ra.xml"/> <!-- 导出RA相关的类,让资源适配器子系统能加载到 --> <include path="org/apache/activemq/artemis/ra/**"/> </exports> </module>
确认模块目录结构
确保你的模块目录结构正确,对应slot="2.6.0"的目录应该是:
$WILDFLY_HOME/modules/org/apache/activemq/artemis/ra/2.6.0/ ├── module.xml # 上面修正后的配置文件 └── artemis-ra-2.6.0.jar
额外的检查步骤
- 验证依赖模块:确认所有依赖的模块(比如
io.netty:4.1.24、org.apache.activemq.artemis:2.6.0、org.jgroups:3.6.13)都已经正确创建并放置在WildFly的modules目录下,没有版本不匹配的情况。 - 日志排查:如果还是报错,可以开启WildFly的JCA调试日志,在
standalone-full-ha.xml的logging子系统里添加:
重启后查看更详细的加载日志,定位具体的类加载或文件找不到的问题。<logger category="org.jboss.jca"> <level name="DEBUG"/> </logger> - 检查resource-adapter配置:确保你的resource-adapter里的
module标签的id和slot和模块配置完全一致:<module slot="2.6.0" id="org.apache.activemq.artemis.ra"/>
总结
核心问题出在module.xml的拼写错误和多余的资源配置上,修正后系统就能正确找到ra.xml文件并加载RA模块了。另外要确保模块目录结构和依赖模块都没问题,这样就能用module标签替代archive完成部署,避免运维误操作。
内容的提问来源于stack exchange,提问作者will
相关产品推荐
相关产品推荐

