Maven question about commons-dbcp

Support and Announcements for the Tech Java Web Application Platform (setup, configuration, bugs, feedback).
Locked
pauldev
New Member
Posts: 28
Joined: Mon Jan 07, 2013 12:42 pm

Maven question about commons-dbcp

#1

Post 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:
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>

I get this error:
Failure to find commons-dbcp:commons-dbcp:jar:1.4 in http://code.lds.org/nexus/content/groups/main-repo

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)
YoungstromMJ
Member
Posts: 101
Joined: Mon Mar 29, 2010 3:11 pm
Location: Utah, USA

Re: Maven question about commons-dbcp

#2

Post 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 http://repo1.maven.org/maven2. 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?

Mike
pauldev
New Member
Posts: 28
Joined: Mon Jan 07, 2013 12:42 pm

Re: Maven question about commons-dbcp

#3

Post by pauldev »

Yes, thanks for the info.
Locked

Return to “Java Web Project Support (Stack)”