SSH整合異常解決(creating bean with name 'sessionFactory' defined in class path)
整合SSH注解的方式,但是一直有異常。還是解決了,貼出來。
[org.springframework.web.context.ContextLoader]: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
看到這個(gè)異常,首先我以為我沒導(dǎo)hibernate的相關(guān)包,所以去找包,但是發(fā)現(xiàn)沒少;最后又把包整合了一下,還是沒少hibernate的相關(guān)包。
一個(gè)包一個(gè)包找所有包都找了一遍發(fā)現(xiàn)好像少了一個(gè)javassist的包,然后把這個(gè)包導(dǎo)進(jìn)去,奇跡般的不報(bào)錯(cuò)了;然后啟動(dòng)服務(wù)器好了。
特意去網(wǎng)上找了javassist包的作用,描述如下:
javassist----代碼生成工具,Hibernate用它在運(yùn)行時(shí)擴(kuò)展Java類和實(shí)現(xiàn),同cglib包。
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選