Yep. As I guessed you were doing the lookup on the client side (hence the need to specify JNDI properties). When you wrap it in a cactus suite, the test is now run on the server side. Thus you don't need to set up any JNDI properties.
-Vincent > -----Original Message----- > From: David Chelimsky [mailto:[EMAIL PROTECTED] > Sent: 01 November 2003 23:02 > To: 'Cactus Users List' > Subject: Re: NoInitialContextException > > Forgive me for wasting your time, though your response did point me in the > right direction. I was trying to run a junit TestCase, not a cactus > ServletTestCase (I'm a Cactus newbie). After looking at the cactus > documentation and adding the following method, all is well. AND the test > passes (though I'd best go back and make sure I can make it fail now). > > public static Test suite() { > ServletTestSuite suite = new ServletTestSuite(); > suite.addTestSuite(TestGetDataSource.class); > return suite; > } > > Thanks much for your time. > > David > > > > > ----- Original Message ----- > From: "Vincent Massol" <[EMAIL PROTECTED]> > To: "'Cactus Users List'" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Saturday, November 01, 2003 3:39 PM > Subject: RE: NoInitialContextException > > > > David, > > > > > -----Original Message----- > > > From: David Chelimsky [mailto:[EMAIL PROTECTED] > > > Sent: 01 November 2003 22:27 > > > To: 'Cactus Users List' > > > Subject: Re: NoInitialContextException > > > > > > > [snip] > > > > > public static DataSource getDataSource() throws NamingException { > > > Context ctx = new InitialContext(); > > > Context env = (Context) ctx.lookup("java:comp/env"); > > > DataSource ds = (DataSource) ctx.lookup("/jdbc/cheli"); > > > return ds; > > > } > > > > In which cactus method are you calling the getDataSource() method? Is it > > from a beginXXX() method, is it from a setUp() method, is it from a > > testXXX() method, is it from an endXXX method, etc? > > > > > > > > that's it. If this triggers any ideas for you, please let me know. > > > > -Vincent > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
