How can I exclude some packages from (transitive) dependencies? - maven

I depend on org.springframework.boot:spring-boot-starter-validation:jar:2.2.6.RELEASE:test which depends on org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:test.
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:2.2.6.RELEASE:test
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.33:test
[INFO] | \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:test
Now in my test clases, there are two candidates for statically importing assertNotNull.
One is
import static org.junit.jupiter.api.Assertions.assertNotNull;
And the other is
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
Is there any nice way to exclude the hibernate one?

You can only exclude whole dependencies, not parts of them.

You can try doing that:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>2.2.6.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>

Related

Duplicate JARs are getting copied though excluded in pom.xml

I am trying to add jdom 2.0.2 dependency in one of my project.In order to do that I added following entry in pom.xml
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>
But after building the project I found that both jdom 1.0 and jdom 2.0.2 got copied. Then I ran mvn dependency:tree
command which shows that jdom 1.0 jars are coming from jaxen 1.1 dependency through transitive dependency.
To exclude that dependency I added an exclusions in jaxen dependency
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1</version>
<exclusions>
<exclusion>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>
</exclusions>
</dependency>
But still I am facing same issue. Both(jdom 1.0 and 2.0.2) jars are getting copied. mvn dependency:tree also is showing the same result
INFO] +- jaxen:jaxen:jar:1.1:compile
INFO] | +- dom4j:dom4j:jar:1.6.1:compile
INFO] | +- jdom:jdom:jar:1.0:compile
Could you please help on this issue?
Thanks
Look carefully at the dependency output:
INFO] +- jaxen:jaxen:jar:1.1:compile
INFO] | +- dom4j:dom4j:jar:1.6.1:compile
INFO] | +- jdom:jdom:jar:1.0:compile
The group ID for the jdom dependency is just jdom, not org.jdom. Fix the exclusion and that should do it.
<exclusion>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
</exclusion>

Understanding Maven Dependency tree output

I am trying to compile a Spring application in which the ApplicationConfig file has #EnableAspectJAutoProxy anotation I am facing this error when trying to run the project:
Failed to instantiate [org.springframework.aop.aspectj.annotation.
AnnotationAwareAspectJAutoProxyCreator]:
Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Around
I have to say when I remove the above annotation the project is running successfully.
Having read on Internet I thought maybe it's because of incompatible versions for of libraries and jar files.
When I run mvn dependency:tree the output is as below:
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] groupId:myProject:jar:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:4.11:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.3.0.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.2.6.RELEASE:compile (version m
anaged from 4.3.0.RELEASE)
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:4.2.6.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:4.2.6.RELEASE:compile (versi
on managed from 4.3.0.RELEASE)
[INFO] | +- org.springframework:spring-core:jar:4.2.6.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:4.2.6.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.2.6.RELEASE:compile (version m
anaged from 4.3.0.RELEASE)
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] \- org.aspectj:aspectjrt:jar:1.8.9:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
and this is the content of the pom.xml file :
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.9</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.9</version>
</dependency>
</dependencies>
Question: I don't understand this output is saying that everything is fine or there might be some incompatibility in my project, and if there are how to solve them?
If you have worked on maven in your projects for dependency management, then you must have faced one problem at least once or may be more than that. And the problem is version mismatch. It generally happens when you got some dependencies which bring it’s related dependencies together with certain version. And if you have included those dependencies with different version numbers already, they can face undesired results in compile time as well as runtime also.
Ideally to avoid above issue you need to explicitly exclude the related dependency, but it is quite possible that you can forget to do so.
To solve version mismatch issue, you can use the concept of a “bill of materials” (BOM) dependency. A BOM dependency keep track of version numbers and ensure that all dependencies (both direct and transitive) are at the same version.
How to add BOM [Bill Of Materials] dependency
Maven provides a tag dependencyManagement for this purpose. You need to add the bom information in this tag as follows. I am taking the example of Spring bom file.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
An added benefit of using the BOM is that you no longer need to specify the version attribute when depending on Spring Framework artifacts. So it will work perfectly fine.
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependencies>
Doing like above will resolve all version comparability issues and application works fine as we are not going to use unmatched versions

java.lang.NoSuchMethodError: org.codehaus.jackson.map.AnnotationIntrospector.pair

