Spring启动错误:java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy

2024-01-05

我想使用 spring boot 来启动我的应用程序,但是在我在 pom.xml 添加一些相关的 jar 后,它返回此错误:我感谢可能是由一些冲突 jar 引起的?

应用程序.java

package com.mm.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@ComponentScan("com.mm.controller")
@Configuration
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) {
    //spring properties xml
    ApplicationContext context = new ClassPathXmlApplicationContext(
            "Spring-Module.xml");
    SpringApplication.run(Application.class, args);
}
@Bean
public InternalResourceViewResolver setupViewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    return resolver;
}

}

Error:

Error starting ApplicationContext. To display the auto-configuration report enabled debug logging (start with --debug)

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
atorg.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:648)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
at com.mm.application.Application.main(Application.java:20)

主要问题:

 Caused by: java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy
atsun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
atsun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
atsun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
atsun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
atsun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3185)
at java.lang.Class.getDeclaredAnnotations(Class.java:3166)
atorg.springframework.core.annotation.AnnotationUtils.isAnnotationDeclaredLocally(AnnotationUtils.java:395)
atorg.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:281)
atorg.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:265)
atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:173)
atorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:123)
atorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:103)
atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:126)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
... 15 more

pom.xml

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.1.RELEASE</version>
</parent>



<properties>
    <start-class>com.kdubb.springboot.Application</start-class>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/libs-milestone</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>http://repo.spring.io/libs-snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/libs-milestone</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>http://repo.spring.io/libs-snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<dependencies>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.0.4</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-dao</artifactId>
        <version>2.0.8</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
</dependencies>

登录控制器

package com.mm.controller;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@Component
public class LoginController {
@RequestMapping(value = "/CreditRating", method = RequestMethod.GET)
public String index(Model model) {
    model.addAttribute("wisdom", "Goodbye XML");
    // renders /WEB-INF/jsp/Login.jsp
    return "Login";
}

@RequestMapping(value = "/CreditRating/GoLogin")
public String login(Model model) {

    model.addAttribute("wisdom", "Goodbye XML");
    // renders /WEB-INF/jsp/index.jsp
    return "index";
}
}

解决方案可能会根据实际的不兼容根本原因而有所不同。调查此类问题的最佳方法是遵循以下步骤:

Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

并将断点放入类“TypeNotPresentExceptionProxy”的构造函数中(只有一个)。

在调试模式下执行后,您应该看到到底出了什么问题,并且根据您的发现,您可以决定要做什么(添加依赖项、排除自动配置,...)

在我的具体情况下,断点揭示了这一点:

java.lang.ClassNotFoundException: org.springframework.integration.config.IntegrationManagementConfigurer

作为解决方案,我决定排除“IntegrationAutoConfiguration”,如下所示:

@SpringBootApplication(exclude = IntegrationAutoConfiguration.class)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring启动错误:java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy 的相关文章

