我有项目A和项目B,当项目A出现以上错误,百度得到图内答案就照做了 果然解决了项目A启动报错问题
但是项目B始终启动报错如下:最后发现就是因为有了往jdk添加了servlet-api.jar的操作 ,导致项目B启动报错
但我肯定B是对的 问题出在A ,A启动报错处理方式是错的 ,
分析A报错原因:是没有获取到servlet-api.jar ,反复写入servlet-api依赖 ,也看到maven库有相关jar,但仍然报错
最后手动导入servlet-api.jar
启动tomcat成功。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
不明其中缘由!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
或
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
2018-11-29 14:17:16,005 WARN [springframework.web.context.support.XmlWebApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processDefinitionDiagramLayoutResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.activiti.engine.RuntimeService com.thinkgem.jeesite.modules.act.rest.diagram.services.BaseProcessDefinitionDiagramLayoutResource.runtimeService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactory': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
2018-11-29 14:17:16,013 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processDefinitionDiagramLayoutResource': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.activiti.engine.RuntimeService com.thinkgem.jeesite.modules.act.rest.diagram.services.BaseProcessDefinitionDiagramLayoutResource.runtimeService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactory': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapa