title: javax.naming.NameNotFoundException: Name comp/env/com.asdmt.bean.DiagramManagerManagedBean not found in context "java:"
body: <p>I ran into a little problem. I try to use a viewScoped managedBean in one of my page. I proced as follow:</p>
  
  <p>My bean location</p>
  
  <p><a href="https://i.stack.imgur.com/kEKpE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kEKpE.png" alt="enter image description here"></a></p>
  
  <p>my bean :</p>
  
  <pre><code>@ManagedBean(name = "diagramManager")
  @ViewScoped
  public class DiagramManagerManagedBean {
      private String toto = "toto";
  
      public String getToto() {
          return toto;
      }
  }
  </code></pre>
  
  <p>but in my page if i try a #{diagramManager.toto}
  i've only got an error 500 '<strong>Error 500: Name comp/env/com.asdmt.bean.DiagramManagerManagedBean not found in context "java:"</strong>.
  I had already tried to declare the managedbean in my faceconfig.xml i've got the same error.
  I'm on wepshere 6.1 usign JSF2</p>
  
  <p>Full stack trace</p>
  
  <pre><code> [17/02/16 09:50:45:816 CET] 0000002e ServletWrappe E   SRVE0068E: Exception non interceptée émise par une des méthodes de service du servlet : Faces Servlet. Exception : javax.servlet.ServletException: Name comp/env/com.asdmt.bean.DiagramManagerManagedBean not found in context "java:".
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:229)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1223)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1158)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
      at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at usinor.web.A2CSecurityFilter.doFilter(A2CSecurityFilter.java:108)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:850)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:693)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:656)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:535)
      at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3673)
      at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)
      at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:271)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)
  ---- Begin backtrace for Nested Throwables
  javax.naming.NameNotFoundException: Name comp/env/com.asdmt.bean.DiagramManagerManagedBean not found in context "java:".
      at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1767)
      at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1083)
      at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
      at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
      at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
      at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:205)
      at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:145)
      at javax.naming.InitialContext.lookup(InitialContext.java:363)
      at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.lookupFieldResource(ResourceAnnotationLifecycleProvider.java:189)
      at org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider.checkFieldAnnotation(AllAnnotationLifecycleProvider.java:83)
      at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.checkAnnotation(ResourceAnnotationLifecycleProvider.java:139)
      at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.processAnnotations(ResourceAnnotationLifecycleProvider.java:100)
      at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.newInstance(NoInjectionAnnotationLifecycleProvider.java:91)
      at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:156)
      at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:333)
      at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:296)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
      at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:179)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:99)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:158)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
      at org.apache.myfaces.view.facelets.el.ELText$ELTextVariable.writeText(ELText.java:219)
      at org.apache.myfaces.view.facelets.el.ELText$ELTextComposite.writeText(ELText.java:131)
      at org.apache.myfaces.view.facelets.compiler.TextInstruction.write(TextInstruction.java:45)
      at org.apache.myfaces.view.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:46)
      at org.apache.myfaces.view.facelets.compiler.UILeaf.encodeAll(UILeaf.java:505)
      at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
      at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
      at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1981)
      at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
      at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:199)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1223)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1158)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
      at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at usinor.web.A2CSecurityFilter.doFilter(A2CSecurityFilter.java:108)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:850)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:693)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:656)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:535)
      at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3673)
      at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)
      at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:271)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)
  
  [17/02/16 09:50:45:831 CET] 0000002e WebApp        E   [Servlet Error]-[Faces Servlet]: javax.naming.NameNotFoundException: Name comp/env/com.asdmt.bean.DiagramManagerManagedBean not found in context "java:".
      at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1767)
      at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1083)
      at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
      at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
      at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
      at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:205)
      at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:145)
      at javax.naming.InitialContext.lookup(InitialContext.java:363)
      at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.lookupFieldResource(ResourceAnnotationLifecycleProvider.java:189)
      at org.apache.myfaces.config.annotation.AllAnnotationLifecycleProvider.checkFieldAnnotation(AllAnnotationLifecycleProvider.java:83)
      at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.checkAnnotation(ResourceAnnotationLifecycleProvider.java:139)
      at org.apache.myfaces.config.annotation.ResourceAnnotationLifecycleProvider.processAnnotations(ResourceAnnotationLifecycleProvider.java:100)
      at org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider.newInstance(NoInjectionAnnotationLifecycleProvider.java:91)
      at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:156)
      at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:333)
      at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:296)
      at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
      at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:179)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:99)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:158)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
      at org.apache.myfaces.view.facelets.el.ELText$ELTextVariable.writeText(ELText.java:219)
      at org.apache.myfaces.view.facelets.el.ELText$ELTextComposite.writeText(ELText.java:131)
      at org.apache.myfaces.view.facelets.compiler.TextInstruction.write(TextInstruction.java:45)
      at org.apache.myfaces.view.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:46)
      at org.apache.myfaces.view.facelets.compiler.UILeaf.encodeAll(UILeaf.java:505)
      at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
      at javax.faces.component.UIComponentBase.encodeAll(UIComponentBase.java:541)
      at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1981)
      at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
      at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:116)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:241)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:199)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1223)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1158)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
      at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at usinor.web.A2CSecurityFilter.doFilter(A2CSecurityFilter.java:108)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:850)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:693)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:656)
      at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:535)
      at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3673)
      at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831)
      at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:457)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:300)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:271)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1560)
  </code></pre>
  
  <p><strong>EDIT</strong> : as balusc said i was not runing the corect code</p>