老师你帮看看哪里错了吗,导入的包应该没错了,不知道为什么老是验证不了

来源:2-7 验证Dao

qq_独闭关中_0

2019-07-15

七月 15, 2019 1:30:05 上午 org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
七月 15, 2019 1:30:05 上午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@68837a77, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@6be46e8f, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@3567135c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@327471b5, org.springframework.test.context.transaction.TransactionalTestExecutionListener@4157f54e, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@90f6bfd]
七月 15, 2019 1:30:05 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]
七月 15, 2019 1:30:05 上午 org.springframework.context.support.GenericApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.GenericApplicationContext@20e2cbe0: startup date [Mon Jul 15 01:30:05 CST 2019]; root of context hierarchy
七月 15, 2019 1:30:05 上午 com.mchange.v2.log.MLog
信息: MLog clients using java 1.4+ standard logging.
七月 15, 2019 1:30:06 上午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
01:30:06.436 [main] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using ‘class org.apache.ibatis.logging.slf4j.Slf4jImpl’ adapter.
01:30:06.526 [main] DEBUG org.apache.ibatis.io.VFS - Class not found: org.jboss.vfs.VFS
01:30:06.526 [main] DEBUG org.apache.ibatis.io.JBoss6VFS - JBoss 6 VFS API is not available in this environment.
01:30:06.526 [main] DEBUG org.apache.ibatis.io.VFS - Class not found: org.jboss.vfs.VirtualFile
01:30:06.527 [main] DEBUG org.apache.ibatis.io.VFS - VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
01:30:06.528 [main] DEBUG org.apache.ibatis.io.VFS - Using VFS adapter org.apache.ibatis.io.DefaultVFS
01:30:06.528 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Find JAR URL: file:/C:/Users/QSF/eclipse-workspace/bysj/target/classes/com/qsf/bysj/entity
01:30:06.528 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Not a JAR: file:/C:/Users/QSF/eclipse-workspace/bysj/target/classes/com/qsf/bysj/entity
01:30:06.573 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: Area.class
01:30:06.574 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: HeadLine.class
01:30:06.574 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: localAuth.class
01:30:06.574 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: PersonInfo.class
01:30:06.575 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: Product.class
01:30:06.575 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: ProductCategory.class
01:30:06.576 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: ProductImg.class
01:30:06.576 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: Shop.class
01:30:06.576 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: ShopCategory.class
01:30:06.577 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: WechatAuth.class
01:30:06.578 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Listing file:/C:/Users/QSF/eclipse-workspace/bysj/target/classes/com/qsf/bysj/entity
01:30:06.578 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Find JAR URL: file:/C:/Users/QSF/eclipse-workspace/bysj/target/classes/com/qsf/bysj/entity/Area.class
01:30:06.578 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Not a JAR: file:/C:/Users/QSF/eclipse-workspace/bysj/target/classes/com/qsf/bysj/entity/Area.class
01:30:06.581 [main] DEBUG org.apache.ibatis.io.DefaultVFS - Reader entry: ����

写回答

4回答

翔仔

2019-07-15

先按照我前面说的做哈,然后再看看这个,复制粘贴覆盖你的spirng-dao.xml试试

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">
	<!-- 配置整合mybatis过程 -->
	<!-- 1.配置数据库相关参数properties的属性:${url} -->
	<context:property-placeholder location="classpath:jdbc.properties"/>
	<!-- 2.数据库连接池 -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<!-- 配置连接池属性 -->
		<property name="driverClass" value="${jdbc.driver}" />
		<property name="jdbcUrl" value="${jdbc.url}" />
		<property name="user" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />

		<!-- c3p0连接池的私有属性 -->
		<property name="maxPoolSize" value="30" />
		<property name="minPoolSize" value="10" />
		<!-- 关闭连接后不自动commit -->
		<property name="autoCommitOnClose" value="false" />
		<!-- 获取连接超时时间 -->
		<property name="checkoutTimeout" value="10000" />
		<!-- 当获取连接失败重试次数 -->
		<property name="acquireRetryAttempts" value="2" />
	</bean>

	<!-- 3.配置SqlSessionFactory对象 -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<!-- 注入数据库连接池 -->
		<property name="dataSource" ref="dataSource" />
		<!-- 配置MyBaties全局配置文件:mybatis-config.xml -->
		<property name="configLocation" value="classpath:mybatis-config.xml" />
		<!-- 扫描entity包 使用别名 -->
		<property name="typeAliasesPackage" value="com.imooc.o2o.entity" />
		<!-- 扫描sql配置文件:mapper需要的xml文件 -->
		<property name="mapperLocations" value="classpath:mapper/*.xml" />
	</bean>

	<!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<!-- 注入sqlSessionFactory -->
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
		<!-- 给出需要扫描Dao接口包 -->
		<property name="basePackage" value="com.imooc.o2o.dao" />
	</bean>
