-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: net.sf.hibernate.AssertionFailure
PostPosted: Fri Apr 07, 2006 6:29 am 
Newbie

Joined: Fri Apr 07, 2006 5:51 am
Posts: 1
Dear Expert,
I didn't hit this error before in development environment.

My project already live, this error occur in the live server, when 2 customer try to generate billing at the same time.
Please help what should i do? rewrite the code ? or any better idea how to effectiently use hibernate.

This error caused performance issue for mysql and java.
Mysql 100%
Java 75%
in pefmon

i need to manually stop the mysql and java service, then the server performance seem better.

Please guide me what should i do.

Hibernate version: Hibernate Synchronizer Eclipse 2.1
My development using IBM websphere so use this hibernate synchronizer plugin

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping package="com.ifca.mcorp.hh">
<class name="ArdmxLedger" table="ardmx_ledger">
<id
column="bi_debtor_ledger_id"
name="Id"
type="java.lang.Long"
>
<generator class="identity" />
</id>
<property
column="vc_void_remark"
length="250"
name="VcVoidRemark"
not-null="false"
type="string"
/>
<property
column="dc_document_amount"
length="21"
name="DcDocumentAmount"
not-null="true"
type="big_decimal"
/>
<property
column="dt_document_date"
length="10"
name="DtDocumentDate"
not-null="false"
type="date"
/>
<property
column="si_transaction_group"
length="6"
name="SiTransactionGroup"
not-null="true"
type="java.lang.Short"
/>
<property
column="vc_remark"
length="250"
name="VcRemark"
not-null="false"
type="string"
/>
<property
column="dt_modify_date"
length="19"
name="DtModifyDate"
not-null="false"
type="timestamp"
/>
<property
column="vc_reference_no"
length="30"
name="VcReferenceNo"
not-null="false"
type="string"
/>
<property
column="dt_void_date"
length="10"
name="DtVoidDate"
not-null="false"
type="date"
/>
<property
column="vc_description"
length="250"
name="VcDescription"
not-null="false"
type="string"
/>
<property
column="ch_record_status"
length="1"
name="ChRecordStatus"
not-null="true"
type="string"
/>
<property
column="dc_service_tax_amount"
length="21"
name="DcServiceTaxAmount"
not-null="false"
type="big_decimal"
/>
<property
column="dc_gst_tax_amount"
length="21"
name="DcGstTaxAmount"
not-null="false"
type="big_decimal"
/>
<property
column="bi_modify_user"
length="20"
name="BiModifyUser"
not-null="true"
type="java.lang.Long"
/>
<property
column="dc_service_tax_rate"
length="11"
name="DcServiceTaxRate"
not-null="false"
type="big_decimal"
/>
<property
column="ch_transaction_mode"
length="1"
name="ChTransactionMode"
not-null="true"
type="string"
/>
<property
column="ch_disputed"
length="1"
name="ChDisputed"
not-null="true"
type="string"
/>
<property
column="dt_document_due_date"
length="10"
name="DtDocumentDueDate"
not-null="false"
type="date"
/>
<property
column="dt_create_date"
length="19"
name="DtCreateDate"
not-null="false"
type="timestamp"
/>
<property
column="dc_gst_tax_rate"
length="11"
name="DcGstTaxRate"
not-null="false"
type="big_decimal"
/>
<property
column="dc_balance_amount"
length="21"
name="DcBalanceAmount"
not-null="true"
type="big_decimal"
/>
<property
column="ch_class"
length="1"
name="ChClass"
not-null="true"
type="string"
/>
<property
column="bi_create_user"
length="20"
name="BiCreateUser"
not-null="true"
type="java.lang.Long"
/>
<property
column="ch_payment_mode"
length="1"
name="ChPaymentMode"
not-null="false"
type="string"
/>
<property
column="vc_document_no"
length="30"
name="VcDocumentNo"
not-null="false"
type="string"
/>
<!-- modify by huangtao -->

<property
column="bi_debtor_id"
length="20"
name="BiDebtor"
not-null="true"
type="java.lang.Long"
/>
<property
column="bi_unit_id"
length="20"
name="BiUnit"
not-null="true"
type="java.lang.Long"
/>



