Problem with DescriptorEventAdapter and EJBContext [message #530891] |
Sun, 02 May 2010 12:37 |
John99 Messages: 4 Registered: May 2010 |
Junior Member |
|
|
Hello.
I have an AuditLogger class which extends
DescriptorEventAdapter for storing all the changes of all entities in the system.
The problem is that a can't get a reference to EJBContext in AuditLogger for current user reteriving.
i tried both variants: get EJBContext by using @Resource annotation and by using direct jndi lookup. Result is always the same: EJBContext is null.
AuditLogger class:
public class AuditHandler extends DescriptorEventAdapter implements
DescriptorCustomizer {
@Resource
private SessionContext ctx;
protected EJBContext getContext() {
EJBContext result = null;
try {
InitialContext context = new InitialContext();
result = (EJBContext)context.lookup("java:comp/EJBContext");
} catch (NamingException e) {
e.printStackTrace();
}
return result;
};
......
i map AuditLogger to entity by using @Customizer annotation:
@Customizer(value=com.es.ejb.server.util.audit.AuditHandler.class)
@Entity
@Table(name = "WM_USER")
public class EJBUser {
.....
Please help me) what i'am doing wrong?
[Updated on: Sun, 02 May 2010 12:38] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03135 seconds