Hi all.

I’m implementing custom Quartz Jobs using as the base class literally the same 
“AbstractIsisQuartzJob” class described in [1].



Copied directly from my Eclipse (not from [1]):

public abstract class AbstractIsisQuartzJob implements Job {

    public static enum ConcurrentInstancesPolicy {
        SINGLE_INSTANCE_ONLY,
        MULTIPLE_INSTANCES
    }

    private final AbstractIsisSessionTemplate isisRunnable;

    private final ConcurrentInstancesPolicy concurrentInstancesPolicy;
    private boolean executing;

    public AbstractIsisQuartzJob(final AbstractIsisSessionTemplate 
isisRunnable) {
        this(isisRunnable, ConcurrentInstancesPolicy.SINGLE_INSTANCE_ONLY);
    }

    public AbstractIsisQuartzJob(
            final AbstractIsisSessionTemplate isisRunnable,
            final ConcurrentInstancesPolicy concurrentInstancesPolicy) {
        this.isisRunnable = isisRunnable;
        this.concurrentInstancesPolicy = concurrentInstancesPolicy;
    }

    /**
     * Sets up an {@link IsisSession} then delegates to the
     * {@link #doExecute(JobExecutionContext) hook}.
     */
    @Override
    public void execute(
            final JobExecutionContext context) throws JobExecutionException {
        final AuthenticationSession authSession = this.newAuthSession(context);
        try {
            if ((this.concurrentInstancesPolicy ==
                    ConcurrentInstancesPolicy.SINGLE_INSTANCE_ONLY) &&
                    this.executing) {
                return;
            }
            this.executing = true;

            this.isisRunnable.execute(authSession, context);
        } finally {
            this.executing = false;
        }
    }

    AuthenticationSession newAuthSession(
            final JobExecutionContext context) {
        final String user = this.getKey(context, SchedulerConstants.USER_KEY);
        final String rolesStr = this.getKey(context, 
SchedulerConstants.ROLES_KEY);
        final String[] roles = Iterables.toArray(
                Splitter.on(",").split(rolesStr), String.class);
        return new SimpleSession(user, roles);
    }

    @SuppressWarnings("static-method")
    String getKey(
            final JobExecutionContext context,
            final String key) {
        return context.getMergedJobDataMap().getString(key);
    }
}



This Quartz Job is invoked in the middle of a massive import executed from a 
Fixture Script.


Problem is that I cannot determine the root cause, as seems to be some conflict 
between both Isis sessions …


EXCEPTION THROWN

Rerun 
sales.integtests.Market.stocks.MarketUpdateStocksServiceTests.UpdateAllStocksInMarketplace.equivalentResults
equivalentResults(sales.integtests.Market.stocks.MarketUpdateStocksServiceTests$UpdateAllStocksInMarketplace)
javax.jdo.JDOUserException: Objeto con id "14153[OID]sales.dom.backend.Product" 
es manejado por otro ExecutionContext
        at 
org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:636)
        at org.datanucleus.api.jdo.JDOQuery.executeWithMap(JDOQuery.java:363)
        at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.getResults(PersistenceQueryFindUsingApplibQueryProcessor.java:117)
        at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.process(PersistenceQueryFindUsingApplibQueryProcessor.java:57)
        at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.process(PersistenceQueryFindUsingApplibQueryProcessor.java:40)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.processPersistenceQuery(PersistenceSession.java:500)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.access$000(PersistenceSession.java:153)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession$1.execute(PersistenceSession.java:461)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession$1.execute(PersistenceSession.java:458)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.findInstancesInTransaction(PersistenceSession.java:457)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.firstMatchingQuery(PersistenceSession.java:429)
        at 
org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$2.firstMatchingQuery(RuntimeContextFromSession.java:182)
        at 
org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.firstMatch(DomainObjectContainerDefault.java:670)
        at sales.dom.backend.Product.findTermsForSupplier(Product.java:302)
        at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:407)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.invoke(ActionInvocationFacetForDomainEventAbstract.java:210)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:62)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.Product_$$_jvst8a_8.findTermsForSupplier(Product_$$_jvst8a_8.java)
        at sales.dom.backend.Product.findOrCreateSupplierTerms(Product.java:313)
        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:407)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.invoke(ActionInvocationFacetForDomainEventAbstract.java:210)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:62)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.Product_$$_jvst8a_8.findOrCreateSupplierTerms(Product_$$_jvst8a_8.java)
        at sales.dom.backend.Product.updateSupplierStock(Product.java:274)
        at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:407)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.invoke(ActionInvocationFacetForDomainEventAbstract.java:210)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:62)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.Product_$$_jvst8a_8.updateSupplierStock(Product_$$_jvst8a_8.java)
        at 