</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
public void generateBillings(GenerateBillingsForm generateBillingsForm) throws InvalidException, NoRecordException,
NextDocNoException, ParseException {

String initialAccountNo = generateBillingsForm.getTxtAccountNo()==null? "" : generateBillingsForm.getTxtAccountNo().trim();
String radOwnOrRes = generateBillingsForm.getRadOwnOrRes();
String radPrintOneOrAll = generateBillingsForm.getRadPrintOneOrAll();

Session session = null;
Transaction tx = null;
try {
session = _RootDAO.createSession();

// common log:begin monthlyclosing
/*added by boonting
* date :(2006-01-19)
* purpose: add condition to control Purging to be done from 3rd month data onwards (keep 2 months)*/
Date currentdate = new Date();
int monthDiff = -3;
Date dateDiff = UtilBean.monthAdd(currentdate, monthDiff);
Date purgeDate= UtilBean.getLastDayOfmonth(dateDiff);
//will remove those old transaction records
MonthlyClosingService.monthlyClosing(session, propertyId, purgeDate);
/*end purge data checking*/

List personnelList = loadAllPersonnel(session, radPrintOneOrAll, radOwnOrRes, initialAccountNo, propertyId);

for (int iList = 0; iList < personnelList.size(); iList++) {

tx = session.beginTransaction();

Long unitId = null;
Long debtorId = null;
if (radOwnOrRes.equals("1")) {
MfrmxOwner owner = (MfrmxOwner) personnelList.get(iList);
unitId = owner.getBiUnit();
debtorId = owner.getBiDebtor();
} else {
// MfrmxResident resident = (MfrmxResident) personnelList.get(iList);
// unitId = resident.getBiUnit();
// debtorId = resident.getBiDebtor();
}

MfrmxPropertyUnit proUnit = (MfrmxPropertyUnit) getPropertyUnitById(session, unitId);

// Long debtorId = getDebtorIdByUnitId(session, proUnit.getId(), radOwnOrRes);

// Maintenance Fee

generateMaintenanceFee(session, proUnit, generateBillingsForm, debtorId, propertyId); // Sinking Fund
generateSinkingFundFee(session, proUnit, generateBillingsForm, debtorId, propertyId);

// Quit Rent Fee
generateQuitRentFee(session, proUnit, generateBillingsForm, debtorId, propertyId);

// Assessment
generateAssessmentFee(session, proUnit, generateBillingsForm, debtorId, propertyId);

// /Fire Insurance
generateFireInsuranceFee(session, proUnit, generateBillingsForm, debtorId, propertyId);

// meter
generateMeterFee(session, proUnit, generateBillingsForm, debtorId, propertyId);


MonthlyClosingService.allocation(session, cuserInfo, debtorId, proUnit.getId(), propertyId);

tx.commit();
} //
// }

} catch (HibernateException e) {
e.printStackTrace();
try {
tx.rollback();
} catch (HibernateException e1) {
e1.printStackTrace();
}
} finally {
try {
if (session != null)
session.close();
} catch (HibernateException e1) {
e1.printStackTrace();
}
}
}

It seem like error occur in this function

