You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark <ma...@bellsouth.net> on 2003/01/02 22:04:08 UTC
OT - java:comp/env issues in standalone unit testing
I'm trying to set up standalone Ant-JUnit testing for our model objects
which can be tested independent of our controller/view components. Problem
is we have a lot of environment <env-entry> properties in web.xml, such as
DAO class names used in factories and other run-time stuff....so we have
many instances of code like this:
Context initCtx = new InitialContext();
propertyXYZValue = (String)initCtx.lookup("java:comp/env/propertyXYZ");
From what I understand the container establishes a java:comp/env
context-subcontext per web app, so attempting to get properties w/o using
Tomcat fails.
Has anyone else run into this situation, and if so how'd you get around it,
ie. manually create a java:comp/env context and add necessary env entries?
Other suggestions? Am I looking at this from a really screwed up
perspective? I've looked at Cactus a little and it seems like it's
something we'd want eventually, but also seems more complex than what we
need today.
Any thoughts will be appreciated.
Thanks
Mark
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>