Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0039947Openbravo ERPA. Platformpublic2019-01-15 08:332022-02-01 08:07
alostale 
Triage Platform Base 
normalminorhave not tried
acknowledgedopen 
5
 
 
Core
No
0039947: insufficient context logged when DalThreadHandler fails
DalThreadHandler is in charge of transparent handling of DAL sessions per request, creating a new DAL session when a request starts and committing and closing it when it finishes.

If there is an exception while committing (ie. during flush), an exception is correctly logged, but because this exception occurs in a very generic piece of code, it does not log any clue of where it has been actually produced.
1. Add the following code to About.java

    OBContext.setAdminMode(true);
    try {
      Invoice i = (Invoice) OBDal.getInstance().createCriteria(Invoice.class).setMaxResults(1)
          .uniqueResult();
      System.out.println(i);
      i.setDescription(i.getDescription() + "-");
      // exit admin mode without flush, so it there is no access to Invoice, DalThreadHandler will
      // fail
    } catch (HibernateException e) {
    }

2. Log in Openbravo and select Employee role
3. Open About popup
    Check log, there is an exception with no info the problem is coming from About.java:

2019-01-15 08:30:17,293 [http-bio-8080-exec-7] ERROR org.openbravo.base.exception.OBSecurityException - Entity Invoice is not writable by this user
org.openbravo.base.exception.OBSecurityException: Entity Invoice is not writable by this user
    at org.openbravo.dal.security.SecurityChecker.checkWriteAccess(SecurityChecker.java:149) [classes/:?]
    at org.openbravo.dal.security.SecurityChecker.checkWriteAccess(SecurityChecker.java:107) [classes/:?]
    at org.openbravo.dal.core.OBInterceptor.doEvent(OBInterceptor.java:349) [classes/:?]
    at org.openbravo.dal.core.OBInterceptor.onFlushDirty(OBInterceptor.java:186) [classes/:?]
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:362) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:332) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:283) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:154) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:235) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:94) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1454) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1440) [hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.openbravo.dal.service.OBDal.flush(OBDal.java:263) [classes/:?]
    at org.openbravo.dal.core.SessionHandler.flushRemainingChanges(SessionHandler.java:693) [classes/:?]
    at org.openbravo.dal.core.SessionHandler.commitAndClose(SessionHandler.java:605) [classes/:?]
    at org.openbravo.dal.core.SessionHandler.commitAndClose(SessionHandler.java:587) [classes/:?]
    at org.openbravo.dal.core.DalThreadHandler.closeDefaultPoolSession(DalThreadHandler.java:69) [classes/:?]
    at org.openbravo.dal.core.DalThreadHandler.doFinal(DalThreadHandler.java:43) [classes/:?]
    at org.openbravo.dal.core.DalRequestFilter$1.doFinal(DalRequestFilter.java:100) [classes/:?]
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:66) [classes/:?]
    at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:108) [classes/:?]
No tags attached.
related to design defect 0036162 acknowledged Triage Platform Base clean up openbravo.log 
Issue History
2019-01-15 08:33alostaleNew Issue
2019-01-15 08:33alostaleAssigned To => platform
2019-01-15 08:33alostaleModules => Core
2019-01-15 08:33alostaleTriggers an Emergency Pack => No
2019-01-15 08:33alostaleStatusnew => acknowledged
2019-01-15 08:34alostaleRelationship addedrelated to 0036162
2022-02-01 08:07alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.