Привет. Можете ли вы помочь мне, что происходит с этой проблемой. У меня есть это приложение, подключенное к базе данных MySQL, каждый раз, когда я запускаю это задание для извлечения данных из базы данных, я всегда получаю это исключение, вижу полную трассировку стека, добавленный класс java, DAO, метод и конфигурацию apache DBCP2.
POJO class
@Entity
public class ILCShiftEntries implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column
private int month;
@Column
private int year;
@Column
private int date;
@Column
private String groupId;
@Column
private String countryCode;
@Column
private String employeeSerialNumber;
@Column
private String employeeLastName;
@Column
private String employeeDeptNumber;
@Column
private String accountId;
@Column
private String workItemId;
@Column
private String workItemDesc;
@Column
private String activityCode;
@Column
private String activityDesc;
@Column
private String billingCode;
@Column
private String weekEndingDate;
@Column
private String overtimeInd;
@Column
private String satHoursExpended;
@Column
private String sunHoursExpended;
@Column
private String monHoursExpended;
@Column
private String tuesdayHoursExpended;
@Column
private String wedHoursExpended;
@Column
private String thuHoursExpended;
@Column
private String friHoursExpended;
@Column
private String totalHoursExpended;
@Column
private String createdTimeStamp;
@Column
private String sumiterSerialNumber;
@Column
private String lbrRptInd;
@Column
private String employeeEffectiveDate;
@Column
private String labStatus;
@Transient
private String serialNumber;
@Transient
private String workDayManager;
@Transient
private String workDayManagerSerialNumber;
@Column
private String sourceApplicationId;
@Column
private String siteLocation;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getDate() {
return date;
}
public void setDate(int date) {
this.date = date;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getEmployeeSerialNumber() {
return employeeSerialNumber;
}
public void setEmployeeSerialNumber(String employeeSerialNumber) {
this.employeeSerialNumber = employeeSerialNumber;
}
public String getEmployeeLastName() {
return employeeLastName;
}
public void setEmployeeLastName(String employeeLastName) {
this.employeeLastName = employeeLastName;
}
public String getEmployeeDeptNumber() {
return employeeDeptNumber;
}
public void setEmployeeDeptNumber(String employeeDeptNumber) {
this.employeeDeptNumber = employeeDeptNumber;
}
public String getAccountId() {
return accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
public String getWorkItemId() {
return workItemId;
}
public void setWorkItemId(String workItemId) {
this.workItemId = workItemId;
}
public String getWorkItemDesc() {
return workItemDesc;
}
public void setWorkItemDesc(String workItemDesc) {
this.workItemDesc = workItemDesc;
}
public String getActivityCode() {
return activityCode;
}
public void setActivityCode(String activityCode) {
this.activityCode = activityCode;
}
public String getActivityDesc() {
return activityDesc;
}
public void setActivityDesc(String activityDesc) {
this.activityDesc = activityDesc;
}
public String getBillingCode() {
return billingCode;
}
public void setBillingCode(String billingCode) {
this.billingCode = billingCode;
}
public String getWeekEndingDate() {
return weekEndingDate;
}
public void setWeekEndingDate(String weekEndingDate) {
this.weekEndingDate = weekEndingDate;
}
public String getOvertimeInd() {
return overtimeInd;
}
public void setOvertimeInd(String overtimeInd) {
this.overtimeInd = overtimeInd;
}
public String getSatHoursExpended() {
if( NumberUtil.toDouble( satHoursExpended ) > 0 ){
return satHoursExpended;
}
return "0";
}
public void setSatHoursExpended(String satHoursExpended) {
this.satHoursExpended = satHoursExpended;
}
public String getSunHoursExpended() {
if( NumberUtil.toDouble( sunHoursExpended ) > 0 ){
return sunHoursExpended;
}
return "0";
}
public void setSunHoursExpended(String sunHoursExpended) {
this.sunHoursExpended = sunHoursExpended;
}
public String getMonHoursExpended() {
if( NumberUtil.toDouble( monHoursExpended ) > 0 ){
return monHoursExpended;
}
return "0";
}
public void setMonHoursExpended(String monHoursExpended) {
this.monHoursExpended = monHoursExpended;
}
public String getTuesdayHoursExpended() {
if( NumberUtil.toDouble( tuesdayHoursExpended ) > 0 ){
return tuesdayHoursExpended;
}
return "0";
}
public void setTuesdayHoursExpended(String tuesdayHoursExpended) {
this.tuesdayHoursExpended = tuesdayHoursExpended;
}
public String getWedHoursExpended() {
if( NumberUtil.toDouble( wedHoursExpended ) > 0 ){
return wedHoursExpended;
}
return "0";
}
public void setWedHoursExpended(String wedHoursExpended) {
this.wedHoursExpended = wedHoursExpended;
}
public String getThuHoursExpended() {
if( NumberUtil.toDouble( thuHoursExpended ) > 0 ){
return thuHoursExpended;
}
return "0";
}
public void setThuHoursExpended(String thuHoursExpended) {
this.thuHoursExpended = thuHoursExpended;
}
public String getFriHoursExpended() {
if( NumberUtil.toDouble( friHoursExpended ) > 0 ){
return friHoursExpended;
}
return "0";
}
public void setFriHoursExpended(String friHoursExpended) {
this.friHoursExpended = friHoursExpended;
}
public String getTotalHoursExpended() {
return totalHoursExpended;
}
public void setTotalHoursExpended(String totalHoursExpended) {
this.totalHoursExpended = totalHoursExpended;
}
public String getCreatedTimeStamp() {
return createdTimeStamp;
}
public void setCreatedTimeStamp(String createdTimeStamp) {
this.createdTimeStamp = createdTimeStamp;
}
public String getSumiterSerialNumber() {
return sumiterSerialNumber;
}
public void setSumiterSerialNumber(String sumiterSerialNumber) {
this.sumiterSerialNumber = sumiterSerialNumber;
}
public String getLbrRptInd() {
return lbrRptInd;
}
public void setLbrRptInd(String lbrRptInd) {
this.lbrRptInd = lbrRptInd;
}
public String getEmployeeEffectiveDate() {
return employeeEffectiveDate;
}
public void setEmployeeEffectiveDate(String employeeEffectiveDate) {
this.employeeEffectiveDate = employeeEffectiveDate;
}
public String getLabStatus() {
return labStatus;
}
public void setLabStatus(String labStatus) {
this.labStatus = labStatus;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getWorkDayManager() {
return workDayManager;
}
public void setWorkDayManager(String workDayManager) {
this.workDayManager = workDayManager;
}
public String getWorkDayManagerSerialNumber() {
return workDayManagerSerialNumber;
}
public void setWorkDayManagerSerialNumber(String workDayManagerSerialNumber) {
this.workDayManagerSerialNumber = workDayManagerSerialNumber;
}
public String getSourceApplicationId() {
return sourceApplicationId;
}
public void setSourceApplicationId(String sourceApplicationId) {
this.sourceApplicationId = sourceApplicationId;
}
public String getSiteLocation() {
return siteLocation;
}
public void setSiteLocation(String siteLocation) {
this.siteLocation = siteLocation;
}
}
Dao Class
public class ILCShiftEntriesDaoImpl implements ILCShiftEntriesDao{
@Override
public List< ILCShiftEntries > getListOfILCShiftEntriesWithLimitAndOffSet( StatelessSession statelessSession, int limitNumber, int offsetNumber ) {
List<ILCShiftEntries > listOfILCShiftEntries = null;
Query query = statelessSession.createQuery("from ILCShiftEntries order by id desc");
query.setFirstResult( offsetNumber );
query.setMaxResults( limitNumber );
List list = query.getResultList();
if( Utilities.isListNotEmpty( list ) ){
listOfILCShiftEntries = ( List<ILCShiftEntries > )list;
}
return listOfILCShiftEntries;
}
}
apache DBCP2 config
database.dbcp.maxTotal=-1
database.dbcp.maxIdle=8
database.dbcp.minIdle=0
database.dbcp.initialSize=20
database.dbcp.maxWaitMillis=23904
database.dbcp.testWhileIdle=true
database.dbcp.maxOpenPreparedStatements=-1
database.dbcp.validationQuery=SELECT 1
database.dbcp.softMinEvictableIdleTimeMillis=300000
database.dbcp.timeBetweenEvictionRunsMillis=300000
23: 35: 46.799 [DefaultQuartzScheduler_Worker-1] ОШИБКА org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Невозможно прочитать ответ с сервера. Ожидается чтение 183 байта, чтение 75 байтов, прежде чем соединение было неожиданно потеряно.
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: не удалось извлечь ResultSet
в org.hibernate.internal.ExceptionConverterImpl.convert (ExceptionConverterImpl.java:149)
в org.hibernate.internal.ExceptionConverterImpl.convert (ExceptionConverterImpl.java:157)
в org.hibernate.query.internal.AbstractProducedQuery.list (AbstractProducedQuery.java:1423)
в org.hibernate.query.Query.getResultList (Query.java:146)
at daos.ILCShiftEntriesDaoImpl.getListOfILCShiftEntriesWithLimitAndOffSet (ILCShiftEntriesDaoImpl.java:275)
at jobs.VarianceReportJobs.doILCWorkdayDBSync (VarianceReportJobs.java:400)
at jobs.VarianceReportJobs.execute (VarianceReportJobs.java:205)
в org.quartz.core.JobRunShell.run (JobRunShell.java:202)
в org.quartz.simpl.SimpleThreadPool $ WorkerThread.run (SimpleThreadPool.java:573)
Вызвано: org.hibernate.exception.GenericJDBCException: не удалось извлечь ResultSet
в org.hibernate.exception.internal.StandardSQLExceptionConverter.convert (StandardSQLExceptionConverter.java:47)
в org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert (SqlExceptionHelper.java:111)
в org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert (SqlExceptionHelper.java:97)
в org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract (ResultSetReturnImpl.java:69)
в org.hibernate.loader.Loader.getResultSet (Loader.java:2168)
в org.hibernate.loader.Loader.executeQueryStatement (Loader.java:1931)
в org.hibernate.loader.Loader.executeQueryStatement (Loader.java:1893)
в org.hibernate.loader.Loader.doQuery (Loader.java:938)
в org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections (Loader.java:341)
в org.hibernate.loader.Loader.doList (Loader.java:2692)
в org.hibernate.loader.Loader.doList (Loader.java:2675)
в org.hibernate.loader.Loader.listIgnoreQueryCache (Loader.java:2507)
в org.hibernate.loader.Loader.list (Loader.java:2502)
в org.hibernate.loader.hql.QueryLoader.list (QueryLoader.java:502)
в org.hibernate.hql.internal.ast.QueryTranslatorImpl.list (QueryTranslatorImpl.java:392)
в org.hibernate.engine.query.spi.HQLQueryPlan.performList (HQLQueryPlan.java:216)
в org.hibernate.internal.StatelessSessionImpl.list (StatelessSessionImpl.java:464)
в org.hibernate.query.internal.AbstractProducedQuery.doList (AbstractProducedQuery.java:1445)
в org.hibernate.query.internal.AbstractProducedQuery.list (AbstractProducedQuery.java:1414)
... еще 6
Вызвано: java.sql.SQLException: Невозможно прочитать ответ с сервера. Ожидается чтение 183 байта, чтение 75 байтов, прежде чем соединение было неожиданно потеряно.
в com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:129)
в com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:97)
в com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException (SQLExceptionsMapping.java:122)
в com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal (ClientPreparedStatement.java:974)
в com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery (ClientPreparedStatement.java:1024)
в org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery (DelegatingPreparedStatement.java:122)в org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery (DelegatingPreparedStatement.java:122)
в org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract (ResultSetReturnImpl.java:60)
... еще 21
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: не удалось извлечь ResultSet
в org.hibernate.internal.ExceptionConverterImpl.convert (ExceptionConverterImpl.java:149)
в org.hibernate.internal.ExceptionConverterImpl.convert (ExceptionConverterImpl.java:157)
в org.hibernate.query.internal.AbstractProducedQuery.list (AbstractProducedQuery.java:1423)
в org.hibernate.query.Query.getResultList (Query.java:146)
at daos.ILCShiftEntriesDaoImpl.getListOfILCShiftEntriesWithLimitAndOffSet (ILCShiftEntriesDaoImpl.java:275)
at jobs.VarianceReportJobs.doILCWorkdayDBSync (VarianceReportJobs.java:400)
at jobs.VarianceReportJobs.execute (VarianceReportJobs.java:205)
в org.quartz.core.JobRunShell.run (JobRunShell.java:202)
в org.quartz.simpl.SimpleThreadPool $ WorkerThread.run (SimpleThreadPool.java:573)
Вызвано: org.hibernate.exception.GenericJDBCException: не удалось извлечь ResultSet
в org.hibernate.exception.internal.StandardSQLExceptionConverter.convert (StandardSQLExceptionConverter.java:47)
в org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert (SqlExceptionHelper.java:111)
в org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert (SqlExceptionHelper.java:97)
в org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract (ResultSetReturnImpl.java:69)
в org.hibernate.loader.Loader.getResultSet (Loader.java:2168)
в org.hibernate.loader.Loader.executeQueryStatement (Loader.java:1931)
в org.hibernate.loader.Loader.executeQueryStatement (Loader.java:1893)
в org.hibernate.loader.Loader.doQuery (Loader.java:938)
в org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections (Loader.java:341)
в org.hibernate.loader.Loader.doList (Loader.java:2692)
в org.hibernate.loader.Loader.doList (Loader.java:2675)
в org.hibernate.loader.Loader.listIgnoreQueryCache (Loader.java:2507)
в org.hibernate.loader.Loader.list (Loader.java:2502)
в org.hibernate.loader.hql.QueryLoader.list (QueryLoader.java:502)
в org.hibernate.hql.internal.ast.QueryTranslatorImpl.list (QueryTranslatorImpl.java:392)
в org.hibernate.engine.query.spi.HQLQueryPlan.performList (HQLQueryPlan.java:216)
в org.hibernate.internal.StatelessSessionImpl.list (StatelessSessionImpl.java:464)
в org.hibernate.query.internal.AbstractProducedQuery.doList (AbstractProducedQuery.java:1445)
в org.hibernate.query.internal.AbstractProducedQuery.list (AbstractProducedQuery.java:1414)
... еще 6
Вызвано: java.sql.SQLException: Невозможно прочитать ответ с сервера. Ожидается чтение 183 байта, чтение 75 байтов, прежде чем соединение было неожиданно потеряно.
в com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:129)
в com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:97)
в com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException (SQLExceptionsMapping.java:122)
в com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal (ClientPreparedStatement.java:974)
в com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery (ClientPreparedStatement.java:1024)
в org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery (DelegatingPreparedStatement.java:122)
в org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery (DelegatingPreparedStatement.java:122)
в org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract (ResultSetReturnImpl.java:60)
... еще 21