首页新闻找找看学习计划

为什么我的程序启动总是报rabbitMQ的监听器失败?还重复的报,控制台一直在刷?

0
[已解决问题] 解决于 2016-09-21 09:51

2016-09-20 18:00:09 [WARN] Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method 'handleMessage' threw exception
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:395)
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:298)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:777)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:700)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:95)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:187)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1187)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:681)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1165)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1149)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1100(SimpleMessageListenerContainer.java:95)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1312)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.dao.DuplicateKeyException:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid)         VALUES (?, ?, ? )
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
; SQL []; Duplicate entry '30875912' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
    at com.sun.proxy.$Proxy30.insert(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:253)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:52)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
    at com.sun.proxy.$Proxy85.patformErpOrderRefAdd(Unknown Source)
    at com.rabbitmq.service.AckErpQueueListenter.handleMessage(AckErpQueueListenter.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:387)
    ... 12 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
    at com.mysql.jdbc.Util.getInstance(Util.java:360)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:971)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
    at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1199)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
    at com.sun.proxy.$Proxy39.execute(Unknown Source)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73)
    at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
    at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)
    at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:386)
    ... 24 more
2016-09-20 18:00:09 [DEBUG] AckErpQueueListenter Receive an EventMessage: [EopEventMessage [queueName=QUEUE_RONGYIJU_ACK_01, exchangeName=EXCHANGE_DIRECT_RONGYIJU_01, eventData=[99, 0, 1, 77, 116, 0, 22, 99, 111, 109, 46, 114, 97, 98, 98, 105, 116, 109, 113, 46, 109, 111, 100, 101, 108, 46, 65, 99, 107, 83, 0, 14, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 100, 83, 0, 36, 55, 102, 52, 100, 100, 99, 102, 102, 45, 102, 55, 98, 98, 45, 52, 53, 49, 48, 45, 56, 101, 53, 55, 45, 51, 101, 48, 98, 98, 57, 52, 100, 50, 97, 53, 98, 83, 0, 16, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 100, 97, 116, 101, 83, 0, 13, 49, 52, 55, 52, 51, 53, 57, 51, 53, 48, 52, 55, 51, 83, 0, 4, 98, 117, 105, 100, 83, 0, 54, 123, 34, 117, 105, 100, 34, 58, 49, 52, 51, 49, 51, 52, 49, 51, 44, 34, 114, 79, 114, 100, 101, 114, 73, 100, 34, 58, 51, 48, 56, 55, 53, 57, 49, 50, 44, 34, 101, 79, 114, 100, 101, 114, 73, 100, 34, 58, 49, 57, 53, 57, 55, 48, 125, 83, 0, 12, 112, 97, 114, 116, 110, 101, 114, 95, 99, 111, 100, 101, 78, 83, 0, 11, 114, 101, 99, 101, 105, 118, 101, 114, 95, 105, 100, 78, 83, 0, 13, 114, 101, 99, 101, 105, 118, 101, 114, 95, 110, 97, 109, 101, 78, 83, 0, 12, 109, 101, 115, 115, 97, 103, 101, 95, 116, 121, 112, 101, 78, 83, 0, 12, 115, 117, 99, 99, 101, 115, 115, 95, 102, 108, 97, 103, 78, 83, 0, 17, 101, 120, 99, 101, 112, 116, 105, 111, 110, 95, 100, 101, 116, 97, 105, 108, 115, 78, 122, 122]]]
2016-09-20 18:00:09 [INFO] AckErpQueueListenter EventMessage on Content: [{"uid":14313413,"rOrderId":30875912,"eOrderId":195970} ]
2016-09-20 18:00:09 [DEBUG] Creating a new SqlSession
2016-09-20 18:00:09 [DEBUG] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@79441bfa] was not registered for synchronization because synchronization is not active
2016-09-20 18:00:09 [DEBUG] JDBC Connection [jdbc:mysql://192.168.10.100:3306/rongyijudb?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, UserName=rongyijuuser@192.168.10.11, MySQL Connector Java] will not be managed by Spring
2016-09-20 18:00:09 [DEBUG] ==>  Preparing: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid) VALUES (?, ?, ? )
2016-09-20 18:00:09 [DEBUG] ==> Parameters: 30875912(Long), 195970(Long), 14313413(Long)
2016-09-20 18:00:09 [DEBUG] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@79441bfa]
2016-09-20 18:00:09 [WARN] Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method 'handleMessage' threw exception
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:395)
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:298)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:777)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:700)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:95)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:187)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1187)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:681)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1165)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1149)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1100(SimpleMessageListenerContainer.java:95)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1312)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.dao.DuplicateKeyException:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid)         VALUES (?, ?, ? )
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
; SQL []; Duplicate entry '30875912' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
    at com.sun.proxy.$Proxy30.insert(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:253)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:52)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
    at com.sun.proxy.$Proxy85.patformErpOrderRefAdd(Unknown Source)
    at com.rabbitmq.service.AckErpQueueListenter.handleMessage(AckErpQueueListenter.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:387)
    ... 12 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
    at com.mysql.jdbc.Util.getInstance(Util.java:360)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:971)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
    at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1199)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
    at com.sun.proxy.$Proxy39.execute(Unknown Source)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73)
    at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
    at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)
    at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:386)
    ... 24 more
