0
我ejb-jar.xml中包含在我的戰爭沒有加載ejb-jar.xml中,當我打包的程序.ear ,我在的jboss-EAP-6.0.0裏面使用/ maven3如何包括的.war
這裏是我的.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
?
看看這裏http://stackoverflow.com/questions/3336727/ejb-3-1 -application-deployed-as-war-only-what-about-ejb-jar-xml – rdcrng
是的,但我的ejb-jar.xml位於WEB-INF目錄中!如果我打包.war,一切都是正確的。但我需要打包耳朵:( – jboz
對不起,如果我誤解了。 – rdcrng