I have a very simple test case where i just bind a string to the jndi and
then attempt to look it up.  This is failing with a NameNotFoundException in
the testReadFromJNDI test.  What am i doing wrong here?

public class JNDITest {

        private static InitialContext initialContext;
        

        @BeforeClass
    public static void beforeClass() throws Exception {
        Properties p = new Properties();
        p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.core.LocalInitialContextFactory");
        initialContext = new InitialContext(p);
    }
        
        @AfterClass
        public static void afterClass() throws Exception {
        }
        
        @Before
        public void setUp() throws NamingException, MalformedURLException {
        }
        
        @Test
        public void testAddToJNDI() throws NamingException {
                initialContext.bind("java:global/test", "true");
        }
        
        @Test 
        public void testReadFromJNDI() throws NamingException {
                String test = (String)initialContext.lookup("java:global/test");
                Assert.assertEquals("true", test);
        }

}



--
View this message in context: 
http://openejb.979440.n4.nabble.com/How-can-i-programmatically-bind-an-object-to-the-JNDI-tp4659125.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to