你是我一生的风景 2020-05-19 10:06 采纳率: 0%
浏览 994

Spring注入Bean出现空指针异常

@Bean
    public ServletRegistrationBean ActionServlet() {
        ServletRegistrationBean registration = new ServletRegistrationBean();
        registration.setName("ActionServlet");
        registration.setOrder(1);
        registration.addUrlMappings("*.do");
        registration.setServlet(new ActionServlet());
        registration.addInitParameter("config", "/WEB-INF/conf/action_config.xml");
        registration.addInitParameter("ignoreCase", "N");
        registration.setLoadOnStartup(1);
        return registration;
    }
java.lang.NullPointerException: null
    at org.dom4j.io.SAXReader.read(SAXReader.java:284)
    at com.yuangou.ecp.bp.web.controller.ActionMappingsParse.parse(ActionMappingsParse.java:34)
    at com.yuangou.ecp.bp.web.controller.servlet.ActionServlet.init(ActionServlet.java:502)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:986)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4978)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:78)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.performDeferredLoadOnStartup(TomcatEmbeddedServletContainer.java:288)
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:211)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
    at com.murong.ecp.bp.common.util.ECPApplication.run(ECPApplication.java:30)
    at com.murong.ecp.netpay.jnefss.web.SpringBootApplication.main(SpringBootApplication.java:18)
  • 写回答

2条回答 默认 最新

  • 关注

    看一下SpringBootApplication启动类的第18行啊

    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