繁体   English   中英

如何在.war中包含ejb-jar.xml

[英]How to include ejb-jar.xml in .war

将我的战争包中的ejb-jar.xml打包到在jboss-eap-6.0.0 / maven3上使用的.ear中时,不会加载它

这是我的.ear文件包含的内容:

 -- lib/other.jar
 -- mesejbs.jar (with META-INF/ejb-jar.xml)
 -- monwar.war (with WEB-INF/ejb-jar.xml)

这是mesejbs.jar / META-INF / ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

    <interceptors>
        <interceptor>
            <interceptor-class>monpackage.ejb.log.LogInterceptor</interceptor-class>
        </interceptor>
    </interceptors>

    <assembly-descriptor>
        <interceptor-binding>
            <ejb-name>*</ejb-name>
            <interceptor-class>monpackage.ejb.log.LogInterceptor</interceptor-class>
        </interceptor-binding>
    </assembly-descriptor>
</ejb-jar>

LogInterceptor被成功调用

这是monwar.war / WEB-INF / ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

    <interceptors>
        <!-- default interceptors -->
        <interceptor>
            <interceptor-class>monpackage.web.interceptors.SecurityInterceptor</interceptor-class>
        </interceptor>
    </interceptors>

    <assembly-descriptor>
        <interceptor-binding>
            <ejb-name>*</ejb-name>
            <interceptor-class>monpackage.web.interceptors.SecurityInterceptor</interceptor-class>
        </interceptor-binding>
    </assembly-descriptor>
</ejb-jar>

但是从不调用SecurityInterceptor!

如何激活SecurityInterceptor

我了解我的问题。 在战争中,它不是ejb-jar.xml的全部。 这是对的。 这是因为ejbModule和webModule均未启用CDI。 以下是一些说明: https : //issues.jboss.org/browse/WELD-778

所以我像这样把我的ejbModule放在我的webModule中:

 -- lib/other.jar
 -- monwar.war (with WEB-INF/ejb-jar.xml)
     -- WEB-INF/lib/mesejbs.jar (with META-INF/ejb-jar.xml)

暂无
暂无

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

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