private void generateMaintenanceFee(Session session, MfrmxPropertyUnit unit, GenerateBillingsForm form,
Long debtorId, Long propertyId) throws HibernateException, NextDocNoException, ParseException {

// Date generateDate = UtilBean.getSqlDateThrowExc(form.getTxtGenerateDate().trim());
Date generateDate = UtilBean.dayAdd(form.getTxtGenerateDate().trim(), 2);
String billingsDate = form.getTxtBillingDate().trim();
// String radOwnOrRes = form.getRadOwnOrRes();

String currentDocNo = null;
String temporaryDescription = null;
String currentDescription = null;
String currentReference = null;

String currentRemark = null;
String currentVoidRemark = null;

BigDecimal currentGSTRate = null;
BigDecimal currentGSTAmount = null;
BigDecimal currentSERVRate = null;
BigDecimal currentSERVAmount = null;
BigDecimal currentDocAmount = null;
BigDecimal currentDocBalance = null;

Date currentDueDate = null;
Date currentDocDate = null;
Date tempNextBillDate = null;
// if (unit.getChBillTo() != null) {
// if ((unit.getChBillTo().equals("O") && radOwnOrRes.equals("1"))
// || (unit.getChBillTo().equals("R") && radOwnOrRes.equals("0"))) {

if (unit.getDcMaintFeeAmount() != null && unit.getDtMaintNextBillDate() != null) {
if (unit.getDcMaintFeeAmount().doubleValue() > 0 && unit.getDtMaintNextBillDate().before(generateDate)) {

// logger.info("begin generate maintenance " + "-->debtor id : " + debtorId + " & unit id : "
// + unit.getId());

ArrmxTransactionType transType = loadTransactionType(session, Constants.TRANSGRP_ONE, propertyId);

if (transType == null) {
throw new NextDocNoException("Error Reading Next Document Number");
}

//String temporaryBillingsDate = billingsDate;

String billMonth = null;
String getYear = null;
int getMonth = 0;
int i= 0;

int creditTerm = getCreditTerm(transType);

int chargeType = getChargeType(unit, Constants.TRANSGRP_ONE);

tempNextBillDate = unit.getDtMaintNextBillDate();
while (tempNextBillDate.before(generateDate)) {

for (int counter = 1; counter <= chargeType; counter++) {

ArdmxLedger ledger = new ArdmxLedger();

if(counter == 1){
billMonth = UtilBean.getMonthOfYear(tempNextBillDate);
}else{
i++;
getMonth = UtilBean.getMonthOfDate(tempNextBillDate) + i;
getYear = UtilBean.getYearOfDate(tempNextBillDate);
billMonth = new Long (getMonth).toString() +"/" + getYear;
if(getMonth >12){
Date tempDate = null;
tempDate=UtilBean.monthAdd(tempNextBillDate, i);
getMonth = UtilBean.getMonthOfDate(tempDate);
getYear = UtilBean.getYearOfDate(tempDate);
billMonth = new Long (getMonth).toString() +"/" + getYear;
}
}

currentDocNo = docservice.getDocumentNumber(transType, session);
currentDocDate = UtilBean.getDb2Date(billingsDate);
currentDueDate = UtilBean.dayAdd(billingsDate, creditTerm);
currentReference = "";
temporaryDescription = getTemporaryDescription(transType);
currentDescription = temporaryDescription + " FOR " + billMonth;
currentRemark = "";
currentVoidRemark = "";

currentGSTAmount = getTaxAmount(transType, unit, Constants.TAXTYPE_GST);
currentGSTRate = getTaxRate(transType, Constants.TAXTYPE_GST);
currentSERVAmount = getTaxAmount(transType, unit, Constants.TAXTYPE_SERV);
currentSERVRate = getTaxRate(transType, Constants.TAXTYPE_SERV);
currentDocAmount = unit.getDcMaintFeeAmount().add(currentGSTAmount).add(currentSERVAmount);
currentDocBalance = unit.getDcMaintFeeAmount().add(currentGSTAmount).add(currentSERVAmount);

ledger.setBiDebtor(debtorId);
ledger.setBiUnit(unit.getId());
ledger.setVcDocumentNo(currentDocNo);
ledger.setDtDocumentDate(currentDocDate);
ledger.setDtDocumentDueDate(currentDueDate);
ledger.setVcReferenceNo(currentReference);
ledger.setChPaymentMode(Constants.PAYMENTMODE_G);
// Payment Mode is set G to indicate it is Generated in Generate Billing
ledger.setChClass(Constants.CHCLASS_I);
ledger.setVcDescription(currentDescription);
ledger.setVcRemark(currentRemark);
ledger.setVcVoidRemark(currentVoidRemark);
ledger.setDcGstTaxAmount(currentGSTAmount);
ledger.setDcGstTaxRate(currentGSTRate);
ledger.setDcServiceTaxAmount(currentSERVAmount);
ledger.setDcServiceTaxRate(currentSERVRate);
ledger.setDtVoidDate(null);
ledger.setDcDocumentAmount(currentDocAmount);
ledger.setDcBalanceAmount(currentDocBalance);
ledger.setChTransactionMode(Constants.TRANSACTIONMODE_D);
ledger.setSiTransactionGroup(Constants.TRANSGRP_ONE);
ledger.setChDisputed(Constants.DISPUTED_N);
ledger.setChRecordStatus(Constants.RECORDSTATUS_A);
ledger.setBiCreateUser(cuserInfo.getUserId());
ledger.setBiModifyUser(cuserInfo.getUserId());
ledger.setDtCreateDate(UtilBean.getDb2CurrentDate());
ledger.setDtModifyDate(UtilBean.getDb2CurrentDate());

ledgerDAO.save(ledger, session);

}
tempNextBillDate = UtilBean.getLastDayOfmonth(UtilBean.monthAdd(tempNextBillDate, chargeType));
// 2006-03-14 : must clear the i counter, because it will use old counter to calculate month for tempnextbillDate
i=0;
//this cannot be remove
}

unit.setDtMaintNextBillDate(tempNextBillDate);
unit.setDtModifyDate(UtilBean.getDb2CurrentDate());
unit.setBiModifyUser(cuserInfo.getUserId());
proUnitDAO.update(unit, session);

}
}
// }
// }
}
Full stack trace of any exception that occurs:
WARN Finalizer net.sf.hibernate.impl.SessionImpl - unclosed connection
ERROR TP-Processor2 net.sf.hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor352.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.hibernate.util.GetGeneratedKeysHelper.prepareStatement(GetGeneratedKeysHelper.java:39)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:246)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:525)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:932)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at com.ifca.mcorp.hh.base._BaseRootDAO.save(_BaseRootDAO.java:559)
at com.ifca.mcorp.hh.base.BaseArdmxLedgerDAO.save(BaseArdmxLedgerDAO.java:73)
at com.ifca.mcorp.monthlycharges.services.GenerateBillingsService.generateMaintenanceFee(GenerateBillingsService.java:275)
at com.ifca.mcorp.monthlycharges.services.GenerateBillingsService.generateBillings(GenerateBillingsService.java:1366)
at com.ifca.mcorp.monthlycharges.action.GenerateBillingsAction.execute(GenerateBillingsAction.java:138)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:275)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1487)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.ifca.filters.AccessControlFilter.doFilter(AccessControlFilter.java:66)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.OutOfMemoryError: Java heap space

Name and version of the database you are using:
using apache friends-->xampp-->mysql 5.0.15

_________________
Best Regards
Boon Ting


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.