1、List使用前需要new實例,不能List<String> list=null,這樣會報出異常。
List正確使用:
List<String> list=new ArrayList();
2、異常報錯,如何準確鎖定錯誤位置,可在catch代碼裏添加e.printStackTrace();即可。
catch (Exception e) {
e.printStackTrace();
throw new SessionBeanException("操作失敗");
}
3、Null pointer access: The variable amountBean can only be null at this location
報錯原因:在初始化JavaBean的時候,應該new實例。如果直接XXBean bean=null,就會報錯。