随机推荐

  • ListView 在滚动底部加载更多内容

    在 MainActivity 中 我创建了 DownloadTask 它填充模型类 然后通过 CustomListAdapter 类填充列表视图 但我创建了函数来识别滚动结束 并且我想将更多项目加载到列表视图中 我正在互联网上阅读和查看代码
  • Bootstrap-Vue 和 Bootstrap 4 的比较

    我已经使用 Vuejs 来开发我的前端 现在我必须对其进行样式设置 我碰到Bootstrap vue https bootstrap vue js org docs 使用 Bootstrap 4 或 Bootstrap vue 哪个更好 它
  • 使用 AngularJS 在多个视图中显示相同的数据

    也许有人可以帮助我一点 我必须在多个视图之间共享数据 因为是学校项目 所以我必须使用AngularJS 但我对它很陌生 我不知道从哪里开始 该程序的工作原理如下 用户 顾客 可以在餐厅预订餐桌 第一页 用户 员工 可以将订单添加到保留的表中
  • 如何在Servlet 2.4版本的init()方法中获取ContextPath

    我使用的是2 4版本Servlet我需要得到ContextPath通过init 在服务器启动时调用的方法 所以我没有任何请求对象可以调用getContextPath 而且因为我没有Servlet版本getContextPath 方法中的Se
  • Ruby Net::SSH 使用变量插值更改目录

    我对 Ruby 还很陌生 所以如果我遗漏了一些明显的东西 请原谅我 问题是 Ruby 似乎没有在 Net SSH exec 中进行变量插值 方法 VCL DIR usr local etc varnish host 0 0 0 0 Net
  • jQuery:当在错误函数中使用时,getResponseHeader 在 IE 中不起作用

    我正在使用 jQuery 1 7 1 随着Ajax 表单插件 http jquery malsup com form 最新版本可用 当我执行 Ajax 请求时 例如 form ajaxForm success function data a
  • 使用手套中的训练数据获取数据集的词嵌入

    我最近在我的 mac 中安装了 gensim 和 glove 并尝试为我拥有的文本数据获取词嵌入 但是 我很难找到合适的功能 我只遇到过获取两个单词之间相似性度量的方法 如何使用库中存在的数据训练手套对象并使用它来获取数据集中单词的嵌入 或
  • 我应该如何在Python中使用random.jumpahead

    我有一个应用程序 可以将某个实验执行 1000 次 多线程 以便同时完成多个实验 每个实验都需要大约 50 000 次 random random 调用 获得真正随机的最佳方法是什么 我可以将随机对象复制到每个实验中 然后跳转 50 000
  • 网站可以检测到您何时将 selenium 与 geckodriver 一起使用吗?

    是否可以检测由 Selenium 和 geckodriver 控制的 Firefox 浏览器实例 注意有一个chromedriver 的相应答案 https stackoverflow com questions 33225947 can
  • 如何获取 Ant 中的 basedir 路径中最后一个文件夹的名称?

    假设我的 basedir c projects myapp 1 2 我怎样才能在房产中获得 1 2 Check this http ant apache org manual Tasks basename html out
  • Android 完全透明的状态栏?

    I ve searched the documentation but only found this Link http developer android com about versions android 4 4 html UI W
  • JavaScript 中的原型不好吗?

    In Felix 的 Node js 风格指南 http nodeguide com style html它说 不要扩展任何原型 对象 尤其是本地对象 那里 地狱里有一个特殊的地方等待着 如果你不遵守这条规则 本文 http howtono
  • 整数如何存储在内存中?

    当我阅读一篇有关大 小端的文章时 我很困惑 代码如下 include
  • 在 Centos 6.3 中使用 php-ldap

    我正在尝试使用 php 构建 LDAP 界面 但遇到了这个奇怪的问题 我已经在我的基本 php 安装上使用 yum 安装了 php ldap 包 但每当我调用 ldap connect 时 它都会说该函数未定义 看到 phpinfo 我可以
  • 正则表达式逗号后面没有空格

    我目前正在尝试创建一个表达式 以捕获所有后面没有空格的逗号以及所有冒号 我试过了 s 很接近 但似乎也抓住了逗号后面没有空格的字符 我也尝试过 s 它将抓取所有冒号和所有逗号 其后有一个空格以及空格 我希望选择的内容包含在下面的 中 你好
  • 如何更改视频方向

    我目前有一个 iPhone 应用程序 可以让用户拍摄视频 将其上传到服务器 并允许其他人从该应用程序查看他们的视频 从来没有遇到过视频方向的问题 直到我制作一个网站来观看不同的视频 以及其他内容 我使用来自网络服务的视频 并使用 video
  • 无法解析模块react/lib/ReactUpdates

    我正在克隆一个项目 步骤是 npm i 反应本机链接 当我运行它时react native run ios我有一个问题RCTWebSocket图书馆 如果你稍微搜索一下 这个问题很容易解决 只需要删除 2 个编译器标志 在Custom Co
  • 如何从python Flask中的mongodb mlab返回包含键中特定关键字的文档[重复]

    这个问题在这里已经有答案了 我在 mongodb 中有这个集合 我的收藏 id 5ad2079019551a2108588add brand name MAZOLA LIZA name pyd id 5ad2079019551a210858
  • “ng build”与“ng build --prod”不一致

    我正在开发一个有角度的应用程序 Using Angular 5 2 5 角度 CLI1 6 8 当我执行命令时 ng build 我没有收到任何错误 但是当我尝试生产构建时 ng build prod 我收到错误 属性 someProper
  • Spring启动错误:java.lang.ArrayStoreException:sun.reflect.annotation.TypeNotPresentExceptionProxy

    我想使用 spring boot 来启动我的应用程序 但是在我在 pom xml 添加一些相关的 jar 后 它返回此错误 我感谢可能是由一些冲突 jar 引起的 应用程序 java package com mm application i