亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

急求解test testqueryByIdWithSeckill 報錯 java.lang.NullPointerException的問題?

急求解test testqueryByIdWithSeckill 報錯 java.lang.NullPointerException的問題?

葉雪松 2017-03-27 22:27:15
三月 27, 2017 10:26:03 下午 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.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]三月 27, 2017 10:26:03 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper instantiateListeners信息: Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/web/context/request/RequestAttributes]三月 27, 2017 10:26:03 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners信息: Using TestExecutionListeners: [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@dbd940d, org.springframework.test.context.support.DirtiesContextTestExecutionListener@71d15f18, org.springframework.test.context.transaction.TransactionalTestExecutionListener@17695df3, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@6c9f5c0d]三月 27, 2017 10:26:04 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]三月 27, 2017 10:26:07 下午 org.springframework.context.support.GenericApplicationContext prepareRefresh信息: Refreshing org.springframework.context.support.GenericApplicationContext@69b794e2: startup date [Mon Mar 27 22:26:07 CST 2017]; root of context hierarchy三月 27, 2017 10:26:07 下午 org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties信息: Loading properties file from class path resource [jdbc.properties]三月 27, 2017 10:26:07 下午 com.mchange.v2.log.MLog <clinit>信息: MLog clients using java 1.4+ standard logging.三月 27, 2017 10:26:07 下午 com.mchange.v2.c3p0.C3P0Registry banner信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]三月 27, 2017 10:26:08 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 1000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1bop2qf9n4heyc112k2pnk|146dfe6, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1bop2qf9n4heyc112k2pnk|146dfe6, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 30, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]Mon Mar 27 22:26:08 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:08 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:08 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.Mon Mar 27 22:26:09 CST 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.seckill:null
查看完整描述

1 回答

?
葉雪松

TA貢獻3條經驗 獲得超1個贊


package org.seckill.dao;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.seckill.entity.SuccessKilled;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring/spring-dao.xml"})
public class SucessKilledDaoTest {
?? ?
?? ?@Autowired
?? ?private SuccessKilledDao successKilledDao;

?? ?@Test
?? ?public void testinsertSuccessKilledDao() {
?? ??? ?/*
?? ??? ? * 第一次執行?? insertCount:1
?? ??? ? * 第二次執行?? insertCount:0
?? ??? ? * 第三次執行?? insertCount:0
?? ??? ? * 說明什么? 一個userid只可以秒殺一次,不可以重復秒殺QAQ
?? ??? ? */
?? ??? ?long itemid = 1000L;
?? ??? ?long userid = 2013002L;
?? ??? ?int insertCount = successKilledDao.insertSuccessKilled(itemid, userid);
?? ??? ?System.out.println("insertCount:" + insertCount);
?? ?}
?? ?
?? ?@Test
?? ?public void testqueryByIdWithSeckill() {
?? ??? ?long itemid = 1000L;
?? ??? ?long userid = 2013000L;
?? ??? ?SuccessKilled seckill = successKilledDao.queryByIdWithSeckill(itemid, userid);
?? ??? ?System.out.println("seckill:" + seckill);
?? ??? ?System.out.println("*********/n" + seckill.getSeckill());
?? ?}
}

查看完整回答
反對 回復 2017-03-27
  • 1 回答
  • 0 關注
  • 2706 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號