課程
/后端開發(fā)
/Java
/SpringBoot構(gòu)建電商基礎秒殺項目
在數(shù)據(jù)校驗的時候出現(xiàn)異常
BusinessException:null
數(shù)據(jù)正確的時候程序是完全正確的
2019-04-21
源自:SpringBoot構(gòu)建電商基礎秒殺項目 3-12
正在回答
因為?public class BusinessException extends Exception :這說明了你的查詢是沒有錯的,只不過是數(shù)據(jù)庫沒有對應的數(shù)據(jù)報了一個這樣的錯誤【java.lang.NullPointerException: null】空指針異常。
if (ex instanceof BusinessException) {BusinessException?businessException?=?(BusinessException)?ex;
把NullPointerException?強轉(zhuǎn)成了BusinessException?格式的異常所以就是下面這個樣子了:
java.lang.NullPointerException: null? ==?BusinessException:null
舉報
應用SpringBoot快速搭建擁有用戶、商品、交易及秒殺活動的電商秒殺應用。
2 回答為什么一加consumes這個注解就出錯啊
1 回答為什么說commonError是Em這個類
4 回答配置了鏡子,但還是無法導入這個玩意兒emmm,這是怎么回事。。。求解答
3 回答這是什么錯
4 回答請問這是什么問題呢,好久都沒能解決
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2019-08-11
BusinessException:null?這個只不過是一個封裝的異常信息。
因為?public class BusinessException extends Exception :這說明了你的查詢是沒有錯的,只不過是數(shù)據(jù)庫沒有對應的數(shù)據(jù)報了一個這樣的錯誤【java.lang.NullPointerException: null】空指針異常。
if (ex instanceof BusinessException) {BusinessException?businessException?=?(BusinessException)?ex;
把NullPointerException?強轉(zhuǎn)成了BusinessException?格式的異常所以就是下面這個樣子了:
java.lang.NullPointerException: null? ==?BusinessException:null