为了账号安全,请及时绑定邮箱和手机立即绑定

java高并发Junit测试问题

java高并发Junit测试问题

mjka5632 2016-12-03 11:22:29
java.lang.NoClassDefFoundError: Lorg/seckill/dao/SeckillDao; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2317) at java.lang.Class.getDeclaredFields(Class.java:1762) at org.junit.runners.model.TestClass.<init>(TestClass.java:49) at org.junit.runners.ParentRunner.<init>(ParentRunner.java:75) at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:111) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:31) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestMethodReference.<init>(JUnit4TestMethodReference.java:25) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:54) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)Caused by: java.lang.ClassNotFoundException: org.seckill.dao.SeckillDao at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 26 morespring-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-3.1.xsd"> <!-- 配置整合mybatis过程 --> <!-- 1.配置数据库相关参数 --><!-- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:jdbc.properties</value> </property> <property name="fileEncoding" value="utf-8" /> </bean> --> <context:property-placeholder location="classpath:jdbc.properties"/> <!-- 2.配置连接池属性 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooleDataSource"> <!-- 配置连接池属性 --> <property name="driverClass" value="${driver}" /> <property name="jdbcUrl" value="${url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${password}" /> <!-- c3p0连接池私有属性 --> <property name="maxPoolSize" value="30"/> <property name="minPoolSize" value="10"/> <!-- 关闭连接后不能自动commit --> <property name="autoCommitOnClose" value="false"/> <!-- 获取连接超时时间 --> <property name="checkoutTimeout" value="1000"/> <!--  获取连接失败重试次数--> <property name="acquireRetryAttempts" value="2"/> </bean> <!-- 3.配置SqlSessionFactory --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <!-- 注入数据库连接池 --> <property name="dataSource" ref="dataSource"/> <!-- 配置mybatis全局配置文件 --> <property name="configLocations" value="classpath:mybatis-config.xml"/> <!-- 扫描sql配置文件 --> <property name="mapperLocations" value="mapper/*.xml"/> <!-- 扫描entity包 使用别名 --> <property name="typeAliasesPackage" value="org.seckill.entity"/> </bean> <!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到Spring容器中 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!-- 注入sqlSessionFactory --> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> <!-- 给出扫描Dao接口包 --> <property name="basePackage" value="org.seckill.dao"/> </bean></beans>
查看完整描述

2 回答

?
永恒神话ch

TA贡献1条经验 获得超0个赞

楼主怎么解决的,我现在也遇到这个问题。。。。

查看完整回答
反对 回复 2017-04-02
?
Its_forever

TA贡献361条经验 获得超328个赞

没找到这个类SeckillDao。

检查有没有这个类,

有就重新编译一下。

查看完整回答
反对 回复 2016-12-03
  • mjka5632
    mjka5632
    怎么编译啊,你看看,我的目录结构对吗?
  • Its_forever
    Its_forever
    额。没有配置文件,目录结构也看不出来什么啊。编译就是idea就是build啊。eclipse就是重新部署啊。部署之前清理一下缓存。
  • mjka5632
    mjka5632
    是这个配置文件吗?你看看
点击展开后面4
  • 2 回答
  • 0 关注
  • 2325 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信