sales.dom.Supplier.SupplierProductService.upsertProductFromSupplier(SupplierProductService.java:61)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.lambda$0(UpsertAllProductsFromSupplier.java:28)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier$$Lambda$1/1434151479.accept(Unknown
 Source)
        at java.util.ArrayList.forEach(ArrayList.java:1234)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.upsertAllProductsFromSupplier(UpsertAllProductsFromSupplier.java:26)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.execute(UpsertAllProductsFromSupplier.java:21)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChildIfNotAlready(FixtureScript.java:553)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.access$200(FixtureScript.java:252)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript.run(FixtureScript.java:779)
        at 
org.apache.isis.applib.fixturescripts.FixtureScripts.runFixtureScript(FixtureScripts.java:391)
        at 
org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault.runFixtureScript(FixtureScriptsDefault.java:104)
        at 
sales.integtests.Market.stocks.MarketUpdateStocksServiceTests$UpdateAllStocksInMarketplace.equivalentResults(MarketUpdateStocksServiceTests.java:136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2$1.evaluate(JUnitRuleMockery2.java:146)
        at 
org.apache.isis.core.integtestsupport.ExceptionRecognizerTranslate$TranslationStatement.evaluate(ExceptionRecognizerTranslate.java:48)
        at 
org.apache.isis.core.integtestsupport.IntegrationTestAbstract$IsisTransactionRule$1.evaluate(IntegrationTestAbstract.java:226)
        at 
org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
NestedThrowablesStackTrace:
Objeto con id "14153[OID]sales.dom.backend.Product" es manejado por otro 
ExecutionContext
org.datanucleus.exceptions.NucleusUserException: Objeto con id 
"14153[OID]sales.dom.backend.Product" es manejado por otro ExecutionContext
        at 
org.datanucleus.ExecutionContextImpl.findObjectProvider(ExecutionContextImpl.java:1268)
        at 
org.datanucleus.store.rdbms.mapping.java.PersistableMapping.setObjectAsValue(PersistableMapping.java:409)
        at 
org.datanucleus.store.rdbms.mapping.java.PersistableMapping.setObject(PersistableMapping.java:321)
        at 
org.datanucleus.store.rdbms.mapping.java.PersistableMapping.setObject(PersistableMapping.java:300)
        at 
org.datanucleus.store.rdbms.sql.SQLStatementHelper.applyParametersToStatement(SQLStatementHelper.java:239)
        at 
org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:607)
        at org.datanucleus.store.query.Query.executeQuery(Query.java:1841)
        at org.datanucleus.store.query.Query.executeWithMap(Query.java:1748)
        at org.datanucleus.api.jdo.JDOQuery.executeWithMap(JDOQuery.java:346)
        at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.getResults(PersistenceQueryFindUsingApplibQueryProcessor.java:117)
        at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.process(PersistenceQueryFindUsingApplibQueryProcessor.java:57)
        at 
org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor.process(PersistenceQueryFindUsingApplibQueryProcessor.java:40)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.processPersistenceQuery(PersistenceSession.java:500)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.access$000(PersistenceSession.java:153)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession$1.execute(PersistenceSession.java:461)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession$1.execute(PersistenceSession.java:458)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.findInstancesInTransaction(PersistenceSession.java:457)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.firstMatchingQuery(PersistenceSession.java:429)
        at 
org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$2.firstMatchingQuery(RuntimeContextFromSession.java:182)
        at 
org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.firstMatch(DomainObjectContainerDefault.java:670)
        at sales.dom.backend.Product.findTermsForSupplier(Product.java:302)
        at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:407)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.invoke(ActionInvocationFacetForDomainEventAbstract.java:210)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:62)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.Product_$$_jvst8a_8.findTermsForSupplier(Product_$$_jvst8a_8.java)
        at sales.dom.backend.Product.findOrCreateSupplierTerms(Product.java:313)
        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:407)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.invoke(ActionInvocationFacetForDomainEventAbstract.java:210)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:62)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.Product_$$_jvst8a_8.findOrCreateSupplierTerms(Product_$$_jvst8a_8.java)
        at sales.dom.backend.Product.updateSupplierStock(Product.java:274)
        at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.internalInvoke(ActionInvocationFacetForDomainEventAbstract.java:407)
        at 
