Hello,
I am using glassfish v3.1.
I have created a custom Resource of type Properties and try to load it
public class DBUtilities {
@Resource(name="custom/application")
static private Properties properties;
This will never load the resource into the variable properties.
static has no effect. It doesn't matter if properties is a class member
or an instance member variable.
but if I do
Context context = null;
try {
context = new InitialContext();
properties = (Properties)
context.lookup("java:comp/env/custom/application");
} catch (NamingException ex) {
Logger.getLogger(DBUtilities.class.getName()).log(Level.SEVERE, null, ex);
}
then it loads the resource.
Why is it so that the @Resource annotation is not working?
I have even tryed with other resources with the same problem e.g.
javax.mail.Session
thank you
Nikolas