Hi all,
I’m trying to fire cdi-events from a background thread using Vaadin CDI 1.0.2 + Vaadin 7.3.8 and Wildfly 8.2.
The following code works well unless I redeploy the app.
scheduleEvent.fire(new ScheduleEvent(ScheduleEvent.ScheduleEventEnum.SCHEDULE_STATUS_CHANGE, newSchedule));
As soon as I redeploy it, the following error appears:
java.lang.IllegalStateException: Can't find proper view for @ViewScoped bean, no views are active for this ui.
14:34:41,810 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.AbstractVaadinContext$SessionData$UIData.getProbableInjectionPointView(AbstractVaadinContext.java:85)
14:34:41,810 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.ViewScopedContext.getContextualStorage(ViewScopedContext.java:96)
14:34:41,810 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:113)
14:34:41,810 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.AbstractVaadinContext.get(AbstractVaadinContext.java:156)
14:34:41,811 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.ContextWrapper.get(ContextWrapper.java:49)
14:34:41,811 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
14:34:41,811 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:840)
14:34:41,811 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
14:34:41,811 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:370)
14:34:41,812 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:381)
14:34:41,812 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
14:34:41,812 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
14:34:41,812 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
14:34:41,812 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
14:34:41,813 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:150)
14:34:41,813 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.UIContextual.create(UIContextual.java:85)
14:34:41,813 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.apache.deltaspike.core.util.context.ContextualStorage.createContextualInstance(ContextualStorage.java:117)
14:34:41,813 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:129)
14:34:41,813 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.AbstractVaadinContext.get(AbstractVaadinContext.java:156)
14:34:41,814 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at com.vaadin.cdi.internal.ContextWrapper.get(ContextWrapper.java:49)
14:34:41,814 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverMethodImpl.getReceiver(ObserverMethodImpl.java:307)
14:34:41,814 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverMethodImpl.getReceiverIfExists(ObserverMethodImpl.java:292)
14:34:41,814 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:256)
14:34:41,814 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:237)
14:34:41,815 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:174)
14:34:41,815 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:170)
14:34:41,815 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.TransactionalObserverNotifier.notifyObserver(TransactionalObserverNotifier.java:46)
14:34:41,815 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:124)
14:34:41,815 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.jboss.weld.event.EventImpl.fire(EventImpl.java:84)
14:34:41,816 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.ceia.mdna.updater.gui.update.components.updateshelf.UpdateScheduleStatusChecker$UpdateScheduleCheckTask.run(UpdateScheduleStatusChecker.java:89)
14:34:41,816 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
14:34:41,816 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
14:34:41,816 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.glassfish.enterprise.concurrent.internal.ManagedScheduledThreadPoolExecutor$ManagedScheduledFutureTask.access$201(ManagedScheduledThreadPoolExecutor.java:383)
14:34:41,816 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.glassfish.enterprise.concurrent.internal.ManagedScheduledThreadPoolExecutor$ManagedScheduledFutureTask.run(ManagedScheduledThreadPoolExecutor.java:534)
14:34:41,817 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
14:34:41,817 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
14:34:41,817 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at java.lang.Thread.run(Thread.java:724)
14:34:41,817 ERROR [stderr]
(EE-ManagedScheduledExecutorService-default-Thread-2) at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)
I use CDI-events in almost all parts of my app without getting this error, so I assume that this could be related to the use of background threads.
Could someone give me a hint on how to proceed?
Regards