spring3 + mybatis + maven:junit测试错误

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [G:\workspaces\workspace_gmq\springmvc.demo\target\classes\com\gmq\service\impl\UserServiceImpl.class]; nested exception is java.lang.IllegalArgumentException
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:261)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1435)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1425)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.gmq.test.UserTest.test_insert(UserTest.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalArgumentException
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.asm.ClassReader.<init>(Unknown Source)
at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:52)
at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101)
at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:237)
... 47 more

时间: 2024-10-27 00:13:04

spring3 + mybatis + maven:junit测试错误的相关文章

Junit测试错误:### Error building SqlSession

错误代码: org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession.### The error may exist in com/jkw100/mybatis/mapper/PatientMapper.xml### The error occurred while processing mapper_resultMap[BaseResultMap]### Cause: org.apache.

搭建项目Maven+springMVC+hibernate时,JUnit测试出现报ClassNotFoundException错误的解决

最近在搭建Maven+springMVC+hibernate项目,正常启动项目时一切正常,但JUNIT测试时出现报ClassNotFoundException错误,经过仔细排查发现没有生成class文件. 现在解决如下:

详解intellij idea搭建SSM框架(spring+maven+mybatis+mysql+junit)(上)

SSM(Spring+SpringMVC+MyBatis)框架集由Spring.SpringMVC.MyBatis三个开源框架整合而成,常作为数据源较简单的web项目的框架. 其中spring是一个轻量级的控制反转(IoC)和面向切面(AOP)的容器框架. SpringMVC分离了控制器.模型对象.分派器以及处理程序对象的角色,这种分离让它们更容易进行定制. MyBatis是一个支持普通SQL查询,存储过程和高级映射的优秀持久层框架. 本文旨在快速且详细的介绍intellij idea 搭建SS

spring && Cobertura && maven &&junit 单元测试以及测试覆盖率

1. 目的: junit 单元测试,Cobertura   测试覆盖率报告 项目目录结构 2. maven 配置 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://mave

Junit测试代码时出现initializationError 错误

首先代码没有错误,执行Junit测试时出现以上错误.上网查资料发现少了包 从网上下载了一个jar包解决了hamcrest-core-1.3.jar 现在下载包搜索的好多坑,有的网站必须注册才能下载,而且下载的有的还是 很垃圾.所以给大家推荐一个下载网站:http://www.java2s.com  平时找包就so easy了

Struts2+Spring+Mybatis+Junit 测试

Struts2+Spring+Mybatis+Junit 测试 博客分类: HtmlUnit Junit Spring 测试 Mybatis Java代码   package com.action.kioskmonitor; /** * Junit群体测试Struts2 .spring.Mybatis */ import static org.junit.Assert.assertNotNull; import java.util.List; import java.util.UUID; imp

Maven学习三 使用junit测试maven project

每个开发人员都会对自己的代码进行自定义的测试,可以是把项目run起来,手动点点页面按钮,看看操作场景和步骤点是否符合业务需要,是否存在UE上的问题.也有自己写几个测试类,把service类的输入输出是否符合标准都测试一番,这两大类,其实就是包括了前后端的测试工作,分工各有不同.在maven中集成了junit测试包,应该说maven可以集成任何你想的到或者想不到工具插件. 在maven project-01项目中引入junit插件并不困难,只需要在pom.xml中配置好依赖包即可(IDE环境下,依

MyBatis运行逆向工程测试类出现错误

This is not a MyBatis Generator Configuration File 错误原因:DTD格式声明 log4j:WARN No appenders could be found for logger 错误原因:没有配置log4j,即缺少log4j.properties,在src目录下添加 原文地址:https://www.cnblogs.com/ddpapa/p/11785475.html

搭建SpringMVC+Hibernate4+Spring3+Ajax+Maven项目

首先新建一个Maven项目,百度一下会有很多实例,这里就不介绍了,直接奔主题. 如题:这里使用的是Hibernate4和Spring3,使用的JPA和Spring注解,然后JDK版本是1.7 下面这张图片演示的是整个项目的结构图. ------------------------------------------------------- --------------------------------------------------- 首先配置pom.xml,将所需的jar包配置好,如下