zoukankan      html  css  js  c++  java
  • HTTP Status 500

    HTTP Status 500 - 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. type Exception report message Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTOor remove 'readOnly' marker from transaction definition.

    description The server encountered an internal error that prevented it from fulfilling this request. exception 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.

    org.springframework.orm.hibernate5.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1126) org.springframework.orm.hibernate5.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:619) org.springframework.orm.hibernate5.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:616) org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:341)

     .....

    HTTP状态500-写入操作不允许在只读模式(FlushMode.MANUAL)中进行:将会话转换为FlushMode.COMMIT/AUTO,或从事务定义中删除“readOnly”标记。

    错误原因:

    代码中使用了@Transactional注解事务,因为你没有在applicationContext.xml中配置事务自动扫描,而使用了默认的只读模式,不能随代码运行自动刷新,

    更正方法:

    在applicationContext.xml文件中增加配置:

        <!--配置事务管理器 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
            <property name="sessionFactory" ref="sessionFactory"></property>
        </bean>
        <!-- 开启事务扫描,采用注解方式 -->
        <tx:annotation-driven transaction-manager="transactionManager" />

    每天分享一个错误,快乐成长每一天!

  • 相关阅读:
    Office365常用的命令(持续更新中)
    7:OracleRAC安装配置(19C)
    5:安装配置 Oracle18C
    课程7:邮箱的备份恢复
    课程6: powershell运维
    Exchange2013之HTTP重定向
    Powershell运维:导出Exchange系统里面所有用户的邮箱
    灾难恢复:恢复已经删除的邮箱(AD账号也被删除,14天内)
    灾难恢复:恢复丢失的exchange服务器
    2:Oracle体系结构(物理结构)
  • 原文地址:https://www.cnblogs.com/niusdtz/p/9625926.html
Copyright © 2011-2022 走看看