Ibatis parameter exception - ibatis

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.

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.

Error using installing MSSQL Server2014 using chef

I have window 2012 R2 based two VM machines.
One is using for Chef-workstation and other is for Chef-client.
I am trying to install MSSQL Server 2014 using chef-cmd from chef-workstation on chef-client.
Sometimes I am getting below error on chef-client while installing MSSQL Server.
check for instance name, got: 'MSSQLSERVER' Error: Action
"Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction"
threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException:
There was an error generating the XML document. --->
Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException:
There was an error generating the XML document. --->
System.InvalidOperationException: There was an error generating the
XML document. --->
System.Security.Cryptography.CryptographicException: Access is denied.
at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData,
Byte[] optionalEntropy, DataProtectionScope scope) at
Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
at
System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable
serializable, String name, String ns, Boolean isNullable, Boolean
wrapped) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String
n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean
needType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object
o) at
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionEngine.RunActionQueue()
Error: Action
"Microsoft.SqlServer.Configuration.BootstrapExtension.ExecuteWorkflowAction"
threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException:
There was an error generating the XML document. --->
Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException:
There was an error generating the XML document. --->
System.InvalidOperationException: There was an error generating the
XML document. --->
System.Security.Cryptography.CryptographicException: Access is denied.
at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData,
Byte[] optionalEntropy, DataProtectionScope scope) at
Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
For more information:
https://discourse.chef.io/t/error-action-microsoft-sqlserver-configuration-setupextension-finalcalculatesettingsaction-threw-an-exception-during-execution/13778

Exception with transacted set on activemq endpoint

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()

How to call function over data being passed in ibatis

I need to call a internal function say 'calculateValue(value)' which returns some string based on the value passed.
<select id="calculateValue" resultClass="java.lang.String" parameterClass="java.lang.String">
SELECT calculateValue(#value#) FROM SYSIBM.SYSDUMMY1
</select>
the above query returns the below error.
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in mymapsql.xml.
--- The error occurred while executing query.
--- Check the SELECT calculateValue(?) FROM SYSIBM.SYSDUMMY1 .
--- Check the SQL Statement (preparation failed).
--- Cause: java.sql.SQLException: [SQL0418] Use of parameter marker not valid.
how to call the function calculateValue() on the value being passed as parameter?
use procedure tag <procedure> for calling stored procedure.
<procedure id="procId" resultClass="ResultClass"
parameterMap="getMap">
{ call getResult( #param# ) }
</procedure>

Resources