java.lang.NoSuchMethodError:org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava / lang / Class; Ljava / lang / Class;)

时间:2016-10-28 11:11:34

标签: java spring spring-mvc gwt

将项目从2.5级升级到3.2级我用新的弹簧3.1.1罐替换了旧的弹簧罐。当我部署并尝试命中服务器时。我收到以下错误。

java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lan
g/Class;
        at org.springframework.core.convert.support.GenericConversionService.getRequiredTypeInfo(GenericConversionService.java:260)
        at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:83)
        at org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:63)
        at org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:54)
        at org.springframework.core.convert.support.DefaultConversionService.<init>(DefaultConversionService.java:43)
        Truncated. see log file for complete stacktrace

我想使用org.springframework,spring,2.5.6.SEC03,因为旧项目使用SimpleFormController和AbstractFormController,我不想触及现有代码,我也希望它支持带注释的控制器。

下面是我正在使用的依赖项:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    <version>2.5.6.SEC03</version>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.2.13.RELEASE</version>
</dependency>

<!-- Spring Test -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>2.5</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.9</version>
</dependency>


<dependency>
    <groupId>taglibs</groupId>
    <artifactId>standard</artifactId>
    <version>1.0.6</version>
</dependency>

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>

<!-- weblogic 10 plugins start -->
<dependency>
    <groupId>weblogic</groupId>
    <artifactId>wlfullclient</artifactId>
    <version>10.3.6</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>weblogic</groupId>
    <artifactId>jconn</artifactId>
    <version>2</version>
</dependency>
<!-- weblogic 10 plugins end -->


<dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib-nodep</artifactId>
    <version>2.2_beta1</version>
</dependency>

<dependency>
    <groupId>commons-digester</groupId>
    <artifactId>commons-digester</artifactId>
    <version>1.8.1</version>
</dependency>


<dependency>
    <groupId>easymock</groupId>
    <artifactId>easymock</artifactId>
    <version>1.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>easymock</groupId>
    <artifactId>easymockclassextension</artifactId>
    <version>1.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>mockejb</groupId>
    <artifactId>mockejb</artifactId>
    <version>0.5</version>
    <scope>test</scope>
</dependency>

<!-- Junit Test -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
</dependency>

<!-- Mockito Test -->
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
    <version>1.9.5</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>1.9.5</version>
    <scope>test</scope>
</dependency>

<!-- Powermock Test -->
<dependency>
    <groupId>org.powermock</groupId>
    <artifactId>powermock-module-junit4</artifactId>
    <version>1.5</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.powermock</groupId>
    <artifactId>powermock-api-mockito</artifactId>
    <version>1.5</version>
    <scope>test</scope>
</dependency>

<!-- Spring Test -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>2.5</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.9</version>
</dependency>


<dependency>
    <groupId>taglibs</groupId>
    <artifactId>standard</artifactId>
    <version>1.0.6</version>
</dependency>


<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc-struts</artifactId>
    <version>2.5.6.SEC03</version>
</dependency>

<dependency>
    <groupId>struts</groupId>
    <artifactId>struts</artifactId>
    <version>1.2.9</version>
</dependency>

<dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt-servlet</artifactId>
    <version>${gwt.version}</version>
    <scope>runtime</scope>
</dependency>

<dependency>
    <groupId>com.google.gwt</groupId>
    <artifactId>gwt-user</artifactId>
    <version>${gwt.version}</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.11-beta2</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.11-beta2</version>
</dependency>

<dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker</artifactId>
    <version>2.3.14</version>
</dependency>


<!-- XStream -->
<dependency>
    <groupId>com.thoughtworks.xstream</groupId>
    <artifactId>xstream</artifactId>
    <version>1.4.7</version>
</dependency>

<!-- Apache Commons Upload -->
<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.2.2</version>
</dependency>

<!-- Apache Commons Upload -->
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>1.3.2</version>
</dependency>

<!-- Newly added Jar file from win TTP -->
<dependency>
    <groupId>xpp3</groupId>
    <artifactId>xpp3_min</artifactId>
    <version>1.1.4c</version>
</dependency>

<dependency>
    <groupId>xmlpull</groupId>
    <artifactId>xmlpull</artifactId>
    <version>1.1.3.1</version>
</dependency>

2 个答案:

答案 0 :(得分:1)

很抱歉在此发布,因为我没有代表将其添加到评论中。 如果您想使用新版本,请删除旧版本的弹簧。

在一个应用程序中拥有多个版本的spring是一个非常糟糕的主意。 由于两个版本的弹簧罐,您将花费数小时的时间浪费时间来解决应用程序出现的神奇错误

答案 1 :(得分:1)

我遇到了同样的问题,并且使用了Maven Dependency BOM。完美的作品。 --- Version --- Number 是您在项目中使用的Spring Framework版本。 访问此链接以获取更多信息:https://www.baeldung.com/spring-maven-bom

<dependencyManagement>
    <dependencies>
        <!-- ... other dependency elements ... -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-framework-bom</artifactId>
            <version>---Version---Number.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>