Jun 3rd, 2007, 07:16 AM
InitialContext using AbstractTransactionalSpringContextTests
I'm running Spring unit tests by subclassing AbstractTransactionalSpringContextTests. Some of my classes attempt to read environment properties from the web.xml, using
context = new javax.naming.InitialContext();
In the unit tests, that context cannot be initialised, error message is
Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
I'd really like to access my web.xml directly, without injecting property values (copy/paste from web.xml) into an environment object. How can I load the web.xml (or even just the env-entry nodes). Using Tomcat for deployment.
Thanks a lot
btw: I've found quite a few posts describing the exact problem, but no solution. I've come across the MockServletContext, but am not sure if that relates to the issue or not.