NutzCN Logo
问答 按Demo集成的uflo, 在查询工作流任务的时候报no session?
发布于 2252天前 作者 wx_71sij4eo89pbjtkmb8uu 1876 次浏览 复制 上一个帖子 下一个帖子
标签:

我是按demo集成的uflo, 现在尝试跑一个测试流程, 在查询工作流任务的时候报了no session, service层代码如下:
```java
@IocBean(args = {"refer:dao"})
public class UfloServiceBean extends BaseServiceImpl implements UfloService {
public UfloServiceBean(Dao dao) {
super(dao);
}

@Inject
private ProcessService processService;

@Inject
private TaskService taskService;

public ApiResult start() {
    StartProcessInfo info=new StartProcessInfo("user1");
    info.setBusinessId("bill_id_1");
    processService.startProcessByKey("test-2", info);
    return new ApiResult();
}

public ApiResult listTask() {
    ApiResult result = new ApiResult();
    List<Task> tasks = taskService.createTaskQuery().assignee("user1").list();
    result.setData(tasks);
    return result;
}

}

controller层代码如下:

package cn.regentsoft.newmf.uflo.api;

import cn.regentsoft.newmf.uflo.service.UfloService;
import cn.regentsoft.newmf.web.api.ApiResult;
import cn.regentsoft.newmf.web.commons.filter.MyCrossOriginFilter;
import cn.regentsoft.newmf.web.commons.filter.TokenFilter;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.adaptor.JsonAdaptor;
import org.nutz.mvc.annotation.*;

@IocBean
@At("/v1/api/uflo")
@Filters({@By(type = TokenFilter.class), @By(type = MyCrossOriginFilter.class)})
public class UfloTestAPI {

@Inject
private UfloService ufloService;

@GET
@At("/start")
@AdaptBy(type = JsonAdaptor.class)
public ApiResult start() {
    return ufloService.start();
}

@GET
@At("/list-task")
@AdaptBy(type = JsonAdaptor.class)
public ApiResult listTask() {
    return ufloService.listTask();
}

}

```

3 回复

忘了贴报错信息了, 如下:
```java
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.bstek.uflo.model.task.Task.taskParticipators, could not initialize proxy - no Session
at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:584)
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:201)
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:563)
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:132)
at org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:277)
at org.nutz.json.impl.JsonRenderImpl.coll2Json(JsonRenderImpl.java:439)
at org.nutz.json.impl.JsonRenderImpl.render(JsonRenderImpl.java:153)
at org.nutz.json.impl.JsonRenderImpl.appendPair(JsonRenderImpl.java:199)
at org.nutz.json.impl.JsonRenderImpl.writeItem(JsonRenderImpl.java:350)
at org.nutz.json.impl.JsonRenderImpl.pojo2Json(JsonRenderImpl.java:343)
at org.nutz.json.impl.JsonRenderImpl.render(JsonRenderImpl.java:161)
at org.nutz.json.impl.JsonRenderImpl.coll2Json(JsonRenderImpl.java:440)
at org.nutz.json.impl.JsonRenderImpl.render(JsonRenderImpl.java:153)
at org.nutz.json.impl.JsonRenderImpl.appendPair(JsonRenderImpl.java:199)
at org.nutz.json.impl.JsonRenderImpl.writeItem(JsonRenderImpl.java:350)
at org.nutz.json.impl.JsonRenderImpl.pojo2Json(JsonRenderImpl.java:343)
at org.nutz.json.impl.JsonRenderImpl.render(JsonRenderImpl.java:161)
at org.nutz.json.Json.toJson(Json.java:239)
at org.nutz.mvc.Mvcs.write(Mvcs.java:292)
at org.nutz.mvc.view.UTF8JsonView.render(UTF8JsonView.java:68)
at org.nutz.mvc.impl.processor.ViewProcessor.process(ViewProcessor.java:66)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:30)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at cn.regentsoft.newmf.web.commons.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:35)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at cn.regentsoft.newmf.web.commons.processor.NutShiroProcessor.process(NutShiroProcessor.java:54)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at cn.regentsoft.newmf.web.commons.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:36)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at cn.regentsoft.newmf.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at cn.regentsoft.newmf.web.commons.filter.RouteFilter.doFilter(RouteFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

```

在执行List<Task> tasks = taskService.createTaskQuery().assignee("user1").list();这句代码的时候报的错

添加回复
请先登陆
回到顶部