org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacetForDomainEventAbstract.invoke(ActionInvocationFacetForDomainEventAbstract.java:210)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:62)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:216)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.Product_$$_jvst8a_8.updateSupplierStock(Product_$$_jvst8a_8.java)
        at 
sales.dom.Supplier.SupplierProductService.upsertProductFromSupplier(SupplierProductService.java:61)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.lambda$0(UpsertAllProductsFromSupplier.java:28)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier$$Lambda$1/1434151479.accept(Unknown
 Source)
        at java.util.ArrayList.forEach(ArrayList.java:1234)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.upsertAllProductsFromSupplier(UpsertAllProductsFromSupplier.java:26)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.execute(UpsertAllProductsFromSupplier.java:21)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChildIfNotAlready(FixtureScript.java:553)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.access$200(FixtureScript.java:252)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript.run(FixtureScript.java:779)
        at 
org.apache.isis.applib.fixturescripts.FixtureScripts.runFixtureScript(FixtureScripts.java:391)
        at 
org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault.runFixtureScript(FixtureScriptsDefault.java:104)
        at 
sales.integtests.Market.stocks.MarketUpdateStocksServiceTests$UpdateAllStocksInMarketplace.equivalentResults(MarketUpdateStocksServiceTests.java:136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2$1.evaluate(JUnitRuleMockery2.java:146)
        at 
org.apache.isis.core.integtestsupport.ExceptionRecognizerTranslate$TranslationStatement.evaluate(ExceptionRecognizerTranslate.java:48)
        at 
org.apache.isis.core.integtestsupport.IntegrationTestAbstract$IsisTransactionRule$1.evaluate(IntegrationTestAbstract.java:226)
        at 
org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)



TRACE LOG


22:35:32,937  [Native               main       DEBUG]  SELECT 
'sales.dom.backend.ProductSupplierTerms' AS 
NUCLEUS_TYPE,"A0"."purchasePrice","A0"."stock","A0"."ProductSupplierTerms_ID" 
FROM "sales_backend"."ProductSupplierTerms" "A0" WHERE 
"A0"."product_Product_ID_OID" = <14153> AND "A0"."supplier_Supplier_ID_OID" = 
<0>
22:35:34,179  [Native               sales-Quartz-ThreadPool_Worker-1 DEBUG]  
INSERT INTO "sales_backend"."ProductSupplierTerms" 
("product_Product_ID_OID","purchasePrice","stock","supplier_Supplier_ID_OID") 
VALUES (<14153>,<null>,<0>,<0>)
22:35:34,575  [PersistenceSession   sales-Quartz-ThreadPool_Worker-1 ERROR]  
close: failed to end transaction; continuing to avoid memory leakage
22:35:34,580  [Native               main       DEBUG]  SELECT 
"A0"."purchasePrice","A0"."stock" FROM "sales_backend"."ProductSupplierTerms" 
"A0" WHERE "A0"."ProductSupplierTerms_ID" = <14153>
22:35:34,583  [Native               main       DEBUG]  SELECT 
"A0"."purchasePrice","A0"."stock" FROM "sales_backend"."ProductSupplierTerms" 
"A0" WHERE "A0"."ProductSupplierTerms_ID" = <14153>
22:35:34,585  [Native               main       DEBUG]  SELECT 
"B0"."gender","B0"."name","B0"."recommendedPrice","B0"."sku","B0"."Product_ID" 
FROM "sales_backend"."ProductSupplierTerms" "A0" INNER JOIN 
"sales_backend"."Product" "B0" ON "A0"."product_Product_ID_OID" = 
"B0"."Product_ID" WHERE "A0"."ProductSupplierTerms_ID" = <14153>
22:35:34,586  [Native               main       DEBUG]  SELECT 
"B0"."name","B0"."Supplier_ID" FROM "sales_backend"."ProductSupplierTerms" "A0" 
INNER JOIN "sales_backend"."Supplier" "B0" ON "A0"."supplier_Supplier_ID_OID" = 
"B0"."Supplier_ID" WHERE "A0"."ProductSupplierTerms_ID" = <14153>
22:35:34,589  [Native               main       DEBUG]  INSERT INTO 
"sales_backend"."ProductSupplierTermsPurchasePriceUpdate" 
("dateTime","newPurchasePrice","oldPurchasePrice","productSupplierTerms_ProductSupplierTerms_ID_OID")
 VALUES (<2016-01-03 22:35:34.588>,<24.37>,<null>,<14153>)