I am trying to wrok with JAX RS service. I have added few dependencies in my pom .xml. Here is the pom.
<properties>
<jersey.version>1.19</jersey.version>
</properties>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<version>2.2.1.Final</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.drill.exec</groupId>
<artifactId>drill-jdbc-all</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
when i add this dependency <dependency>
<groupId>org.apache.drill.exec</groupId>
<artifactId>drill-jdbc-all</artifactId>
<version>1.1.0</version>
</dependency>
it fails with elow mentioned exception. I need the above mentioned dependecy for apache drill. On removing and running it works smooth.
The excpetion i am getting is:
java.lang.NoSuchMethodError: org.codehaus.jackson.map.AnnotationIntrospector.pair(Lorg/codehaus/jackson/map/AnnotationIn
trospector;Lorg/codehaus/jackson/map/AnnotationIntrospector;)Lorg/codehaus/jackson/map/AnnotationIntrospector;
at org.codehaus.jackson.jaxrs.MapperConfigurator._resolveIntrospectors(MapperConfigurator.java:155)
at org.codehaus.jackson.jaxrs.MapperConfigurator._setAnnotations(MapperConfigurator.java:133)
at org.codehaus.jackson.jaxrs.MapperConfigurator.getDefaultMapper(MapperConfigurator.java:70)
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.locateMapper(JacksonJsonProvider.java:648)
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.writeTo(JacksonJsonProvider.java:500)
at com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.writeTo(JacksonProviderProxy.java:160)
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291).
Can some one please help as in why on adding the particular dependency it fails with the above exception.
tried running mvn dependency tree to check the conflict in jars.
Building JAXRS-JSON Maven Webapp 0.0.1-SNAPSHOT
------------------------------------------------------------------------
--- maven-dependency-plugin:2.8:tree (default-cli) # JAXRS-JSON ---
com.java.codegeeks.example:JAXRS-JSON:war:0.0.1-SNAPSHOT
+- com.sun.jersey:jersey-servlet:jar:1.19:compile
| \- com.sun.jersey:jersey-server:jar:1.19:compile
+- com.sun.jersey:jersey-json:jar:1.19:compile
| +- org.codehaus.jettison:jettison:jar:1.1:compile
| +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
| | \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
| | +- javax.xml.stream:stax-api:jar:1.0-2:compile
| | \- javax.activation:activation:jar:1.1:compile
| +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile
| +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile
| +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.2:compile
| +- org.codehaus.jackson:jackson-xc:jar:1.9.2:compile
| \- com.sun.jersey:jersey-core:jar:1.19:compile
| \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
+- com.sun.jersey:jersey-client:jar:1.19:compile
+- junit:junit:jar:3.8.1:test
\- org.apache.drill.exec:drill-jdbc-all:jar:1.1.0:compile
------------------------------------------------------------------------
BUILD SUCCESS
drill contains too many packages inside it and it collides with other jars in app. I too encountered similar problem but with com.google.common.collect and org.apache.zookeeper packages of drill jar. In my case the version drill is using for these packages are older and so, I just removed those.
zip -d drill-jdbc-all-1.1.0.jar com/google/common/collect/*
zip -d drill-jdbc-all-1.1.0.jar org/apache/zookeeper/*
Now it is working fine. I am not sure how to handle all these using maven only and so opted to delete. It would be better if maven can handle that.

Using Spring 4.0 with spring-data-jpa

I am using Spring 4.0 in my JavaEE application, and I tried to use the Spring-data-jpa.
However when I add the Spring-data-jpa dependency, I found that the Spring-data-jpa will depend on Spring-3.x.
Then I wonder this will cause any problem? Since my application will have Spring-4.x with Spring-3.x.
Anyone have the same experience?
Update:
I am using Spring-data-jpg-1.4.3:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.4.3.RELEASE</version>
</dependency>
But when I run mvn dependency:tree I got this:
+- org.springframework:spring-context:jar:4.0.0.RELEASE:compile
| +- org.springframework:spring-beans:jar:4.0.0.RELEASE:compile
| +- org.springframework:spring-core:jar:4.0.0.RELEASE:compile
| | \- commons-logging:commons-logging:jar:1.1.1:compile
| \- org.springframework:spring-expression:jar:4.0.0.RELEASE:compile
+- org.springframework:spring-aop:jar:4.0.0.RELEASE:compile
| \- aopalliance:aopalliance:jar:1.0:compile
+- org.springframework.data:spring-data-jpa:jar:1.4.3.RELEASE:compile
| +- org.springframework.data:spring-data-commons:jar:1.6.3.RELEASE:compile
| +- org.springframework:spring-orm:jar:3.1.4.RELEASE:compile
| | \- org.springframework:spring-jdbc:jar:3.1.4.RELEASE:compile
| +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
| +- org.aspectj:aspectjrt:jar:1.7.2:compile
| +- org.slf4j:slf4j-api:jar:1.7.1:compile
| \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
+- org.aspectj:aspectjweaver:jar:1.7.4:compile
+- org.springframework:spring-test:jar:4.0.0.RELEASE:test
It seems that the spring 4.0.. is mixed with spring 3.1.4..
This is an error in the spring-data-jpa 1.4.3.RELEASE pom denepdency.
What actually happens is that it loads spring dependencies that exist in this maven pom instead of the ones you want to import.
The short answer is add this as a parent to your maven project:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.0.RC5</version>
</parent>
so that it can inherit the correct dependencies.
Another way to solve this is to use the <exclusions> tag to exclude them and then import the correct dependecies but this takes more time and is not as clean. If you don't want to add spring-boot-start-parent though, then this is how to solve this error.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.4.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
...
</exclusion>
</exclusions>
</dependency>
For more info see here

How to figure out the jars that the dependencies in the maven's pom.xml depend on?

I am very interested in how I can find out what are the jars that the dependences in the maven's pom.xml depend on.
I am used to doing the adding of libraries (jars) myself in my web application project. I came across this need when I was trying to configure the spring 3.0 samples. I really dislike that everything has to go through maven with spring 3.0.x. At this point it seems that I cannot dig deeper in the maven's dependency maze and learning it looks like a must. But I would really appreciate if someone can tell me a way I can find out this info.
For example, for the following pom.xml, I would like to know what the dependency with artifactId spring-context depends on. (I can see that it depends on commons-logging, since the creator of the sample excludes it - wanted to use slf4j instead of commons-logging.). I would like to find out the rest of the dependences for the dependency with artifactId spring-context, and the same for the rest of the dependences! How can I do this?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>mvc-ajax</artifactId>
<name>mvc-ajax</name>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<org.slf4j.version>1.6.1</org.slf4j.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<!-- JSR 303 with Hibernate Validator -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<!-- Joda Time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
<scope>runtime</scope>
</dependency>
<!-- Jackson JSON Mapper -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.6.4</version>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<!-- For Hibernate Validator -->
<repository>
<id>org.jboss.repository.release</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Kind Regards,
Despot
EDIT (some follow up on the answer given by Sean):
1) Download maven (I downloaded version 2.2.1) and follow the installation instructions given there.
2) Than open command prompt and go to the directory of the pom.xml
3) Do the "mvn dependency:tree" command as advised. (I tried using -DoutputFile="somePath" or -Dinclude=spring-context -> it wasn't writing in the file presented in the path and it was selecting all the dependancies instead of spring-context - no matter the general command will suffice). Wait for a while for the system to download all needed info and in the end you will get something like this:
[INFO] [dependency:tree {execution: default-cli}]
[INFO] org.springframework.samples:mvc-ajax:war:1.0.0-SNAPSHOT
[INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] | \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.0.5.RELEASE:compile
[INFO] | +- org.springframework:spring-context-support:jar:3.0.5.RELEASE:
compile
[INFO] | \- org.springframework:spring-web:jar:3.0.5.RELEASE:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
[INFO] +- log4j:log4j:jar:1.2.16:runtime
[INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.1.0.Final:compile
[INFO] +- joda-time:joda-time:jar:1.6.2:runtime
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.6.4:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.6.4:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- junit:junit:jar:4.7:test
[INFO] \- org.springframework:spring-test:jar:3.0.5.RELEASE:test
[INFO] ---------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ---------------------------------------------------------------
[INFO] Total time: 1 minute 8 seconds
[INFO] Finished at: Tue Jan 04 16:53:45 CET 2011
[INFO] Final Memory: 12M/25M
[INFO] ---------------------------------------------------------------
You can download the jars using Jarvana (just type jarvana + the name of the jar) or you can use the svn checkout command.
The hibernate-validator:jar:4.1.0.Final in Jarvana returns an error (there is no 4.1.0 Final version -> only 4.0.2 Final
Also org.codehaus.jackson-mapper-asl 1.6.4 could not be found - only 1.6.2 (same goes to the jackson-core-asl). I am presuming that the same would happen if you used maven to build your project.
After I included all the needed jars, I started the server in debug mode and this happened:
TIME org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\somePath\mvc-ajax3.0\WEB-INF\lib\jsp-api-2.1.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
TIME org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\somePath\mvc-ajax3.0\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
This means (I think) that those jars are found twice. Deleting them done the job for me. Seams like the pom.xml is not valid for this sample.
It took too much time for me to download the jars manually and to "fight" all the project configuration, so I guess is best to learn some Maven if you are trying to start with Spring 3.0.
Execute mvn dependency:tree and it will list all the project's dependencies.
Reference:
dependency:tree mojo
Resolving conflicts using the Dependency Tree
Filtering the Dependency Tree
You didn't mention what IDE you are using. If you are using Eclipse then install the M2Eclipse plugin for Maven. Once installed it has an excellent Maven pom.xml editor that can show you many things...including an interactive, recursive, dependency tree.
You can see some videos on this feature here:
http://m2eclipse.sonatype.org/overview-of-the-m2eclipse-pom-editor.html

Resources