最近在搭spring项目框架的时候,遇到一个很伤的问题,翻了很多帖,都报告说什么少spring-context包啊之类的,但实际上spring的那些依赖我根本没漏,下面是我的pom:

  <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency> <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency> <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>

  先试了用srping-test组件去测试spring-mybatis是否有配置上的问题:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring-mybatis.xml")
public class MyBatisTest { @Autowired
private MarketReportServiceI marketReportService; @Test
public void test() {
//从Spring容器中根据bean的id取出我们要使用的userService对象
MarketActivityReportWeek report = marketReportService.getReportById("88f8589b-d6fd-11e6-8da9-005056af50a8");
System.out.println(report.getMarketActivityName() + " : " + report.getDealerName());
} }

  这样跑下来确实能在控制台打印出数据库中的结果,证明spring配置应该是没有问题的,但项目在tomcat死活启动不了,搞了老半天,一直在web.xml和jar包上纠结,后来直接到发布路径下面去直接找到它,发现jar包没有部署上去(WEB-INF/lib不存在),然后重新修改了一下项目的发布设置:

  这时候发现jar包上去了,项目也启动起来了,总算把这茬给搞定了,伤脑筋啊,一开始找的方向不对,始终查不出问题的根源所在,整个项目都差点被推翻重搭了,记下来希望对朋友们有帮助!

spring项目启动错误——java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext的更多相关文章

  1. IDEA启动tomcat报错:java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext、ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component

    先看错误日志: -May- ::.M26 -May- :: :: UTC -May- ::29.845 信息 [main] org.apache.catalina.startup.VersionLog ...

  2. java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext

    ***************************错误提示************************************************ SEVERE: A child cont ...

  3. spring boot 启动报 java.lang.NoClassDefFoundError: ch/qos/logback/core/spi/LifeCycle 错误

    Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: ch/qos ...

  4. Spring 整合hibernante 错误java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    1.将所需的jar包全部拷贝到WEB-INF/lib下,再重新启动tomcat便能顺利通过了.参考http://blessht.iteye.com/blog/1104450 最佳答案   spring ...

  5. Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextAware

    1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...

  6. java.lang.ClassNotFoundException: org.springframework.context.event.GenericApplicationListener ----good

    Caused by: java.lang.NoClassDefFoundError: org/springframework/context/event/GenericApplicationListe ...

  7. 【转】java.lang.ClassNotFoundException: org.springframework.context.event.GenericApplicationListener

    http://www.cnblogs.com/softidea/p/6064091.html Caused by: java.lang.NoClassDefFoundError: org/spring ...

  8. Spring boot java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedPropertyResolver

    Spring boot 2.0.3 RELEASE 配置报错 java.lang.NoClassDefFoundError: org/springframework/boot/bind/Relaxed ...

  9. mybatis-plus 错误 java.lang.NoClassDefFoundError

    错误 java.lang.NoClassDefFoundError: org/apache/velocity/context/Context 使用mybatis-plus自动生成文件的时候,报下面的错 ...

随机推荐

  1. linux 基础9-账号与身份管理

    1. linux的账号与群组 1.1 账户名称:/etc/passwd: head -n 5 /etc/password #取前5行 账号名称,对应UID 密码,早期是在这里,后来转到了/etc/sh ...

  2. idou老师教你学Istio 15:Istio实现双向TLS的迁移

    在Istio中,双向TLS是传输身份验证的完整堆栈解决方案,它为每个服务提供可跨集群的强大身份.保护服务到服务通信和最终用户到服务通信,以及提供密钥管理系统.本文阐述如何在不中断通信的情况下,把现存I ...

  3. idou老师带你认识Istio13:Istio实现基础认证策略

    前言 微服务架构提供了更好的灵活性.可伸缩性以及服务复用的能力,但,微服务也有特殊的安全需求,Istio Security尝试提供全面的安全解决方案.为了提供灵活的服务访问控制,需要双向 TLS 和细 ...

  4. 说一下 synchronized 底层实现原理?(未完成)

    说一下 synchronized 底层实现原理?(未完成)

  5. JS遍历表格获取每行数据及每个单元格数据

    /** * 遍历表格获取每行数据及每个单元格数据 * @param tableID 表格ID */ function GetTable(tableID) { var milasUrl = {};//新 ...

  6. php文件更新后不生效?亲测有效!

    1,问题描述 一台windows Server2008 服务器上运行了iis7,其中存在php5.3和php5.5引擎的网页服务. 但实际使用中发现,修改php文件后,访问该文件的结果经常不能实时刷新 ...

  7. easyui-filebox上传文件或图片时选择相同文件无法触发change事件的问题

    其实很简单,当选择完一个文件之后,会将文件名存放在input中的value值中,当下一次onChange之后,比对玩发现,value值没有发生变化,所以不能触发. 所以,只需要下次将value值清空就 ...

  8. 老式浏览器支持html5与css3

      html5低版本浏览器兼容方式 <!--[if IE]> <script src=”http://apps.bdimg.com/libs/html5shiv/3.7/html5s ...

  9. [Javascript] Convert a forEach method to generator

    For example we have a 'forEach' method which can loop though a linked list: forEach(fn) { let node = ...

  10. 【题解】P3069 [USACO13JAN]牛的阵容Cow Lineup-C++

    题目传送门 思路这道题目可以通过尺取法来完成 (我才不管什么必须用队列)什么是尺取法呢?顾名思义,像尺子一样取一段,借用挑战书上面的话说,尺取法通常是对数组保存一对下标,即所选取的区间的左右端点,然后 ...