Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: [FRIDAY] DBCP configuration

Phil Steitz

2007-01-05

Replies:

On 1/5/07, Christopher Schultz <chris@(protected):
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Wesley,
>
> (Sorry, I accidentally sent my previous message before I was finished
> writing).
>
> Wesley Wannemacher wrote:
> > The main reason that I am currently leaning toward the iBATIS solution
> > is that I am finding jUnit tests difficult to write for my persistence
> > layer. If I tell iBATIS to find the database connections in the Tomcat
> > context, iBATIS can't find them when I am running unit tests (since the
> > unit tests don't load the tomcat context).
>
> I assume that you aren't using any Tomcat-specific code in your
> classes... just the standard InitialContext, etc. If that's the case,
> you ought to be able to get a minimal JNDI interface going for your unit
> tests. I would imagine that there is an OSS component out there for this
> kind of thing.


The tomcat naming jars are available on ibiblio or
maven.org<http://repo1.maven.org/>under /tomcat/jars The two jars,
naming-common-<version number>.jar and
naming-java-<version number>.jar are sufficient to do JNDI datasource
lookups. The dbcp unit tests use these jars. If you use maven for your
builds, you can grab these using groupId tomcat, artifactIds naming-common,
naming-java and version 5.0.28, for example.

Phil
©2008 junlu.com - Jax Systems, LLC, U.S.A.