SSH 問題解決部分方案

 

 

嚴重: Exception sending context initialized event to listener instanceof class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'sessionFactory' defined in ServletContextresource [/WEB-INF/applicationContext.xml]: Invocation of init method failed;nested exception is org.hibernate.MappingNotFoundException: resource:com/hwb/entity/Money.hbm.xml not found

    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)

 

。。。。

解決方案

 

這問題是指hibernate.Cfg.xml文件的索引寫的有問題即

 

 

 

 Error creating bean with name 'moneyDao' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/hibernate/Session

 

 

版本問題:

解決方案:daoimpl

 

 

org.springframework.dao.DataIntegrityViolationException:not-null property references a null or transient value:com.bank.entity.Money.user; nested exception isorg.hibernate.PropertyValueException: not-null property references a null ortransient value: com.bank.entity.Money.user

 

 

 

解決方案:user中沒有值;

 

 

 

 

3、關於對數據的修改,當在頁面進行修改操作時當返回成功頁面,控制檯輸出sql語句,但數據庫數據沒有進行修改時,說明在applicationContext.xml中事物方法書寫有問題,需進行檢測。或直接在Basdao中進行明碼輸入即

 

Session session = getHibernateTemplate().getSessionFactory().openSession();

           Transactiontran = session.beginTransaction();

           session.update(money);

           tran.commit();

 

 

 

 

Error creating bean with name 'usersevice'defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Errorsetting property values; nested exception isorg.springframework.beans.NotWritablePropertyException: Invalid property'userDao' of bean class [com.bank.sevice.impl.Userseviceimpl]: Bean property'userDao' is not writable or has an invalid setter method. Does the parametertype of the setter match the return type of the getter?

兩個必須相同否則就報錯

 

 

嚴重: Exception sending context initialized event tolistener instance of classorg.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException: Error creatingbean with name 'regionalDao' defined in ServletContext resource[/WEB-INF/applicationContext.xml]: Error setting property values; nestedexception is org.springframework.beans.NotWritablePropertyException: Invalidproperty 'sessionFactory' of bean class [com.sshrsms.dao.impl.RegionalDaoImpl]:Bean property 'sessionFactory' is not writable or has an invalid setter method.Does the parameter type of the setter match the return type of the getter?

    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1344)

解決方案

 

 

500-Invalid action class configuration thatreferences an unknown class named [userAction]

解決方法:

Form表單name元素書寫錯誤,導致無法自動創建Action所以檢測表單傳值是否有問題name書寫是否有錯誤/.

 

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