2016-09-20 18:00:09 [DEBUG] AckErpQueueListenter Receive an EventMessage: [EopEventMessage [queueName=QUEUE_RONGYIJU_ACK_01, exchangeName=EXCHANGE_DIRECT_RONGYIJU_01, eventData=[99, 0, 1, 77, 116, 0, 22, 99, 111, 109, 46, 114, 97, 98, 98, 105, 116, 109, 113, 46, 109, 111, 100, 101, 108, 46, 65, 99, 107, 83, 0, 14, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 100, 83, 0, 36, 55, 102, 52, 100, 100, 99, 102, 102, 45, 102, 55, 98, 98, 45, 52, 53, 49, 48, 45, 56, 101, 53, 55, 45, 51, 101, 48, 98, 98, 57, 52, 100, 50, 97, 53, 98, 83, 0, 16, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 100, 97, 116, 101, 83, 0, 13, 49, 52, 55, 52, 51, 53, 57, 51, 53, 48, 52, 55, 51, 83, 0, 4, 98, 117, 105, 100, 83, 0, 54, 123, 34, 117, 105, 100, 34, 58, 49, 52, 51, 49, 51, 52, 49, 51, 44, 34, 114, 79, 114, 100, 101, 114, 73, 100, 34, 58, 51, 48, 56, 55, 53, 57, 49, 50, 44, 34, 101, 79, 114, 100, 101, 114, 73, 100, 34, 58, 49, 57, 53, 57, 55, 48, 125, 83, 0, 12, 112, 97, 114, 116, 110, 101, 114, 95, 99, 111, 100, 101, 78, 83, 0, 11, 114, 101, 99, 101, 105, 118, 101, 114, 95, 105, 100, 78, 83, 0, 13, 114, 101, 99, 101, 105, 118, 101, 114, 95, 110, 97, 109, 101, 78, 83, 0, 12, 109, 101, 115, 115, 97, 103, 101, 95, 116, 121, 112, 101, 78, 83, 0, 12, 115, 117, 99, 99, 101, 115, 115, 95, 102, 108, 97, 103, 78, 83, 0, 17, 101, 120, 99, 101, 112, 116, 105, 111, 110, 95, 100, 101, 116, 97, 105, 108, 115, 78, 122, 122]]]
2016-09-20 18:00:09 [INFO] AckErpQueueListenter EventMessage on Content: [{"uid":14313413,"rOrderId":30875912,"eOrderId":195970} ]
2016-09-20 18:00:09 [DEBUG] Creating a new SqlSession
2016-09-20 18:00:09 [DEBUG] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@14279582] was not registered for synchronization because synchronization is not active
2016-09-20 18:00:09 [DEBUG] JDBC Connection [jdbc:mysql://192.168.10.100:3306/rongyijudb?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, UserName=rongyijuuser@192.168.10.11, MySQL Connector Java] will not be managed by Spring
2016-09-20 18:00:09 [DEBUG] ==>  Preparing: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid) VALUES (?, ?, ? )
2016-09-20 18:00:09 [DEBUG] ==> Parameters: 30875912(Long), 195970(Long), 14313413(Long)
2016-09-20 18:00:09 [DEBUG] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@14279582]
2016-09-20 18:00:09 [WARN] Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method 'handleMessage' threw exception
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:395)
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:298)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:777)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:700)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:95)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:187)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1187)
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:681)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1165)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1149)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1100(SimpleMessageListenerContainer.java:95)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1312)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.dao.DuplicateKeyException:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid)         VALUES (?, ?, ? )
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
; SQL []; Duplicate entry '30875912' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:74)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
    at com.sun.proxy.$Proxy30.insert(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:253)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:52)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
    at com.sun.proxy.$Proxy85.patformErpOrderRefAdd(Unknown Source)
    at com.rabbitmq.service.AckErpQueueListenter.handleMessage(AckErpQueueListenter.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:387)
    ... 12 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
    at com.mysql.jdbc.Util.getInstance(Util.java:360)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:971)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907)
    at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1199)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
    at com.sun.proxy.$Proxy39.execute(Unknown Source)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73)
    at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
    at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)
    at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:386)
    ... 24 more
