Hi,
Below is the error log i got :
Check 254c1360e30701136c1edec40138 exists in the db.
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.wgc.rms.bo.req.StepDetailBean#254c
1360e30701136c1edec40138]
at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:65)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158)
at com.wgc.rms.bo.req.StepDetailBean$$EnhancerByCGLIB$$a090041d.getEstimatedStartDate(<generated>)
at com.wgc.rms.bo.req.JobRequest.DWR_CanStartStep(JobRequest.java:392)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at uk.ltd.getahead.dwr.impl.ExecuteQuery.execute(ExecuteQuery.java:239)
at uk.ltd.getahead.dwr.impl.DefaultExecProcessor.handle(DefaultExecProcessor.java:48)
at uk.ltd.getahead.dwr.impl.DefaultProcessor.handle(DefaultProcessor.java:83)
at uk.ltd.getahead.dwr.AbstractDWRServlet.doPost(AbstractDWRServlet.java:162)
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 jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
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.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
This is the coding involved:
public int DWR_CanStartStep(String stepDetailId, String startDateStr,
String gmtOffsetStr) {
// gmt offset needed since the method cannot get it from the request
/*
* Can start now?
* * is step ontime? is the resources ok to start? yes - send ok no -
* send not ok
*
* Is step overdue? is the resources ok to start? no - send not ok yes -
* send ok but should reschedule?
*
* Is step early? is the resources ok to start? no - send not ok yes -
* send ok but should reschedule?
*/
int gmtOffset = Integer.parseInt(gmtOffsetStr);
DateTimeUtil dateTimeUtilDo = new DateTimeUtil();
Date startDate = new Date();
if (!StringUtils.isEmpty(startDateStr)) {
startDate = dateTimeUtilDo.uiToBackend(startDateStr, gmtOffset);
}
Date newEndDate = null; // the new end date adjusted according to the
// new start date
Long timeDiff = null;
try {
Session session = HibernateUtil.getSession();
Slot slotDo = new Slot();
StepDetailBean stepDetail = (StepDetailBean) session.load(
StepDetailBean.class, stepDetailId);
System.out.println("start2");
timeDiff = startDate.getTime()
- stepDetail.getEstimatedStartDate().getTime();
newEndDate = new Date(stepDetail.getEstimatedEndDate().getTime()
+ timeDiff);
System.out.println("start3");
if (!canStartStepNow(session, stepDetail, startDate)) {
logger.debug("DWR return value:" + DWR_STEP_START_FAILED
+ " Step failed to start!");
System.out.println("start4");
HibernateUtil.closeSession();
return DWR_STEP_START_FAILED; // step cannot start, regardless
// what was the date given
// (late, early, ontime- doesnt
// matter)
} else if (startDate.getTime() > stepDetail.getEstimatedStartDate()
.getTime()
+ (STEP_START_GRACE_PERIOD_MIN * 60000)) {
Set<SlotStateBean> slotStateList = stepDetail.getSlotState();
if (slotStateList == null || slotStateList.size() == 0) {
logger.debug("DWR return value:"
+ DWR_STEP_START_LATE_SUCCESS
+ " Step is starting late 1");
System.out.println("start5");
HibernateUtil.closeSession();
return DWR_STEP_START_LATE_SUCCESS;// step can start but
// it's starting late
} else {
boolean allSlotStateHasThisStepDetailAndStartsWithinOperationHours = true;
EACH_SLOT_STATE: for (SlotStateBean eachSlotState : slotStateList) {
// startDate
SlotBean eachSlot = (SlotBean) session.load(
SlotBean.class, eachSlotState.getSlotId());
DriverBean parentDriver = (DriverBean) session.load(
DriverBean.class, eachSlot.getDriverId());
ZoneBean parentZone = (ZoneBean) session.load(
ZoneBean.class, parentDriver.getZoneId());
EquipmentBean parentEquipment = (EquipmentBean) session
.load(EquipmentBean.class, parentZone
.getEquipmentId());
if (!withinEquipmentOpHours(session, parentEquipment,
startDate, newEndDate)) {
logger
.debug("test start or end beyond equipment operational hours");
allSlotStateHasThisStepDetailAndStartsWithinOperationHours = false;
break EACH_SLOT_STATE;
}
if (!noClashingSlotState(session, eachSlot, stepDetail,
startDate, newEndDate)) {
allSlotStateHasThisStepDetailAndStartsWithinOperationHours = false;
break EACH_SLOT_STATE;
}
} // for each
if (allSlotStateHasThisStepDetailAndStartsWithinOperationHours) {
logger.debug("DWR return value:"
+ DWR_STEP_START_LATE_SUCCESS
+ " step is starting late 2 ");
HibernateUtil.closeSession();
System.out.println("start9");
return DWR_STEP_START_LATE_SUCCESS;// step can start
// but it's starting
// late
} else {
logger.debug("DWR return value:"
+ DWR_STEP_START_LATE_SUCCESS
+ " step starting late but CANNOT start");
HibernateUtil.closeSession();
return DWR_STEP_START_FAILED; // step cannot start,
// regardless what was
// the date given (late,
// early, ontime- doesnt
// matter)
}
}
} else if (startDate.getTime() < stepDetail.getEstimatedStartDate()
.getTime()
- (STEP_START_GRACE_PERIOD_MIN * 60000)) {
Set<SlotStateBean> slotStateList = stepDetail.getSlotState();
if (slotStateList == null || slotStateList.size() == 0) {
logger.debug("DWR return value:"
+ DWR_STEP_START_EARLY_SUCCESS
+ " Step is starting early 1");
HibernateUtil.closeSession();
return DWR_STEP_START_EARLY_SUCCESS;// step can start but
// it's starting late
} else {
boolean allSlotStateHasThisStepDetailAndStartsWithinOperationHours = true;
EACH_SLOT_STATE: for (SlotStateBean eachSlotState : slotStateList) {
SlotBean eachSlot = (SlotBean) session.load(
SlotBean.class, eachSlotState.getSlotId());
DriverBean parentDriver = (DriverBean) session.load(
DriverBean.class, eachSlot.getDriverId());
ZoneBean parentZone = (ZoneBean) session.load(
ZoneBean.class, parentDriver.getZoneId());
EquipmentBean parentEquipment = (EquipmentBean) session
.load(EquipmentBean.class, parentZone
.getEquipmentId());
if (!withinEquipmentOpHours(session, parentEquipment,
startDate, newEndDate)) {
logger
.debug("test start or end beyond equipment operational hours");
allSlotStateHasThisStepDetailAndStartsWithinOperationHours = false;
break EACH_SLOT_STATE;
}
if (!noClashingSlotState(session, eachSlot, stepDetail,
startDate, newEndDate)) {
allSlotStateHasThisStepDetailAndStartsWithinOperationHours = false;
System.out.println("start15");
break EACH_SLOT_STATE;
}
}
if (allSlotStateHasThisStepDetailAndStartsWithinOperationHours) {
logger.debug("DWR return value:"
+ DWR_STEP_START_EARLY_SUCCESS
+ " step is starting early 2 ");
HibernateUtil.closeSession();
return DWR_STEP_START_EARLY_SUCCESS;// step can start
// but it's starting
// late
} else {
logger.debug("DWR return value:"
+ DWR_STEP_START_EARLY_SUCCESS
+ " step starting early but CANNOT start");
HibernateUtil.closeSession();
return DWR_STEP_START_FAILED; // step cannot start,
// regardless what was
// the date given (late,
// early, ontime- doesnt
// matter)
}
}
} else {
logger.debug("DWR return value:" + DWR_STEP_START_SUCCESS
+ " starting on time SUCCESS");
HibernateUtil.closeSession();
return DWR_STEP_START_SUCCESS; // step can start and is on time
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("start19");
logger
.warn("DWR canStartStep exception occured. "
+ e.getMessage());
} finally {
try {
HibernateUtil.closeSession();
} catch (Exception e) {
}
}
logger.debug("Staring failed for some reason");
return DWR_STEP_START_FAILED;
}
Please help.
Thanks.