It's all up on github... [1]

[1]
https://github.com/apache/isis/blob/isis-1.5.0/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java




On 11 July 2014 12:37, Dileepa Jayakody <[email protected]> wrote:

> Hi Dan,
>
> Can you please share the link to the BackgroundCommandExecution class
> source code?
>
> Thanks,
> Dileepa
>
>
> On Fri, Jul 11, 2014 at 4:03 PM, Dileepa Jayakody <
> [email protected]
> > wrote:
>
> >
> >
> >
> > On Fri, Jul 11, 2014 at 3:54 PM, Dan Haywood <
> [email protected]
> > > wrote:
> >
> >> Um, yup.  Looks like the IsisSessionTemplate [1] sets up a session, but
> no
> >> transaction.
> >>
> >> The background command service [2] actually subclasses from [1], in
> >> its BackgroundCommandExecution class [3].  If you look through the
> source
> >> code of that then you'll see how to set up a transaction; basically:
> >>
> >>         transactionManager.executeWithinTransaction(new
> >> TransactionalClosureAbstract() {
> >>             @Override
> >>             public void execute() {
> >>                ...
> >>             }
> >>         });
> >>
> >> Do you think that IsisSessionTemplate should set up a transaction
> >> automatically?  I'm thinking it probably should...
> >>
> >
> > +1. I came across a similar transaction issue with isis Session with
> > Quartz scheduler.
> > Would be nice to have IsisSessionTemplate setting up a transaction
> > automatically as I think it's an internal operation.
> >
> >>
> >>
> >> HTH
> >> Dan
> >>
> >> [1] http://isis.apache.org/reference/non-ui/isis-session-template.html
> >> [2] http://isis.apache.org/reference/services/background-service.html
> >> [3]
> >>
> http://isis.apache.org/reference/non-ui/background-command-execution.html
> >>
> >>
> >>
> >>
> >>
> >> On 11 July 2014 11:13, Erik de Hair <[email protected]> wrote:
> >>
> >> > Hi,
> >> >
> >> > I have a service method that works correctly when called via the
> wicket
> >> > viewer. When calling the method by a Quartz scheduled job I get the
> >> > following exception:
> >> >
> >> > 12:09:42,129  [JobRunShell          SchedulerQuartzConfigXml_Worker-1
> >> > ERROR]  Job Isis.ProcessInitiatedMobileInportRequestsJob threw an
> >> unhandled
> >> > Exception:
> >> > java.lang.NullPointerException
> >> >     at
> >> >
> >>
> org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.flushTransaction(IsisTransactionManager.java:375)
> >> >     at
> >> >
> >>
> org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$7.flush(RuntimeContextFromSession.java:234)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.flush(DomainObjectContainerDefault.java:224)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.allMatches(DomainObjectContainerDefault.java:397)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.allInstances(DomainObjectContainerDefault.java:359)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.allMatches(DomainObjectContainerDefault.java:368)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.uniqueMatch(DomainObjectContainerDefault.java:449)
> >> >     at
> >> >
> >>
> org.apache.isis.applib.AbstractContainedObject.uniqueMatch(AbstractContainedObject.java:238)
> >> >     at
> >> >
> >>
> nl.pocos.dom.businessmobile.porting.MobileInportExportItem.viewModelInit(MobileInportExportItem.java:40)
> >> >     at
> >> >
> >>
> org.apache.isis.core.progmodel.facets.object.viewmodel.annotation.ViewModelFacetForInterface.initialize(ViewModelFacetForInterface.java:35)
> >> >     at
> >> >
> >>
> org.apache.isis.core.runtime.system.persistence.PersistenceSession.createViewModelInstance(PersistenceSession.java:366)
> >> >     at
> >> >
> >>
> org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession$7.createViewModelInstance(RuntimeContextFromSession.java:197)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.doCreateViewModelInstance(DomainObjectContainerDefault.java:159)
> >> >     at
> >> >
> >>
> org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault.newViewModelInstance(DomainObjectContainerDefault.java:104)
> >> >     at
> >> >
> >>
> org.apache.isis.applib.AbstractContainedObject.newViewModelInstance(AbstractContainedObject.java:86)
> >> >     at
> >> >
> >>
> nl.pocos.dom.businessmobile.porting.Portings.access$000(Portings.java:52)
> >> >     at
> >> >
> nl.pocos.dom.businessmobile.porting.Portings$1.apply(Portings.java:329)
> >> >     at
> >> >
> nl.pocos.dom.businessmobile.porting.Portings$1.apply(Portings.java:326)
> >> >     at
> >> >
> >>
> com.google.common.collect.Lists$TransformingRandomAccessList$1.transform(Lists.java:582)
> >> >     at
> >> >
> >>
> com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
> >> >     at
> >> >
> >>
> com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
> >> >     at
> >> >
> >>
> com.danhaywood.isis.domainservice.excel.impl.ExcelConverter.toFile(ExcelConverter.java:131)
> >> >     at
> >> >
> >>
> com.danhaywood.isis.domainservice.excel.impl.ExcelServiceImpl.toExcel(ExcelServiceImpl.java:69)
> >> >     at
> >> >
> >>
> nl.pocos.dom.businessmobile.porting.Portings.processInitiatedMobileInportRequests(Portings.java:336)
> >> >     at
> >> >
> >>
> webapp.scheduler.InitiatedMobileInportRequestsProcessor.doExecute(InitiatedMobileInportRequestsProcessor.java:29)
> >> >     at
> >> >
> >>
> org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate.execute(AbstractIsisSessionTemplate.java:41)
> >> >     at
> >> >
> >>
> webapp.scheduler.AbstractIsisQuartzJob.execute(AbstractIsisQuartzJob.java:53)
> >> >     at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
> >> >     at
> >> >
> >>
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> >> >
> >> > Do I need to do additional configuration for calling methods via jobs?
> >> >
> >> > Thanks,
> >> > Erik
> >> >
> >>
> >
> >
>

Reply via email to