简体   繁体   English

在还位于EAR内的JAR内时,WildFly无法识别EJB计时器(@Schedule)

[英]EJB Timer (@Schedule) not recognized by WildFly when inside a JAR which is also inside an EAR

I have an EAR file with 3 WARs and some common dependencies within lib/ folder. 我有一个包含3个WAR的EAR文件,以及lib /文件夹中的一些常见依赖项。 One of those dependencies has an EJB with a scheduled method, but it seems that the server is not recognizing it. 这些依赖项之一具有带调度方法的EJB,但是服务器似乎无法识别它。 No evidence in log, no code executed. 日志中没有证据,没有执行代码。

But when I deploy a simple war with the same jar within WEB-INF/lib, it works. 但是,当我在WEB-INF / lib中使用相同的jar部署简单的战争时,它可以工作。 I've already tried to package the jar as an ejb-jar with the maven plugin, but no success at all. 我已经尝试过使用maven插件将jar打包为ejb-jar,但没有成功。

Any ideas on what must be going on? 关于必须怎么办的任何想法?

Jars in the lib directory of an EAR are not considered to be EJB jars and their content is not considered at deployment time in that respect. EAR的lib目录中的jar不视为EJB jar,因此在部署时不考虑其内容。 The lib directory only exists to make it easier to provide library jars whose classes are automatically made visible to all the modules in an EAR file. lib目录的存在仅是为了使提供库jar更加容易,这些jar jar的类对于EAR文件中的所有模块都是自动可见的。

Your EAR file contains a META-INF/application.xml file that lists out the various modules that it contains. 您的EAR文件包含一个META-INF / application.xml文件,该文件列出了它包含的各种modules Prior to Java EE 6, only ejb-modules were considered for potential EJBs. 在Java EE 6之前,仅考虑将ejb模块用于潜在的EJB。 Java EE 6 and newer added web-modules to that list. Java EE 6和更高版本将Web模块添加到该列表。 All jars within a web-module's WEB-INF/lib directory are considered to be part of the web-module, even if they contain ejb-jars. Web模块的WEB-INF / lib目录中的所有jar都被认为是Web模块的一部分,即使它们包含ejb-jar。 Any ejb-jar.xml files found within a web-module are merged together. 在网络模块中找到的所有ejb-jar.xml文件都将合并在一起。 This applies even if the web-module is deployed as a standalone WAR file. 即使将Web模块部署为独立的WAR文件,这也适用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM