tomcat7 +jdk1.8启动报错

在尝试解决项目A由于缺少servlet-api.jar启动报错时,采取了手动添加该jar的方式解决了问题。然而,该方法导致项目B启动报错。分析发现,错误源于错误地为JDK添加了servlet-api.jar。尽管项目B本身没有问题,但项目A的错误处理方式不适用。问题最终通过移除额外的servlet-api.jar并正确配置依赖解决。错误堆栈显示与Activiti引擎的初始化失败有关。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

我有项目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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值