snippetjournal

– notes, snippet codes, and my journal

Spring 4 Maven Dependency : misbehaviors error spring mvc

with 3 comments

It was very late, almost midnight and I can not resist to write this problem that i got. Almost spent more than one hour to figure out what is wrong with this spring mvc error.

This is my second time develop java web from scratch using spring mvc and i use spring web version 4.x.x. After prepare all xml configuration, there is no problem. All went well until i want to redirect the url from index.jsp to another url that will invoke my controller and the confusion beginšŸ˜¦

SEVERE: Servlet.service() for servlet [eleveniaTest] in context with path [/elevenia-test] threw exception [Servlet execution threw an exception] with root cause

java.lang.NoSuchFieldError: STANDARD_NUMBER_TYPES

at org.springframework.web.context.request.ServletRequestAttributes.(ServletRequestAttributes.java:55)

at org.springframework.web.servlet.FrameworkServlet.buildRequestAttributes(FrameworkServlet.java:1031)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:958)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)

…..

After goggling and trying figure out what the cause, some post in stackoverflow instructĀ to add maven dependency eclipse configuration, and refer the path web-inf/lib.

But it doesn’t solve my problem, because the configuration its already there and the culprit clearly not the maven lib config.

So after looking my previous spring 4.x project there is additional configuration in pom.xml that force all the spring libs 4.x to avoid this misbehavior

<dependencyManagement>
<dependencies>

<!-- Force the version of all the spring jars (core, beans, context, ...)
pulled by spring-data-jpa:1.3.4.RELEASE to 3.2.x when spring-data pulls the
3.1.x versions to prevent some misbehaviors of maven which sometimes pulls
both 3.2.x and 3.1.x versions of spring-core, spring-beans and spring-context -->

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring-framework.version}</version>
</dependency>

</dependencies>
</dependencyManagement>

 

It is likely somehow the spring data jpa pulls between spring version 3.1.x or spring 3.2.x from spring core into libs. so caused above error

Written by snippetjournal

March 11, 2015 at 4:43 pm

Posted in Programming

Tagged with ,

3 Responses

Subscribe to comments with RSS.

  1. Hi, I don’t have the data jpa dependency and I’ve checked the dependency tree in maven for any spring versions mismatch, but they all match and I’m still having this issue… do you have any other suggestions? would you mine showing the full pom.xml? Thanks

    yunke

    July 10, 2015 at 12:15 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: