我有EJB bean,当我调用在数据库中更新用户状态的方法时,有一个类RemoveInactiveUsersTask扩展了TimerTask。
这是我的类的示例代码:
@Singleton
@Named
@ApplicationScoped
public class UsersStatusManager implements Serializable {
@SuppressWarnings("CdiInjectionPointsInspection")
@Inject
private EntityManager entityManager;
...
}这就是我的错误:
Exception in thread "Timer-2" javax.ejb.EJBException: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped我将JSF与CDI和Seam3一起使用。Method当然是用@Transactional注解的,一切都很好,直到我在timer中使用它。我尝试使用非托管EntityManager,但随后出现了事务处理所需的异常。
你知道我该怎么解决这个问题吗?
发布于 2013-05-12 22:25:03
异常是正确的,这里没有活动的请求上下文。您应该尝试较低的作用域;例如,dependent。
https://stackoverflow.com/questions/16507532
复制相似问题