Hey there, Allan here.
Quick post, for the begginers out there:
I think anyone who programmed for more than one month with a Java + Maven project already saw that error. The basic scenario is simple:
You got your project compiling and building nice and easy. You lay back, relax a bit, and write some tests, go to youtube, refactor some method, stare at your screen and admire your work.
After a while you decide to do a full test. You pack your code, throw that in your server, restart, test and voila…
You just panic! How in the world is that possible?? You were sure of everything! And then you spend some time to figure it out what’s wrong.
Dependency conflict. ALMOST aways that is the case: you added some dependency that is dependent to some other dependency from your project, with a different version. Let me illustrate:
In this case, you depend on log4j-1.2.13, and when you add commons-logging-1.1, it will bring as a transitive dependency log4j-1.2.12. Bam! Error! Panic! Crying!
It’s not overly complicated to solve this, but, can be troublesome because there’s no easy way out here, you got to check your pom for dependency conflicts. Eclipse got a great maven plugin, that helps you out, but in case you want:
This will show you a complete tree of your dependencies. With that in hand, you can search for dependencies that caused your headache.
When you find the problem, the best way is to exclude the transitive dependency.
Hope it helps!