Page 1 of 1

Maven question about commons-dbcp

Posted: Wed Jan 23, 2013 11:49 am
by pauldev
Q: I notice that in the training it shows how to setup a datasource using jndi...
Is it better to use spring to create a datasource bean?

Anyway, trying to use commons-dbcp to test out creating a datasource spring bean I get a maven error:
I am trying to add a dependency to my -web pom.xml:

I get this error:
Failure to find commons-dbcp:commons-dbcp:jar:1.4 in

So what I am trying to figure out is why it is not in nexus? (or just how to force maven to use the default repository)

Re: Maven question about commons-dbcp

Posted: Wed Jan 23, 2013 1:58 pm
by YoungstromMJ
to answer your first question.

Traditionally we've preferred setting up datasources in the server.xml file and then referencing them through jndi because it allows the ASEs more visibility and ability to change the applications connection to the database.

As use of Tomcat has matured in the organization this has been less and less useful. So I wouldn't be surprised if in some future version of the stack we recommend people embed their datasources in their application. But the standard today is still to put the datasource in your server.xml like it is in our stack-starter applications.

To answer your second question about commons-dbcp. Because commons-dbcp isn't a pool that we've supported in the past and don't have any experience supporting we don't have it approved in our maven repository. We recommend people use tomcat-jdbc instead it is better performing and has some nice features too.

If you still want to use commons-dbcp I can talk to you about the process for approval. If you are just experimenting and don't need it in the official repository then just add a repository entry in your root pom to maven central Just make sure you give it a non typical ID since we block the more common ids (e.g. central, repo1, etc) in our parent pom.

Does that help?


Re: Maven question about commons-dbcp

Posted: Thu Jan 24, 2013 10:16 am
by pauldev
Yes, thanks for the info.