JNDI resource lookup fails with Glassfish
Created a JNDI custom resource:
imageBasePath
java.lang.String
/home/user/NetBeansProjects/Builder/images
Tried looking it up as follows:
InitialContext ctx;
try {
ctx = new InitialContext();
Object o = ctx.lookup("imageBasePath");
} catch (NamingException ex) {
Logger.getLogger(blanketBean.class.getName()).log(Level.SEVERE, null,
ex);
}
It throws exception:
(javax.naming.CommunicationException) javax.naming.CommunicationException:
Communication exception for
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,
java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is
java.lang.IllegalArgumentException: type cannot be null]
What am I doing wrong?
No comments:
Post a Comment