我的战争中包含的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
?