'Getting this error while calling a hardcoded insert query in myBatis
10:59:35,454 ERROR [stderr] (pool-6-thread-1) org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
10:59:35,478 ERROR [stderr] (pool-6-thread-1) ### Error updating database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (IO Error: The Network Adapter could not establish the connection)
10:59:35,530 ERROR [stderr] (pool-6-thread-1) ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (IO Error: The Network Adapter could not establish the connection)
10:59:35,594 ERROR [stderr] (pool-6-thread-1) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
10:59:35,633 ERROR [stderr] (pool-6-thread-1) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
10:59:35,672 ERROR [stderr] (pool-6-thread-1) at com.sun.proxy.$Proxy24.insert(Unknown Source)
10:59:35,701 ERROR [stderr] (pool-6-thread-1) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240)
10:59:35,731 ERROR [stderr] (pool-6-thread-1) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51)
10:59:35,769 ERROR [stderr] (pool-6-thread-1) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
10:59:35,805 ERROR [stderr] (pool-6-thread-1) at com.sun.proxy.$Proxy92.insert(Unknown Source)
10:59:35,834 ERROR [stderr] (pool-6-thread-1) at com.test.tools.businesslogic.BSL_VariablePathRefresh.insert(BSL_VariablePathRefresh.java:1413)
10:59:35,868 ERROR [stderr] (pool-6-thread-1) at com.test.tools.domain.DMO_VariablePath.createVariablePathByPathWithContainers(DMO_VariablePath.java:395)
10:59:35,901 ERROR [stderr] (pool-6-thread-1) at com.test.tools.businesslogic.BSL_VariablePathRefreshThread.createNewVarialePath(BSL_VariablePathRefreshThread.java:227)
10:59:35,934 ERROR [stderr] (pool-6-thread-1) at com.test.tools.businesslogic.BSL_VariablePathRefreshThread.call(BSL_VariablePathRefreshThread.java:216)
10:59:35,959 ERROR [stderr] (pool-6-thread-1) at com.test.tools.businesslogic.BSL_VariablePathRefreshThread.call(BSL_VariablePathRefreshThread.java:1)
10:59:35,990 ERROR [stderr] (pool-6-thread-1) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
10:59:36,013 ERROR [stderr] (pool-6-thread-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
10:59:36,044 ERROR [stderr] (pool-6-thread-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
10:59:36,075 ERROR [stderr] (pool-6-thread-1) at java.lang.Thread.run(Thread.java:750)
I am getting the above error while doing a hardcoded insert query, there are multiple queries inside the same XML file most of them are select statements that are being run correctly and I am getting the desired output.
insert statement.
insert into variable_path(id, req_no, NAME, DESC, OBJECT_TYPE) values(455, 123, 'qw2', 'wew1', 5)
DMO_VariablePath.java
BSL_VariablePathRefresh bsl = utlBeanFactory.getBean(BSL_VariablePathRefresh.class);
try {
bsl.insert();
}catch (Exception e) {
e.printStackTrace();
}
BSL_VariablePathRefresh.java
public void insert() {
try {
this.daoVariablePath.insert();
}catch (Exception e) {
logger.info(e);
e.printStackTrace();
}
}
interface DAO_VariablePath.java
void insert();
XML DAO_VariablePath.xml
<insert id="insert">
insert into variable_path(id, req_no, NAME, DESC, OBJECT_TYPE) values(455, 123, 'qw2', 'wew1', 5)
</insert>
DMO_VariablePath.java is called using ExecutorService, so could it be the reason why I am facing the error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|