22:35:34,589  [Native               main       DEBUG]  UPDATE 
"sales_backend"."ProductSupplierTerms" SET "purchasePrice"=<24.37> WHERE 
"ProductSupplierTerms_ID"=<14153>
22:35:34,590  [PersistenceSession   sales-Quartz-ThreadPool_Worker-1 ERROR]  
close: failed to close JDO persistenceManager; continuing to avoid memory 
leakage
22:35:34,592  [Native               main       DEBUG]  SELECT 
'sales.dom.backend.Supplier' AS NUCLEUS_TYPE,"A0"."name","A0"."Supplier_ID" 
FROM "sales_backend"."Supplier" "A0" WHERE "A0"."name" = <'Supplier'>
22:35:34,596  [ServiceInstantiator  main       WARN ]  ... @PreDestroy method 
threw exception - continuing anyway
java.lang.NullPointerException
        at 
org.apache.isis.objectstore.jdo.datanucleus.service.support.TimestampService.close(TimestampService.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.apache.isis.core.commons.lang.MethodExtensions.invoke(MethodExtensions.java:53)
        at 
org.apache.isis.core.commons.lang.MethodExtensions.invoke(MethodExtensions.java:47)
        at 
org.apache.isis.core.runtime.services.ServiceInstantiator.callPreDestroyIfPresent(ServiceInstantiator.java:277)
        at 
org.apache.isis.core.runtime.services.ServiceInstantiator$2.invoke(ServiceInstantiator.java:195)
        at 
org.apache.isis.objectstore.jdo.datanucleus.service.support.TimestampService_$$_jvst8a_5.__isis_preDestroy(TimestampService_$$_jvst8a_5.java)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.endRequestOnRequestScopeServices(IsisTransactionManager.java:331)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.endTransaction(IsisTransactionManager.java:514)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:218)
        at 
org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:59)
        at 
org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionDefault.execute(ObjectActionDefault.java:363)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.handleActionMethod(DomainObjectInvocationHandler.java:625)
        at 
org.apache.isis.core.wrapper.handlers.DomainObjectInvocationHandler.invoke(DomainObjectInvocationHandler.java:260)
        at 
org.apache.isis.core.wrapper.proxy.ProxyCreator$1.invoke(ProxyCreator.java:72)
        at 
sales.dom.backend.SupplierRepository_$$_jvst8a_b.theSupplierSupplier(SupplierRepository_$$_jvst8a_b.java)
        at 
sales.dom.Supplier.SupplierProductService.upsertProductFromSupplier(SupplierProductService.java:61)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.lambda$0(UpsertAllProductsFromSupplier.java:28)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier$$Lambda$1/1434151479.accept(Unknown
 Source)
        at java.util.ArrayList.forEach(ArrayList.java:1234)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.upsertAllProductsFromSupplier(UpsertAllProductsFromSupplier.java:26)
        at 
sales.fixture.Supplier.UpsertAllProductsFromSupplier.execute(UpsertAllProductsFromSupplier.java:21)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.executeChildIfNotAlready(FixtureScript.java:553)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript$ExecutionContext.access$200(FixtureScript.java:252)
        at 
org.apache.isis.applib.fixturescripts.FixtureScript.run(FixtureScript.java:779)
        at 
org.apache.isis.applib.fixturescripts.FixtureScripts.runFixtureScript(FixtureScripts.java:391)
        at 
org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault.runFixtureScript(FixtureScriptsDefault.java:104)
        at 
sales.integtests.Market.stocks.MarketUpdateStocksServiceTests$UpdateAllStocksInMarketplace.equivalentResults(MarketUpdateStocksServiceTests.java:136)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2$1.evaluate(JUnitRuleMockery2.java:146)
        at 
org.apache.isis.core.integtestsupport.ExceptionRecognizerTranslate$TranslationStatement.evaluate(ExceptionRecognizerTranslate.java:48)
        at 
org.apache.isis.core.integtestsupport.IntegrationTestAbstract$IsisTransactionRule$1.evaluate(IntegrationTestAbstract.java:226)
        at 
