-
1. Plugin required for ejb3 interceptors?
wolfc Jan 31, 2011 7:59 AM (in response to kaiweing)Interceptors are supported in AS 5.1. The plugin contains additional bug fixes.
For EAP questions please contact support.
-
2. Plugin required for ejb3 interceptors?
kaiweing Jan 31, 2011 9:02 AM (in response to wolfc)Hello Carlo,
thanks for your quick response.
Have you used ejb3 Interceptors in JBoss AS 5.1? I stick to the tutorial, but my EJB-Method is not being intercepted.
This is my (test) code:
Interceptor
public class CallMonitoringInterceptor {
private static final Logger logger = LoggerFactory.getLogger(CallMonitoringInterceptor.class);
@javax.interceptor.AroundInvoke
public Object monitorCall(InvocationContext ctx) throws Exception {
logger.info("monitoring {}...", ctx.getMethod().toGenericString());
return ctx.proceed();
}
}
Intercepted business method
@Override
@javax.interceptor.Interceptors({CallMonitoringInterceptor.class})
public Object service(String param1) throws Exception {
...
}
Am I missing anything?
Thanks in advance,
Kai
-
3. Plugin required for ejb3 interceptors?
jaikiran Jan 31, 2011 11:31 AM (in response to kaiweing)Please post the exact source code including the annotations on the bean class.
-
4. Plugin required for ejb3 interceptors?
kaiweing Jan 31, 2011 12:40 PM (in response to jaikiran)The Interceptor code is complete as posted.
The EJB:
@javax.ejb.Stateless(name = "ejb/MyService")
public class MyServiceImpl implements MyService {
@Override
@javax.ejb.TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@javax.interceptor.Interceptors({CallMonitoringInterceptor.class})
public Object service(String param1) throws Exception {
// ...
}
}
and
@javax.ejb.Local
public interface MyService {
Object service(String param1) throws Exception;
}
-
5. Plugin required for ejb3 interceptors?
jaikiran Jan 31, 2011 12:43 PM (in response to kaiweing)That should have worked, assuming that you have correctly looked up the EJB via JNDI and invoked on it. What does your client code look like?
-
6. Plugin required for ejb3 interceptors?
kaiweing Jan 31, 2011 1:10 PM (in response to jaikiran)I cannot really say why, but now it acutally works.
Perhaps your karma helped :-)
Anyway, thanks for your support.
Kai
-
7. Plugin required for ejb3 interceptors?
jaikiran Jan 31, 2011 1:50 PM (in response to kaiweing)Kai Weingärtner wrote:
I cannot really say why, but now it acutally works.
Good to know!