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屬性;







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章