ssh中异常总结
2017-07-27 09:29
786 查看
09:29:14,596 ERROR DefaultDispatcherErrorHandler:42 - 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.
org.springframework.dao.InvalidDataAccessApiUsageException: 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.
原因:ssh中使用注解开发,将hibernate交给spring容器,但是忘记在service中使用事务注解@Transactional,加上即可。
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager'
defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
原因:ssh开发时,全部使用配置文件方式,在applicationContext.xml中使用的是c3p0连接池,而hibernate.cfg.xml中没有配置连接池,将连接池添加上去即可。
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
相关文章推荐
- 总结SSH阶段常见的异常系列之一hibernate
- 总结SSH阶段常见异常系列之三struts2
- 总结SSH阶段常见异常系列之五spring
- SSH 异常 解决 方案 总结
- web使用ssh开发异常总结
- java_ssh_架包缺失异常总结
- 总结SSH阶段常见的异常系列之二hibernate续
- 总结SSH阶段常见异常之四struts2续
- SSH 搭建异常总结
- web使用ssh开发异常总结
- SSH整合异常总结
- 总结SSH阶段常见的异常系列之一hibernate
- ssh整合问题总结--运行项目时报java.lang.StackOverflowError(堆栈溢出)异常
- Java基础学习总结(76)——Java异常深入学习研究
- SSH——hibernate阶段总结(一)
- 趣图:吐血总结,异常处理的最佳实践
- Java异常总结
- 线上异常排查总结
- SSH中的java项目经验一些总结
- 今天在做一个SSH整合测验时发现了一个异常(According to TLD or attribute directive in tag file)