Exception with transacted set on activemq endpoint - apache-camel

I would like to understand why I would be getting the following exception when "transacted" is set on a route.
errorHandler(deadLetterChannel("activemq:EXCEPTION")
.useOriginalMessage()
.maximumRedeliveries(1));
from("activemq:TRIGGER").routeId("Trigger")
.transacted()
.bean("helloService")
.to("log:out");
I would like for any exceptions that are being thrown to be sent to an EXCEPTION queue. It is my understanding that "transacted" needs to be set to make the route a transaction. When I remove the configuration I don't get the exception below.
Exception is created when string for Hello class is set to larger then 5 characters.
Example code:
https://github.com/zachariahyoung/docker-camel
2015-12-03 21:59:26.706 WARN 9900 --- [nsumer[TRIGGER]] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 22001, SQLState: 22001
2015-12-03 21:59:26.706 ERROR 9900 --- [nsumer[TRIGGER]] o.h.engine.jdbc.spi.SqlExceptionHelper : Value too long for column "TEXT VARCHAR(5)": "'sdsfasdfasdf' (12)"; SQL statement:
insert into hello (id, text) values (null, ?) [22001-190]
2015-12-03 21:59:26.707 WARN 9900 --- [nsumer[TRIGGER]] o.a.c.s.spi.TransactionErrorHandler : Transaction rollback (0x7e2bd5e6) redelivered(true) for (MessageId: ID:CHARLA-49686-1449193952655-71:1:1:1:1 on ExchangeId: ID-CHARLA-63325-1449200820961-0-37) caught: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
2015-12-03 21:59:26.708 WARN 9900 --- [nsumer[TRIGGER]] o.a.c.c.jms.EndpointMessageListener : Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly]
org.apache.camel.RuntimeCamelException: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:186) ~[camel-jms-2.15.3.jar:2.15.3]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:107) ~[camel-jms-2.15.3.jar:2.15.3]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:746) ~[spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:684) ~[spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:651) ~[spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:315) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:233) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1150) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1142) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1039) [spring-jms-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:526) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:150) ~[spring-tx-4.2.3.RELEASE.jar:4.2.3.RELEASE]
at org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174) ~[camel-spring-2.16.0.jar:2.16.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134) ~[camel-spring-2.16.0.jar:2.16.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:103) ~[camel-spring-2.16.0.jar:2.16.0]
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112) ~[camel-spring-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87) ~[camel-core-2.16.0.jar:2.16.0]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103) ~[camel-jms-2.15.3.jar:2.15.3]
... 11 common frames omitted
Caused by: javax.persistence.RollbackException: Transaction marked as rollbackOnly
at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:74) ~[hibernate-entitymanager-4.3.11.Final.jar:4.3.11.Final]
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE]
... 23 common frames omitted

Exception is thrown because camel is propagating rollback. If you call this route from another, camel will rollback that route too. You must catch exception which marked route as rollback and tell camel to only mark this route as rollback. Before .transacted() add:
.onException(Exception.class).markRollbackOnlyLast().end()

Related

Kibana unable to search message field

I am trying to search message field like this in Kibana search bar.
message: "*CannotCreateTransactionException*" .
It is unable to search it , while it works for :-
message: "org.springframework.transaction.CannotCreateTransactionException"
Complete message field is :-
[http-nio-8080-exec-31] {ERROR} - Forwarding to error page from request due to exception [Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed: ]
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin transaction failed:
at org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:582) ~[spring-orm-5.2.5.RELEASE.jar:5.2.5.RELEASE]
My bad , quotes consider * as part of string
Solution is
message: *CannotCreateTransactionException*

Teradata Database TeraJDBC 16.20.00.04 Error 3610 SQLState HY000 Internal error: Please do not resubmit the last request

Im requesting a report in the form of excel in my application. The application generates a report by running several(31) sql tasks, everytime i submit a request. But for a particular request the execution of 28th task doesnt complete and throws the below error.
[Teradata Database] [TeraJDBC 16.20.00.04] [Error 3610] [SQLState HY000] Internal error: Please do not resubmit the last request. SubCode, CrashCode: 0, 2693
01/28/2020 10:35:28,586 ERROR com.xxxx.yyyy.zz.Runner:generateBasicReport:174 - java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.04] [Error 3610] [SQLState HY000] Internal error: Please do not resubmit the last request. SubCode, CrashCode: 0, 2693
com.xxxx.yyyy.zz.exception.ReportGenerationException: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.04] [Error 3610] [SQLState HY000] Internal error: Please do not resubmit the last request. SubCode, CrashCode: 0, 2693
at com.xxxx.yyyy.zz.generator.task.CancellableSqlTask.execute(CancellableSqlTask.java:79)
at com.xxxx.yyyy.zz.generator.task.TaskExecutor.executeNext(TaskExecutor.java:56)
at com.xxxx.yyyy.zz.generator.ReportGenerator.executeTasks(ReportGenerator.java:119)
at com.xxxx.yyyy.zz.generator.ReportGenerator.execute(ReportGenerator.java:83)
at com.xxxx.yyyy.zz.generator.task.CompositeCancellableTask.execute(CompositeCancellableTask.java:32)
at com.xxxx.yyyy.zz.Runner.executeGeneration(Runner.java:209)
at com.xxxx.yyyy.zz.Runner.generateBasicReport(Runner.java:171)
at com.xxxx.yyyy.zz.Runner.generateReports(Runner.java:137)
at com.xxxx.yyyy.zz.Runner.startReportGenerator(Runner.java:92)
at com.xxxx.yyyy.zz.Runner.main(Runner.java:69)
Caused by: java.sql.SQLException: [Teradata Database] [TeraJDBC 16.20.00.04] [Error 3610] [SQLState HY000] Internal error: Please do not resubmit the last request. SubCode, CrashCode: 0, 2693
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDatabaseSQLException(ErrorFactory.java:309)
at com.teradata.jdbc.jdbc_4.statemachine.ReceiveInitSubState.action(ReceiveInitSubState.java:103)
at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.subStateMachine(StatementReceiveState.java:311)
at com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState.action(StatementReceiveState.java:200)
at com.teradata.jdbc.jdbc_4.statemachine.StatementController.runBody(StatementController.java:137)
at com.teradata.jdbc.jdbc_4.statemachine.PreparedStatementController.run(PreparedStatementController.java:46)
at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:389)
at com.teradata.jdbc.jdbc_4.TDStatement.executeStatement(TDStatement.java:331)
at com.teradata.jdbc.jdbc_4.TDPreparedStatement.doPrepExecuteUpdate(TDPreparedStatement.java:225)
at com.teradata.jdbc.jdbc_4.TDPreparedStatement.executeUpdate(TDPreparedStatement.java:2769)
at com.xxxx.yyyy.zz.generator.task.CancellableUpdate.perform(CancellableUpdate.java:36)
at com.xxxx.yyyy.zz.generator.task.CancellableSqlTask.execute(CancellableSqlTask.java:74)
... 9 more
That means that the request caused some exception that Teradata couldn't handle, and like the message says, "don't re-submit". You could try digging into the logs, but I don't know how fruitful that will be. I think they are somewhere in /var/opt/teradata/. Otherwise, you'd have to check with customer support to debug.
From the documentation:
2693 The fieldids in field 5 are not contiguous.
Explanation: The field descriptors in field 5 should be contiguous, they are not.
Generated By: FldLocat.
For Whom: Site support representative.
Notes: This is caused by an incorrect field 5 header.
Remedy: Contact your Support Representative.