org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
22:35:34,607  [IsisTransaction      main       INFO ]  abort transaction 
IsisTransaction@5212ac3a[state=MUST_ABORT,commands=0]
22:35:34,620  [IsisSystem           Thread-0   INFO ]  shutting down system
22:35:34,623  [ServiceInitializer   Thread-0   INFO ]  calling @PreDestroy on 
all domain services
22:35:34,633  [QuartzScheduler      Thread-0   INFO ]  Scheduler sales 
Scheduler_$_sales-Scheduler shutting down.
22:35:34,635  [QuartzScheduler      Thread-0   INFO ]  Scheduler sales 
Scheduler_$_sales-Scheduler paused.
22:35:34,633  [JobRunShell          sales-Quartz-ThreadPool_Worker-1 ERROR]  
Job Market - Feeds.Update Completed Feeds threw an unhandled Exception: 
javax.jdo.JDOFatalUserException: Persistence Manager ya esta cerrado
        at 
org.datanucleus.api.jdo.JDOPersistenceManager.assertIsOpen(JDOPersistenceManager.java:2224)
        at 
org.datanucleus.api.jdo.JDOPersistenceManager.currentTransaction(JDOPersistenceManager.java:377)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.startTransaction(PersistenceSession.java:1212)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.startTransaction(IsisTransactionManager.java:287)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:171)
        at 
org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.doExecute(AbstractIsisSessionTemplate.java:62)
        at 
org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.execute(AbstractIsisSessionTemplate.java:39)
        at 
sales.dom.scheduler.AbstractIsisQuartzJob.execute(AbstractIsisQuartzJob.java:54)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at 
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
22:35:34,636  [ErrorLogger          sales-Quartz-ThreadPool_Worker-1 ERROR]  
Job (Market - Feeds.Update Completed Feeds threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested 
exception: javax.jdo.JDOFatalUserException: Persistence Manager ya esta cerrado]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
        at 
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: javax.jdo.JDOFatalUserException: Persistence Manager ya esta cerrado
        at 
org.datanucleus.api.jdo.JDOPersistenceManager.assertIsOpen(JDOPersistenceManager.java:2224)
        at 
org.datanucleus.api.jdo.JDOPersistenceManager.currentTransaction(JDOPersistenceManager.java:377)
        at 
org.apache.isis.core.runtime.system.persistence.PersistenceSession.startTransaction(PersistenceSession.java:1212)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.startTransaction(IsisTransactionManager.java:287)
        at 
org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:171)
        at 
org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.doExecute(AbstractIsisSessionTemplate.java:62)
        at 
org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.execute(AbstractIsisSessionTemplate.java:39)
        at 
sales.dom.scheduler.AbstractIsisQuartzJob.execute(AbstractIsisQuartzJob.java:54)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        ... 1 more
java.lang.IllegalStateException: No Session opened for this thread
        at 
org.apache.isis.core.runtime.system.context.IsisContext.getSession(IsisContext.java:399)
        at 
org.apache.isis.core.runtime.system.context.IsisContext.getPersistenceSession(IsisContext.java:427)
        at 
org.apache.isis.core.runtime.system.context.IsisContext.getTransactionManager(IsisContext.java:444)
        at 
org.apache.isis.core.runtime.system.IsisSystem.getTransactionManager(IsisSystem.java:422)
        at 
org.apache.isis.core.runtime.system.IsisSystem.shutdownServices(IsisSystem.java:361)
        at 
org.apache.isis.core.runtime.system.IsisSystem.shutdown(IsisSystem.java:337)
        at 
org.apache.isis.core.integtestsupport.IsisSystemForTest.shutdown(IsisSystemForTest.java:466)
        at 
org.apache.isis.core.integtestsupport.IsisSystemForTest.access$100(IsisSystemForTest.java:73)
        at 
org.apache.isis.core.integtestsupport.IsisSystemForTest$Builder$1.run(IsisSystemForTest.java:300)
22:35:35,043  [QuartzScheduler      Thread-0   INFO ]  Scheduler sales 
Scheduler_$_sales-Scheduler shutdown complete.
22:35:35,243  [ObjectReflectorDefault Thread-0   INFO ]  shutting down 
org.apache.isis.core.metamodel.specloader.ObjectReflectorDefault@1cdd6514



Any ideas, please?

Seems there is some problem regarding Isis session and/or transaction handling, 
but not sure how to determine it.



Thanks in advance,

Oscar





[1] 
https://github.com/isisaddons/isis-module-command/blob/ef2aac512572b98a6edd24cef536a6bf11cf2807/README.md
 
<https://github.com/isisaddons/isis-module-command/blob/ef2aac512572b98a6edd24cef536a6bf11cf2807/README.md>

Reply via email to