I have EJB bean and there is a class RemoveInactiveUsersTask extends TimerTask when I invoke method which update user status in DB.
This is sample code of my class:
@Singleton
@Named
@ApplicationScoped
public class UsersStatusManager implements Serializable {
@SuppressWarnings("CdiInjectionPointsInspection")
@Inject
private EntityManager entityManager;
...
}
And this is my errors:
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
I use JSF with CDI and Seam 3. Method is of course annotate with @Transactional and everything is ok until I use it in timer. I tried to use unmanaged EntityManager but then I have transaction required exceptions.
Any ideas how I can solve this problem?