tag in web.xml doesn't catch java.lang.Throwable Exceptions

后端 未结 2 684
無奈伤痛
無奈伤痛 2020-12-11 09:51

I have a web-app developed with servlet & JSP. I configured my app to throw an IllegalArgumentException if I insert bad parameters. Then I configured my web

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 10:23

    I have today the same issue. (JavaEE 7 and Glassfish 4.0)

    The problem seems that the framework check it as String instead with the Class.

    String based check (the hypothesis)

    When a Exception is twrown, e.getClass() is compared with as string. So you can't use inheritance.

    Note that nested classes must be pointed as '$' instead '.' (same as getClass() method).

    Class based check

    The framework create an instance of the class, and text refer to it, and the class.isInstance() is used to check.

    This will need reflection and policy file could break it.

    I hope that this response solves future issues.

提交回复
热议问题