连接到多主机时,EclipseLink异常“连接为只读”

时间:2019-04-24 04:53:34

标签: java mysql

  • 在persistence.xm l文件中:

    <properties>
          <property name="javax.persistence.jdbc.url" value="jdbc:mysql://192.168.0.13:3306,192.168.0.14:3306/test?zeroDateTimeBehavior=convertToNull&amp;useUnicode=yes&amp;characterEncoding=UTF-8"/>
          <property name="javax.persistence.jdbc.user" value="test"/>
          <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
          <property name="javax.persistence.jdbc.password" value="test"/>
          <property name="eclipselink.logging.level.sql" value="FINE"/>
        </properties>

  • 长时间运行时出现异常:
  

内部异常:java.sql.SQLException:连接是只读的。   不允许进行导致数据修改的查询错误代码:0   致电:INSERT INTO vqmm_test(帐户,代码,说明,is_free,   lastupdate,program_code,received_at,send_sms,service_id,sms,   sms_content,sms_detail,状态,created_at,id)值(?,?,?,?,   ?,?,?,?,?,?,?,?,?,?,?)bind => [15个参数绑定]查询:   InsertObjectQuery(promote.entity.VqmmLuckyCode [   vqmmLuckyCodePK = promote.entity.VqmmLuckyCodePK [id = 0,createdAt = Tue   4月23日14:30:55 ICT 2019]])在   org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:157)     在promote.session.BaseSession.saveBulk(BaseSession.java:209)处   Promotion.session.BaseSession.saveBulk3(BaseSession.java:305)位于   Promotion.main.Promote.doSaveLog(Promote.java:287)位于   Promotion.main.PromoteThread.run(PromoteThread.java:67)在   java.lang.Thread.run(Thread.java:748)原因:异常   [EclipseLink-4002](Eclipse持久性服务-   2.5.2.v20140319-9ad6abd):org.eclipse.persistence.exceptions.DatabaseException内部   异常:java.sql.SQLException:连接是只读的。查询   不允许进行数据修改错误代码:0呼叫:   INSERT INTO vqmm_test(帐户,代码,说明,is_free,   lastupdate,program_code,received_at,send_sms,service_id,sms,   sms_content,sms_detail,状态,created_at,id)值(?,?,?,?,   ?,?,?,?,?,?,?,?,?,?,?)bind => [15个参数绑定]查询:   InsertObjectQuery(promote.entity.VqmmLuckyCode [   vqmmLuckyCodePK = promote.entity.VqmmLuckyCodePK [id = 0,createdAt = Tue   4月23日14:30:55 ICT 2019]])在   org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331)     在   org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:900)     在   org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:962)     在   org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:631)     在   org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558)     在   org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002)     在   org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:298)     在   org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)     在   org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)     在   org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:377)     在   org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:165)     在   org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:180)     在   org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:489)     在   org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)     在   org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)     在   org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:301)     在   org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)     在   org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)     在   org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:798)     在   org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)     在   org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)     在   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)     在   org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)     在   org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)     在   org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1737)     在   org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:226)     在   org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:125)     在   org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:4207)     在   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1441)     在   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1531)     在   org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:277)     在   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1169)     在   org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:132)     ... 5更多原因:java.sql.SQLException:连接是只读的。   无法进行导致数据修改的查询   com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)在   com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)位于   com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)在   com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)位于   com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)     在   com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2375)     在   com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2359)     在   org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:890)     ...另外36个

` 有人可以帮我解决吗? JPA转换支持多主机还是mysql集群连接?

0 个答案:

没有答案