Use Flink to call arangodb Java driver API to insert data into arangodb and report error err 'transaction ID already used'

Use Flink to call arangodb Java driver API to insert data into arangodb and report error err 'transaction ID already used'
Caused by: TimerException{com.arangodb.ArangoDBException: Response: 500, Error: 1590 - AQL: error, cluster node: 'PRMR-c338134b-023c-438d-b672-d5f954c2882c', endpoint: 'tcp://192.168.2.137:8530', error: 'transaction ID already used' (while optimizing plan)}
at org.apache.flink.streaming.runtime.tasks.SystemProcessingTimeService$TriggerTask.run(SystemProcessingTimeService.java:284)
... 7 more
Caused by: com.arangodb.ArangoDBException: Response: 500, Error: 1590 - AQL: error, cluster node: 'PRMR-c338134b-023c-438d-b672-d5f954c2882c', endpoint: 'tcp://xxx:8530', error: 'transaction ID already used' (while optimizing plan)
at com.arangodb.internal.util.ResponseUtils.checkError(ResponseUtils.java:53)
at com.arangodb.internal.velocystream.VstCommunication.checkError(VstCommunication.java:149)
at com.arangodb.internal.velocystream.VstCommunicationSync.execute(VstCommunicationSync.java:128)
at com.arangodb.internal.velocystream.VstCommunicationSync.execute(VstCommunicationSync.java:42)
at com.arangodb.internal.velocystream.VstCommunication.execute(VstCommunication.java:132)
at com.arangodb.internal.velocystream.VstProtocol.execute(VstProtocol.java:47)
at com.arangodb.internal.ArangoExecutorSync.execute(ArangoExecutorSync.java:71)
at com.arangodb.internal.ArangoExecutorSync.execute(ArangoExecutorSync.java:53)
This seems to be a bug in arangodb and should be resolved in later versions.

Error running transactions on HANA database

I am running bulk transactions on HANA database and getting following error:
2018-01-15 10:23:33,865 ERROR c.c.t.Payment [tpcc-thread-5] UPDATE district SET d_ytd = d_ytd + 1601.0 WHERE d_w_id = 1 AND d_id = 1
com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [138]: transaction serialization failure: TrexUpdate failed on table 'SYSTEM:DISTRICT' with error: transaction order error, rc=4614
at com.sap.db.jdbc.exceptions.SQLExceptionSapDB._newInstance(SQLExceptionSapDB.java:193)
.......
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-01-15 10:23:34,139 ERROR c.c.t.Payment [tpcc-thread-5] Payment error
java.lang.Exception: Payment update transaction error
Anybody has any idea what could be wrong?
I found out that this was a valid error. For transaction type REPEATABLE_READ or SERIALIZABLE this problem can occur when before end of one transaction, another transaction modifies the same data which transaction one was working on.
To get rid of this error, we can use transaction type READ_COMMITTED, which takes a snapshot of the data at the beginning and uses the same data throughout the transaction. It will also lock the rows its working on so that other transactions cannot modify it.

Ibatis parameter exception

javax.servlet.ServletException: org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in config/register.xml.
--- The error occurred while applying a parameter map.
--- Check the register.insertDetails-InlineParameterMap.
--- Check the parameter mapping for the 'LName' property.
--- Cause: java.lang.ArrayIndexOutOfBoundsException: 1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in config/register.xml.
--- The error occurred while applying a parameter map.
--- Check the register.insertDetails-InlineParameterMap.
--- Check the parameter mapping for the 'LName' property.
--- Cause: java.lang.ArrayIndexOutOfBoundsException: 1
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
When calling register.insertDetails-InlineParameterMap from register.xml a attribute from your object gets mapped into the insert sql, but the attribute of your data object is null.
so you get this error when one of your attributes, which you are using in your insert statement is null.

Resources