ejb@glassfish.java.net

Re: interceptor not invoked when declared in ejb-jar.xml and packaged in EAR/lib

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Wed, 01 Mar 2006 15:13:25 -0500

Cheng Fang wrote:

>I have this example:
>
>If I package AssemblyInterceptor.class and ejb client view classes and
>utility classes in EAR/lib/shared.jar, this interceptor is not invoked.
>There is no error anywhere. EAR/lib is the default library-directory for
>the app.
>
>If I also duplicate AssemblyInterceptor.class in ejb-jar, interceptor is
>invoked as expected.
>
Does sound like a bug. The packaging/ejb-jar.xml combo you're
describing sounds
valid to me. I'm surprised there are no errors in the logs. It's
posible there's a classloading
error somewhere that's being eaten. Please file a bug for it and we'll
take a look. Thanks.

 --ken

>
>In any case, the generated full ejb-jar.xml does contain this interceptor
>and interceptor binding.
>
>Any idea what's wrong here?
>
>//already declared in ejb-jar.xml. Annotations not needed
>@Stateless
>public class AssemblyBean extends AssemblyBeanBase
> implements AssemblyRemoteIF, AssemblyLocalIF, AssemblyCommonIF
>{
> public AssemblyBean() {
> }
>}
>
>ejb-jar.xml: (metadata-complete=false)
>=====================================
> <enterprise-beans>
> <session>
> <ejb-name>AssemblyBean</ejb-name>
><business-local>...AssemblyLocalIF</business-local>
><business-remote>...AssemblyRemoteIF</business-remote>
><ejb-class>...AssemblyBean</ejb-class>
> <session-type>Stateless</session-type>
> <transaction-type>Container</transaction-type>
> <security-identity>
> <use-caller-identity/>
> </security-identity>
> </session>
> </enterprise-beans>
> <interceptors>
> <interceptor>
><interceptor-class>...AssemblyInterceptor</interceptor-class>
> </interceptor>
> </interceptors>
>
> <assembly-descriptor>
> <interceptor-binding>
> <ejb-name>AssemblyBean</ejb-name>
> <interceptor-order>
><interceptor-class>...AssemblyInterceptor</interceptor-class>
> </interceptor-order>
> </interceptor-binding>
> </assembly-descriptor>
>
>
>interceptor:
>=============
>public class AssemblyInterceptor {
>
> public AssemblyInterceptor() {
> super();
> }
>
> @PostConstruct
> protected void myCreate(InvocationContext inv) throws RuntimeException
>{
> }
>
> @PreDestroy
> protected void myRemove(InvocationContext inv) throws RuntimeException
>{
> }
>
> @AroundInvoke
> protected Object intercept(InvocationContext inv) throws Exception {
> ...
> }
>}
>
>Thanks.
>-- Cheng
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>
>