</beans>

程序说1是1,不可能大家都行就自己的不行,肯定还是哪里配置错了

0
3
qq_独闭关中_0
回复
翔仔
不是,是今年最新版本的eclipse
2019-07-16
共3条回复

翔仔

2019-07-15

感觉是同学的jar的有问题,可以直接按照我的进行配置

pom.xml

<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://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.imooc</groupId>
	<artifactId>o2o</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>o2o Maven Webapp</name>
	<url>http://maven.apache.org</url>
	<properties>
		<spring.version>5.1.8.RELEASE</spring.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>1.2.3</version>
		</dependency>
		<!-- Spring -->
		<!-- 1)包含Spring 框架基本的核心工具类。Spring 其它组件要都要使用到这个包里的类,是其它组件的基本核心 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 2)这个jar 文件是所有应用都要用到的,它包含访问配置文件、创建和管理bean 以及进行Inversion of Control 
			/ Dependency Injection(IoC/DI)操作相关的所有类。如果应用只需基本的IoC/DI 支持,引入spring-core.jar 
			及spring-beans.jar 文件就可以了。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 3)这个jar 文件为Spring 核心提供了大量扩展。可以找到使用Spring ApplicationContext特性时所需的全部类,JDNI 
			所需的全部类,instrumentation组件以及校验Validation 方面的相关类。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 4) 这个jar 文件包含对Spring 对JDBC 数据访问进行封装的所有类。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 5) 为JDBC、Hibernate、JDO、JPA等提供的一致的声明式和编程式事务管理。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 6)Spring web 包含Web应用开发时,用到Spring框架时所需的核心类,包括自动载入WebApplicationContext特性的类、Struts与JSF集成类、文件上传的支持类、Filter类和大量工具辅助类。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 7)包含SpringMVC框架相关的所有类。 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- 8)Spring test 对JUNIT等测试框架的简单封装 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
			<scope>test</scope>
		</dependency>
		<!-- Servlet web -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>4.0.1</version>
		</dependency>
		<!-- json解析 -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.9.9</version>
		</dependency>
		<!-- Map工具类 对标准java Collection的扩展 spring-core.jar需commons-collections.jar -->
		<dependency>
			<groupId>commons-collections</groupId>
			<artifactId>commons-collections</artifactId>
			<version>3.2.2</version>
		</dependency>
		<!-- DAO: MyBatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.5.1</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>2.0.1</version>
		</dependency>
		<!-- 数据库 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.16</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
		<dependency>
			<groupId>com.mchange</groupId>
			<artifactId>c3p0</artifactId>
			<version>0.9.5.4</version>
		</dependency>

		<!-- 图片处理 -->
		<!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator -->
		<dependency>
			<groupId>net.coobird</groupId>
			<artifactId>thumbnailator</artifactId>
			<version>0.4.8</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/com.github.penggle/kaptcha -->
		<dependency>
			<groupId>com.github.penggle</groupId>
			<artifactId>kaptcha</artifactId>
			<version>2.3.2</version>
		</dependency>
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<version>1.3.2</version>
		</dependency>
		<!-- redis客户端:Jedis -->
		<dependency>
			<groupId>redis.clients</groupId>
			<artifactId>jedis</artifactId>
			<version>2.9.0</version>
		</dependency>
	</dependencies>
	<build>
		<finalName>o2o</finalName>
		<plugins>
			<plugin>
				<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

配置完成后,

需要看看maven和本地的eclipse是否已经联通,具体参考截图或者视频

//img.mukewang.com/szimg/5d2c9b93095dc40314041066.jpg

配置好之后,去到截图的repository目录,也就是你maven的repository目录下,把所有jar全部清空,然后重新右键项目update maven project试试

0
2
翔仔
回复
qq_独闭关中_0
不建议说应该哈,一步步排查呢,先按照上面说的尝试一下,然后build project试试
2019-07-15
共2条回复

翔仔

2019-07-15

同学好,可以像这位热心的同学说的那样,提供下ut failure trace里面报的什么异常,或者可以尝试百度查找异常解决下,锻炼独立解决问题的能力

0
1
qq_独闭关中_0
老师,这个问题我已经解决了,现在有发现了新的问题,工程上的包我都导入了,也显示正常,写着写着,突然间spring下的xml文件有报错了,我没改过,这是怎么回事?
2019-07-15
共1条回复

突出部作战

2019-07-15

验证不了是啥意思?看看你的ut failure trace里面报的什么异常 

0
0

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程