<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: OutOfScopeException: Cannot access scoped</title><link>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped</link><description>&lt;p&gt;Hi all
I'm using ivy 6.3.0 with JSF + Primefaces, when i test my website with multiple users at the same time, i got this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;12:36:49.661 ERROR [ch.ivyteam.ivy.dialog.execution.jsf.error] [http-nio-8443-exec-393] [requestId=2235134]
  Error during rendering of html dialog
    com.google.inject.ProvisionException: Unable to provision, see the following errors:
    1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot access scoped [ch.ivyteam.ivy.dialog.execution.DialogRuntimeManager]. Either we are not currently inside an HTTP Servlet request, or you may have forgotten to apply com.google.inject.servlet.GuiceFilter as a servlet filter for this request.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We also get this problem when i embed my page to another by using &lt;em&gt;iframe&lt;/em&gt; &lt;/p&gt;
&lt;p&gt;We don't use any api from &lt;em&gt;com.google.inject&lt;/em&gt;, it could come from ivy library i guess.&lt;/p&gt;
&lt;p&gt;Does anyone have any idea why this exception occurred? 
Thanks all &lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 11 Oct 2016 10:37:53 -0400</lastBuildDate><item><title>Comment by nvhuong on nvhuong's answer</title><link>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2099</link><description>&lt;p&gt;However, we have a trick  that if the result of finding the bean is null we retry to init manually a new instance of the bean by &lt;strong&gt;&lt;em&gt;FacesContext.getCurrentInstance().getViewRoot().getViewMap().put(key, bean);&lt;/em&gt;&lt;/strong&gt; (we actually have not yet understood why the managed bean is null sometimes). We just figured out that this implementation causes the problem as logged above in case we input a wrong bean name. This issue has been known and fixed by correcting the bean name.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nvhuong</dc:creator><pubDate>Tue, 11 Oct 2016 10:37:53 -0400</pubDate><guid>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2099</guid></item><item><title>Comment by nvhuong on nvhuong's answer</title><link>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2098</link><description>&lt;p&gt;inside this method, we call another method in order to obtain a managed bean using &lt;strong&gt;&lt;em&gt;FacesContext.getCurrentInstance().getApplication().evaluateExpressionGet(context, "#{" + beanName + "}", clazz)&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nvhuong</dc:creator><pubDate>Tue, 11 Oct 2016 10:37:47 -0400</pubDate><guid>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2098</guid></item><item><title>Comment by Reguel Wermelinger on trungdv's question</title><link>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2096</link><description>&lt;p&gt;Can you share more insights about this request. Do you have a stack-trace?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 11 Oct 2016 09:33:20 -0400</pubDate><guid>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2096</guid></item><item><title>Comment by Reguel Wermelinger on nvhuong's answer</title><link>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2095</link><description>&lt;p&gt;Can you share more informations about this class:
&lt;code&gt;ch.axonivy.fintech.standard.guiframework.eventlistener.impl.JsfLifeCycleListener.afterPhase(JsfLifeCycleListener.java:21)&lt;/code&gt;
It guess that the ivy-context is no longer set up in a late phase of the request.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 11 Oct 2016 09:31:58 -0400</pubDate><guid>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped#2095</guid></item><item><title>Answer by nvhuong</title><link>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped/2093</link><description>&lt;p&gt;I got the same problem when calling the following code&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;FacesContext.getCurrentInstance().getViewRoot().getViewMap().put(key, bean);&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The full log:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;com.google.inject.ProvisionException:
Unable to provision, see the following
errors:&lt;/p&gt;
&lt;p&gt;1) Error in custom provider,
com.google.inject.OutOfScopeException:
Cannot access scoped
[ch.ivyteam.ivy.dialog.execution.DialogRuntimeManager].
Either we are not currently inside an
HTTP Servlet request, or you may have
forgotten to apply
com.google.inject.servlet.GuiceFilter
as a servlet filter for this request. 
at
ch.ivyteam.ivy.dialog.execution.DialogRuntimeManager.class(DialogRuntimeManager.java:30)
while locating
ch.ivyteam.ivy.dialog.execution.DialogRuntimeManager&lt;/p&gt;
&lt;p&gt;1 error   at
com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1025)
  at
com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
  at
ch.ivyteam.di.restricted.DiInjector.getInstance(DiInjector.java:43)
  at
ch.ivyteam.ivy.dialog.execution.DialogRuntimeManager.getInstance(DialogRuntimeManager.java:45)
  at
ch.ivyteam.ivy.dialog.execution.jsf.view.IvyViewScopeHandler.generateViewScopeId(IvyViewScopeHandler.java:27)
  at
org.apache.myfaces.view.ViewScopeProxyMap.getWrapped(ViewScopeProxyMap.java:76)
  at
org.apache.myfaces.view.ViewScopeProxyMap.put(ViewScopeProxyMap.java:114)
  at
org.apache.myfaces.view.ViewScopeProxyMap.put(ViewScopeProxyMap.java:42)
  at
ch.axonivy.fintech.standard.guiframework.util.FacesContextUtil.setViewBean(FacesContextUtil.java:62)
  at
ch.axonivy.fintech.standard.guiframework.util.GuiFrameworkUtil.getGuiFrameworkManagedBean(GuiFrameworkUtil.java:98)
  at
ch.axonivy.fintech.standard.guiframework.eventlistener.impl.JsfLifeCycleListener.afterPhase(JsfLifeCycleListener.java:21)
  at
org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:117)
  at
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:279)
  at
org.apache.myfaces.extensions.validator.core.startup.ExtValLifecycleWrapper.render(ExtValLifecycleWrapper.java:77)
  at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
  at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
  at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
  at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
  at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:468)
  at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
  at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
  at
org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:442)
  at
org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
  at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:178)
  at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
  at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
  at
ch.ivyteam.ivy.webserver.internal.PerformanceLogValve.invoke(PerformanceLogValve.java:55)
  at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
  at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
  at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
  at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
  at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
  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)
Caused by:
com.google.inject.OutOfScopeException:
Cannot access scoped
[ch.ivyteam.ivy.dialog.execution.DialogRuntimeManager].
Either we are not currently inside an
HTTP Servlet request, or you may have
forgotten to apply
com.google.inject.servlet.GuiceFilter
as a servlet filter for this request.
  at
com.google.inject.servlet.GuiceFilter.getContext(GuiceFilter.java:165)
  at
com.google.inject.servlet.GuiceFilter.getRequest(GuiceFilter.java:151)
  at
com.google.inject.servlet.ServletScopes$2$1.get(ServletScopes.java:152)
  at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
  at
com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
  at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
  at
com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
  ... 35 more&lt;/p&gt;
&lt;/blockquote&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nvhuong</dc:creator><pubDate>Tue, 11 Oct 2016 05:59:21 -0400</pubDate><guid>https://answers.axonivy.com/questions/2091/outofscopeexception-cannot-access-scoped/2093</guid></item></channel></rss>