2016-09-20 18:00:09 [DEBUG] AckErpQueueListenter Receive an EventMessage: [EopEventMessage [queueName=QUEUE_RONGYIJU_ACK_01, exchangeName=EXCHANGE_DIRECT_RONGYIJU_01, eventData=[99, 0, 1, 77, 116, 0, 22, 99, 111, 109, 46, 114, 97, 98, 98, 105, 116, 109, 113, 46, 109, 111, 100, 101, 108, 46, 65, 99, 107, 83, 0, 14, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 105, 100, 83, 0, 36, 55, 102, 52, 100, 100, 99, 102, 102, 45, 102, 55, 98, 98, 45, 52, 53, 49, 48, 45, 56, 101, 53, 55, 45, 51, 101, 48, 98, 98, 57, 52, 100, 50, 97, 53, 98, 83, 0, 16, 116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 95, 100, 97, 116, 101, 83, 0, 13, 49, 52, 55, 52, 51, 53, 57, 51, 53, 48, 52, 55, 51, 83, 0, 4, 98, 117, 105, 100, 83, 0, 54, 123, 34, 117, 105, 100, 34, 58, 49, 52, 51, 49, 51, 52, 49, 51, 44, 34, 114, 79, 114, 100, 101, 114, 73, 100, 34, 58, 51, 48, 56, 55, 53, 57, 49, 50, 44, 34, 101, 79, 114, 100, 101, 114, 73, 100, 34, 58, 49, 57, 53, 57, 55, 48, 125, 83, 0, 12, 112, 97, 114, 116, 110, 101, 114, 95, 99, 111, 100, 101, 78, 83, 0, 11, 114, 101, 99, 101, 105, 118, 101, 114, 95, 105, 100, 78, 83, 0, 13, 114, 101, 99, 101, 105, 118, 101, 114, 95, 110, 97, 109, 101, 78, 83, 0, 12, 109, 101, 115, 115, 97, 103, 101, 95, 116, 121, 112, 101, 78, 83, 0, 12, 115, 117, 99, 99, 101, 115, 115, 95, 102, 108, 97, 103, 78, 83, 0, 17, 101, 120, 99, 101, 112, 116, 105, 111, 110, 95, 100, 101, 116, 97, 105, 108, 115, 78, 122, 122]]]
2016-09-20 18:00:09 [INFO] AckErpQueueListenter EventMessage on Content: [{"uid":14313413,"rOrderId":30875912,"eOrderId":195970} ]
2016-09-20 18:00:09 [DEBUG] Creating a new SqlSession
2016-09-20 18:00:09 [DEBUG] SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29b4ccb2] was not registered for synchronization because synchronization is not active
2016-09-20 18:00:09 [DEBUG] JDBC Connection [jdbc:mysql://192.168.10.100:3306/rongyijudb?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true, UserName=rongyijuuser@192.168.10.11, MySQL Connector Java] will not be managed by Spring
2016-09-20 18:00:09 [DEBUG] ==>  Preparing: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid) VALUES (?, ?, ? )
2016-09-20 18:00:09 [DEBUG] ==> Parameters: 30875912(Long), 195970(Long), 14313413(Long)
2016-09-20 18:00:09 [DEBUG] Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29b4ccb2]

tanhao09的主页 tanhao09 | 初学一级 | 园豆:35
提问于:2016-09-20 18:09
< >
分享
最佳答案
0

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: INSERT INTO t_platform_erp_order_ref (r_order_id, e_order_id,uid) VALUES (?, ?, ? )

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'

; SQL []; Duplicate entry '30875912' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '30875912' for key 'PRIMARY'
看不懂这个??我不是做Java都看懂这个报错。。

RabittMQ监听器是在监听你队列中消息吧!当你从队列中取信息插入到数据库时,插入错误应该有回滚操作,并且会返回错误信息到监听器,刚从队列中取出来那条消息如何处理?监听器此时应该报错。。。

奖励园豆:5
~扎克伯格 | 小虾三级 |园豆:1799 | 2016-09-21 09:25

新手!哈哈,昨天解决了但是原理不懂!谢谢解决!

tanhao09 | 园豆:35 (初学一级) | 2016-09-21 09:44
其他回答(1)
0

你明明是在处理数据写到mysql的时候主键冲突了啊。

Daniel Cai | 园豆:10374 (专家六级) | 2016-09-20 18:51

好的,明白了!谢谢

支持(0) 反对(0) tanhao09 | 园豆:35 (初学一级) | 2016-09-21 09:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册