ssh整合中遇到的問題及解決記錄
1.
P:BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
S:問題在hibernate.cfg.xml中,需要刪除<property name="current_session_context_class">thread</property>
2.
P:Caused by: java.lang.IllegalArgumentException at org.springframework.asm.ClassReader.<init>(Unknown Source)
S:stackoverflow裡面大神所講的,是jdk不相容
3.
P:Exception occurred during processing request: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
S:開啟OpenSessionInViewFilter來阻止延遲載入的錯誤的時候丟擲了這個異常:org.springframework.dao.InvalidDataAccessApiUsageException錯誤
但是在我們開啟OpenSessionInViewFilter這個過濾器的時候FlushMode就已經被預設設定為了MANUAL!
給filter注入引數
<init-param>
<param-name>flushMode</param-name>
<param-value>AUTO</param-value>
</init-param>
4.
P:java.lang.IllegalArgumentException: id to load is required for loading
S:如果訪問*.jsp檔案時,因為進行新增時,首先會先查詢關聯關係中的測試專案的Id ,獲取到之後再進行新增的操作,如果獲取不到測試專案的id,那麼將會丟擲一個異常,要儲存的類相關聯的類的id無法找到,因此需要重新從資料庫中查詢
5.
P:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
s:多出現在增加和修改物件的情境中,兩個方法公用一個saveOrUpdate(entity)
在新增物件的jsp中應該處理好隱藏域的問題例如:<s:if test="courseTypeId!=null">
<s:hidden name="courseTypeId"></s:hidden>
</s:if>
6.
P:There is no Action mapped for action name courseTypeAction_getAll. - [unknown location]
S:無法生成通過spring生成action,所做的嘗試有:修改struts.xml和applicationContext.xml,以及請求的相關引數,也有可能是jsp標籤無法正常顯示,新增的s:debug不合適;還有hibernate orm 對映檔案。注意set標籤新增table屬性;