Mantis - Resin
Viewing Issue Advanced Details
3603 major always 07-20-09 17:30 08-28-09 15:12
mbrew  
ferg  
normal  
closed 3.1.9  
fixed  
none    
none 4.0.2  
0003603: in an EJB Interceptor, the @Resource tag fails when getting the EJBContext
In the example provided, the EJBContext in the interceptor class throws an error upon initialisation of the EJB saying that it can't find the TestInterceptor/ejbContext in the JNDI. It should be able to find the context and initialise it.

I've debugged the problem a bit and it seems that its trying to look for the EJB context before its getting added to the JNDI, as I can workaround the problem using the InitialContext and looking up the EJBContext inside the intercept method.

I am migrating our server from 3.1.5 to 3.1.9 and this functionality worked in 3.1.5.

Regards

Matthew Brew
Example:

@Stateless
@Local ({ITestAgent.class})
@Interceptors({TestInterceptor.class})
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
public class TestAgentImpl implements ITestAgent
{
    @Resource
    private EJBContext ejbContext;

    public String test()
    {
        //do something
    }
}

public class TestInterceptor
{
    @Resource
    private EJBContext ejbContext;

    @AroundInvoke
    public Object intercept(InvocationContext ctx) throws Exception
    {
        //do stuff
    }
}

Notes
(0004198)
ferg   
08-28-09 15:12   
ejb/0fbo