Hi,
I have raised this in the EJB forum but haven't had any luck there. I have checked my code many times and am wondering if Glassfish may be the issue.
I'm trying to implement my first interceptor in EJB3 (in glassfish v3 final and netbeans 6.8) but the method wont invoke.
Can anyone help?
The class using the interceptor:
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
import javax.jws.WebService;
@Interceptors(MyLogger.class)
@Stateless @WebService
public class Configuration
{
public Settings getSettings()
{
return new Settings();
}
}
The interceptor class:
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
public class MyLogger
{
private Logger logger = Logger.getLogger(this.getClass());
@AroundInvoke
public Object logMethodCall(InvocationContext invocationContext) throws Exception
{
logger.info(invocationContext.getMethod().getName());
if (logger.getLevel() == Level.DEBUG)
{
StringBuffer str = new StringBuffer();
for (Object parameter: invocationContext.getParameters())
{
if (str.length() != 0)
{
str.append(", ");
}
str.append(parameter);
}
logger.debug("Parameters: " + str);
}
return invocationContext.proceed();
}
}
Thanks
[u][/u][u][/u]
[Message sent by forum member 'petergibbons' (smcintyre_at_esriaustralia.com.au)]
http://forums.java.net/jive/thread.jspa?messageID=377052