Openbravo Issue Tracking System - Retail Modules
View Issue Details
0033692Retail ModulesStoreServerpublic2016-08-11 18:252016-08-30 10:12
mtaal 
mtaal 
normalminorhave not tried
closedfixed 
5
 
RR16Q4RR16Q4 
Sandrahuguet
No
0033692: Prevent NPE in case no mobile server definition present but still server key is set
When there is no mobile server definition present but the server key is set in the Openbravo.properties then tomcat starts with a NPE shown below.

It can be the case that this exception occurs because the query finds nothing. Although it seems to fail in another location, it that there is no context set. A solution can be to set admin mode so that there is an OBContext.

[1]
[12:36:52] Ioritz Cia: but when I start tomcat
[12:36:58] Ioritz Cia: this error appears
[12:37:03] Ioritz Cia: although tomcat starts
[12:37:09] Ioritz Cia: and the environment works
[12:37:23] Ioritz Cia: ERROR org.openbravo.mobile.core.listener.SetCurrentMobileServerListener - Error while set current mobile server listener
java.lang.NullPointerException
    at org.openbravo.dal.service.OBDal.checkReadAccess(OBDal.java:597)
    at org.openbravo.dal.service.OBDal.checkReadAccess(OBDal.java:588)
    at org.openbravo.dal.service.OBDal.createCriteria(OBDal.java:435)
    at org.openbravo.mobile.core.listener.SetCurrentMobileServerListener.getCurrentServer(SetCurrentMobileServerListener.java:69)
    at org.openbravo.mobile.core.listener.SetCurrentMobileServerListener.contextInitialized(SetCurrentMobileServerListener.java:49)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1834)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Run standard retail
Set mobile.server.key to any value in Openbravo.properties
restart
See description
No tags attached.
causes defect 0034756 closed Sandrahuguet Transaction left open leads to database locks when updating entries from the Mobile Server window 
Issue History
2016-08-11 18:25mtaalNew Issue
2016-08-11 18:25mtaalAssigned To => mtaal
2016-08-11 18:25mtaalTriggers an Emergency Pack => No
2016-08-11 23:38mtaalReview Assigned To => Sandrahuguet
2016-08-11 23:39hgbotCheckin
2016-08-11 23:39hgbotNote Added: 0089060
2016-08-11 23:39hgbotStatusnew => resolved
2016-08-11 23:39hgbotResolutionopen => fixed
2016-08-11 23:39hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/7202f533b1ea8023df558f4a8f626f1555e57aa5 [^]
2016-08-12 10:01SandrahuguetNote Added: 0089078
2016-08-12 10:01SandrahuguetStatusresolved => closed
2016-08-12 10:01SandrahuguetFixed in Version => RR16Q4
2016-08-18 13:56mtaalNote Added: 0089213
2016-08-18 13:56mtaalStatusclosed => new
2016-08-18 13:56mtaalResolutionfixed => open
2016-08-18 13:56mtaalFixed in VersionRR16Q4 =>
2016-08-19 10:55hgbotCheckin
2016-08-19 10:55hgbotNote Added: 0089234
2016-08-19 10:55hgbotStatusnew => resolved
2016-08-19 10:55hgbotResolutionopen => fixed
2016-08-19 10:55hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/7202f533b1ea8023df558f4a8f626f1555e57aa5 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/6ccbd09b41f4f63715b94809d5e0da61afbad69d [^]
2016-08-30 10:12SandrahuguetNote Added: 0089533
2016-08-30 10:12SandrahuguetStatusresolved => closed
2016-08-30 10:12SandrahuguetFixed in Version => RR16Q4
2016-12-20 09:29dmitry_mezentsevRelationship addedcauses 0034756

Notes
(0089060)
hgbot   
2016-08-11 23:39   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 7202f533b1ea8023df558f4a8f626f1555e57aa5
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Aug 11 23:38:33 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/7202f533b1ea8023df558f4a8f626f1555e57aa5 [^]

Fixes issue 33692: Prevent NPE in case no mobile server definition present but still server key is set
Wrap the call to get the current mobile server in an admin context to prevent NPE.

---
M src/org/openbravo/mobile/core/listener/SetCurrentMobileServerListener.java
---
(0089078)
Sandrahuguet   
2016-08-12 10:01   
reviewed and tested
(0089213)
mtaal   
2016-08-18 13:56   
I new NPE now occurs after this initial fix:

java.lang.NullPointerException
        at org.openbravo.dal.core.OBInterceptor.onUpdate(OBInterceptor.java:406)
        at org.openbravo.dal.core.OBInterceptor.doEvent(OBInterceptor.java:332)
        at org.openbravo.dal.core.OBInterceptor.onFlushDirty(OBInterceptor.java:181)
        at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:372)
        at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:349)
        at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:287)
        at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155)
        at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
        at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
        at org.hibernate.event.def.DefaultDirtyCheckEventListener.onDirtyCheck(DefaultDirtyCheckEventListener.java:54)
        at org.hibernate.impl.SessionImpl.isDirty(SessionImpl.java:1202)
        at org.openbravo.dal.core.SessionHandler.flushRemainingChanges(SessionHandler.java:343)
        at org.openbravo.dal.core.SessionHandler.commitAndClose(SessionHandler.java:287)
        at org.openbravo.dal.service.OBDal.commitAndClose(OBDal.java:174)
        at org.openbravo.mobile.core.listener.SetCurrentMobileServerListener.contextInitialized(SetCurrentMobileServerListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
(0089234)
hgbot   
2016-08-19 10:55   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 6ccbd09b41f4f63715b94809d5e0da61afbad69d
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Aug 19 10:55:11 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/6ccbd09b41f4f63715b94809d5e0da61afbad69d [^]

Fixes issue 33692: Prevent NPE in case no mobile server definition present but still server key is set
Do the commit within the admin mode this prevents the second NPE being reported. Also rollback in case
of an error.

---
M src/org/openbravo/mobile/core/listener/SetCurrentMobileServerListener.java
---
(0089533)
Sandrahuguet   
2016-08-30 10:12   
reviewed