# blade create servlet throwCustomException

## 介绍

Java web 请求异常

## 参数

以下是此场景特有参数，通用参数详见：\[blade create servlet]\(blade create servlet.md)

```
--exception string           异常类，带全包名，必须继承 java.lang.Exception 或 java.lang.Exception 本身
--exception-message string   指定异常类信息，默认值是 chaosblade-mock-exception
```

## 案例

访问 <http://localhost:8080/dubbodemo/hello?code=1> 请求异常，影响 3 条请求

```
blade c servlet throwCustomException --exception org.springframework.beans.BeansException --exception-message mock-beans-exception --requestpath /hello --effect-count 3

{"code":200,"success":true,"result":"d4a63f4f59f76f4a"}
```

访问请求进行验证。

![](https://3224380698-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lj_V1osBR9CfezpYfj_%2Fuploads%2Fgit-blob-022c224340937eb07f2514435c9196043ec95493%2F15759566028886.jpg?alt=media)

查看日志，通过日志也可以看出 ![](https://3224380698-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lj_V1osBR9CfezpYfj_%2Fuploads%2Fgit-blob-98397776b4e086436340d84e149fc2b59cd3b38b%2F15759567480821.jpg?alt=media)

## 实验原理

## 常见问题
