I am new to Java EE 6 and JNDI so please forgive me if my problem seems trivial
I have added a custom resource to Glassfish 3.1.2 JNDI resources via tha admin console:
CommonTasks->Resources->JNDI->Custom Resources
- JNDI Name: someNumber
- Resource Type: java.lang.Integer
- Factory Class: org.glassfish.resources.custom.factory.PrimitivesAndStringFactory
- Additional Properties: [Name: digit; Value: 6]
Now I wish to look this resource up in my Java EE app I deploy to the glassfish server as ear. I've tried this with no luck:
InitialContext ctx = new InitialContext();
Object o = ctx.lookup("someNumber");
I keep getting a NameNotFoundException. Can you tell me what is it that I'm doing wrong? I know that you can pass an environment hashtable to the initial context constructor with a provider URL - is this the problem?