Am getting the below error intermittently.
ERROR Exception occured while fetching the available subscriptions from the database - Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed
org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed
Caused by: org.hibernate.TransactionException: JDBC rollback failed
at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:204)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doRollback(HibernateTransactionManager.java:676)
... 80 more
Caused by: java.sql.SQLException: No more data to read from socket
java.sql.SQLException: Closed Connection
ERROR org.hibernate.transaction.JDBCTransaction 17/11/2010 20:49:41 - JDBC rollback failed
java.sql.SQLException: Io exception: Broken pipe
ERROR org.springframework.transaction.interceptor.TransactionInterceptor 17/11/2010 20:49:41 - Application exception overridden by rollback exception
org.hibernate.exception.GenericJDBCException: could not execute query
java.sql.SQLException: OALL8 is in an inconsistent state
Database: Oracle9i
JDBC Driver: 10.2.0.4.0
Developement environment: Mule 3.0, Spring 3.0 and Hibernate 3
"OALL8 is in an inconsistent state" is a generic exception that occurs in JDBC 10.1, 10.2, and 11.1. It indicates that an internal inconsistency has been detected in the JDBC connection but it does not provide information on what caused the inconsistency. The exception no longer occurs in JDBC 11.2.
The error is usually caused by a bug in the JDBC code. These are very hard to analyze. The simplest solution is to upgrade the JDBC driver.
Related
I am running a java application with MySQL as the DB server. DB is a AWS RDS. The MySQL connector is published under GNU/GPL so it has to be substituted with something more lenient. Maria DB client claimed to be compatible. But ever since MariaDB client is being used we are seeing the below intermittent issue during DB intensive activities:
Excption:-
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/Projectname] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection] with root cause
java.sql.SQLNonTransientConnectionException: (conn=1530488) Connection is closed
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.cmdPrologue(AbstractQueryProtocol.java:1940)
Caused by: org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:48)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
Caused by: java.sql.SQLNonTransientConnectionException: Could not connect to address=(host=XXXXXXXXXX)(port=3306)(type=master) : (conn=1530487) could not load system variables
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:73)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:192)
at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1372)
I have tried increasing the time_wait and max_allowed_packet to the maximum allowed but the issue still exists.
Versions:-
MySQL - 5.7.26
MariaDB connector - 2.6.2
Just came across this, found an answer. On my side this was for an Aurora 1 MySQL DB (equiv to 5.6).
As per Diego Dupin in https://jira.mariadb.org/browse/CONJ-824:
only good solution is to use option `usePipelineAuth=false&useBatchMultiSend=false`
So your DB connection string might look like this:
jdbc:mysql://127.0.0.1:3307/mydbname?usePipelineAuth=false&useBatchMultiSend=false
More details:
Aurora proxy has a known race condition issue that results in skipping other
queries in proxy buffer. connection might be in hang waiting for query response.
During authentication, socket has a timeout, that will result throwing the error
you describe.
So if `usePipelineAuth` or `useBatchMultiSend` is enable, it might work ... or not.
All pipeline options (`usePipelineAuth` and `useBatchMultiSend`) must be disabled when using aurora.
Problem has been reported to aurora a few times without correction.
I have created a spring boot application. When I put load on the application after sometime load on database server started increasing and I got started socket read time out error.
2016-10-24 21:56:10 [pool-3-thread-296] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - IO Error: Socket read timed out
2016-10-24 21:56:10 [pool-3-thread-296] ERROR
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
Here is the properties file details of Springboot application
spring.datasource.url=jdbc:oracle:thin:#<ip>:1521:<dbname>
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.initial-size=100
spring.datasource.maxActive=1500
spring.datasource.validationQuery=select 1 from dual
spring.jpa.hibernate.dialect = org.hibernate.dialect.Oracle10gDialect
spring.jpa.show-sql = true
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.datasource.pool-prepared-statements=true
spring.datasource.pool-prepared-statements-cache-size=500
spring.datasource.max-open-prepared-statements=500
Since the error is very generic , I am not able to figure out why I am getting socket read timeout exception.
I also need to know what does "[pool-3-thread-296]" mean in exception log ?
Have you tried this? This worked for me
https://springframework.guru/configuring-spring-boot-for-oracle/
After following the instruction of buildin Shopizer from this link
https://github.com/shopizer-ecommerce/shopizer
and after building and moving sm-shop.war to Tomcat webapps folder and then accessing the url:
http://localhost:8080/sm-shop/shop
I'm facing this error
HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
So, what is the problem, can anybody help ?
It expects this DB configuration.
You have two options:
Configure your own local DB and fill it with your connection and authentication details (config is using MySQL).
Uncomment H2 database config and comment out MySQL config. H2 is embedded database and therefore you wouldn't need to install anything.
After a SQL Server database restart, my Tomcat 6 Spring web applications receives an SQL exception on the first attempt to query the database. Note: Tomcat 6 has continued to run during the SQL Server restart and I'm using myBatis. The exception is as follows:
org.springframework.dao.DataAccessResourceFailureException:
Error querying database. Cause: java.sql.SQLException: I/O Error: Connection reset
Any subsequent queries execute fine (without exception). How can I prevent this exception on the first query?
Set up your pool to test connections before giving them to your application
use testOnBorrow=true and (for instance) validationQuery="select 1" in your db pool connection
I have successfully made a connection to a remote MySQL server through Glassfish, however each time I make a change to the code or XHTML files, I need to open the administrator panel of Glassfish and flush the connection pool, otherwise I get the following error when I just refresh the page. Has anybody experienced this? I can post code or other information if it is needed.
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException: WELD-000049 Unable to invoke [method]
#PostConstruct public
com.myapp.QuestionController.initialize() on
com.myapp.QuestionController#4635bd2a
root cause
org.jboss.weld.exceptions.WeldException: WELD-000049 Unable to invoke
[method] #PostConstruct public
com.myapp.interfaces.QuestionController.initialize() on
com.myapp.interfaces.QuestionController#4635bd2a
root cause
java.lang.reflect.InvocationTargetException
root cause
javax.ejb.EJBException
root cause
javax.persistence.PersistenceException: Exception [EclipseLink-4002]
(Eclipse Persistence Services - 2.3.0.v20110604-r9504):
org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: java.sql.SQLException: Error in allocating a connection.
Cause: java.lang.RuntimeException: Got exception during
XAResource.start: Error Code: 0
root cause
Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: java.sql.SQLException: Error in allocating a connection.
Cause: java.lang.RuntimeException: Got exception during
XAResource.start: Error Code: 0
root cause
java.sql.SQLException: Error in allocating a connection. Cause:
java.lang.RuntimeException: Got exception during XAResource.start:
root cause
javax.resource.spi.ResourceAllocationException: Error in allocating a
connection. Cause: java.lang.RuntimeException: Got exception during
XAResource.start:
root cause
com.sun.appserv.connectors.internal.api.PoolingException:
java.lang.RuntimeException: Got exception during XAResource.start:
root cause
com.sun.appserv.connectors.internal.api.PoolingException:
java.lang.RuntimeException: Got exception during XAResource.start:
root cause
java.lang.RuntimeException: Got exception during XAResource.start:
root cause
javax.transaction.xa.XAException:
com.sun.appserv.connectors.internal.api.PoolingException:
javax.resource.spi.LocalTransactionException: Communications link
failure
The last packet successfully received from the server was 435�409
milliseconds ago. The last packet sent successfully to the server was
7 milliseconds ago.
Image of config
Persistence XML
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="SertifikatPU" transaction-type="JTA">
<jta-data-source>jdbc/sertifikatdb</jta-data-source>
</persistence-unit>
</persistence>
In the "Additional properties" in Glassfish connection pool settings I have just configured: servername, URL, user and password.
I HAVE SOLVED THIS PROBLEM
I made my own dual table, similar to the one in Oracle.
CREATE TABLE dual
(
x VARCHAR(1)
);
INSERT INTO dual(x) VALUES('y');
Your root cause, PoolingException: javax.resource.spi.LocalTransactionException: Communications link failure is related to this Glassfish bug, which explains (in the comments tab at the bottom) that you may need to refresh your invalid connections.
The bug comment by Jagadish says to check your connection validation type. If it is set to "autocommit" (the default), the JDBC drivers may cache the prior connection validation data, and no actual database interaction will happen during future connection validations.
To resolve the problem, set connection-validation-method="table" and validation-table-name="any_table_you_know_exists" (replace any_table_you_know_exists with the name of any existing table). Doing this forces the connections to talk to the database instead of the cache; if the connection is invalid, it will be dropped and recreated. You may need to also specify is-connection-validation-required="true".
Articles to help with additional configuration:
This article also explains the problem in detail.
Jagadish's Oracle Blog Article on this topic has more info.
Article explaining Glassfish JDBC Connection Validation in detail.
Text from Jagadish's blog:
AS_INSTALL_ROOT/bin/asadmin set domain.resources.jdbc-connection-pool.DerbyPool.is-connection-validation-required=true
domain.resources.jdbc-connection-pool.DerbyPool.is-connection-validation-required = true
AS_INSTALL_ROOT/bin/asadmin set domain.resources.jdbc-connection-pool.DerbyPool.connection-validation-method=table
domain.resources.jdbc-connection-pool.DerbyPool.connection-validation-method = table
bin/asadmin set domain.resources.jdbc-connection-pool.DerbyPool.validation-table-name=sys.systables
domain.resources.jdbc-connection-pool.DerbyPool.validation-table-name = sys.systables
Note that the sample code refers to sys.systables, which is a MS SQL table that is guaranteed to exist. For Oracle, refer to the guaranteed table dual. For MySQL, create a 1-column table solely for validation purposes; play it safe and pre-populate the table by inserting one row of data.
Should you be using this driver?
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
I see that you are using a different driver from the attached image ...