title: com.sun.faces.mgbean.ManagedBeanCreationException:
body: <p>I created a Java EE web application with JSF 2 (PrimeFaces), Hibernate and Spring. I added all necessary jars and I declared my beans in <code>faces-config</code>.</p>
  
  <p>When I run my application I get the following exception:</p>
  
  <hr>
  
  <pre><code>enter code here
  
  An Error Occurred:
  Erreur lors de l’injection de ressources dans le bean géré «loginBean»
  +- Stack Trace
  com.sun.faces.mgbean.ManagedBeanCreationException: Erreur lors de l’injection de     
  ressources dans le bean géré «loginBean»
  at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:229)
  at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:105)
  at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
  at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
  at 
   com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
  at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
  at 
  com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
  at 
  com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
  at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
  at org.apache.el.parser.AstValue.getValue(AstValue.java:147)
  at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
  at 
  com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
  at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
  at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
  at javax.faces.component.UIOutput.getValue(UIOutput.java:169)
  at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:64)
  at 
  
  org.primefaces.component.inputtext.InputTextRenderer.encodeMarkup
  (InputTextRenderer.java:77)
  at org.primefaces.component.inputtext.InputTextRenderer.encodeEnd
  (InputTextRenderer.java:51)
  at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
  at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive
  (HtmlBasicRenderer.java:312)
  at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
  at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren
  (GridRenderer.java:129)
  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
  at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:59)
  at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:47)
  at org.primefaces.component.panel.PanelRenderer.encodeContent
  (PanelRenderer.java:202)
  at org.primefaces.component.panel.PanelRenderer.encodeMarkup
  (PanelRenderer.java:119)
  at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:56)
  at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
  at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
  at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
  at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView
  (FaceletViewHandlingStrategy.java:402)
  at com.sun.faces.application.view.MultiViewHandler.renderView
  (MultiViewHandler.java:125)
  at com.sun.faces.lifecycle.RenderResponsePhase.execute
  (RenderResponsePhase.java:121)
  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
  at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
  (ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter
  (ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke
  (StandardWrapperValve.java:224)
  at org.apache.catalina.core.StandardContextValve.invoke
  (StandardContextValve.java:169)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke
  (AuthenticatorBase.java:472)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
  at org.apache.catalina.core.StandardEngineValve.invoke
  (StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  at org.apache.coyote.http11.AbstractHttp11Processor.process
  (AbstractHttp11Processor.java:987)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
  (AbstractProtocol.java:539)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
   Caused by: com.sun.faces.spi.InjectionProviderException
  at   com.sun.faces.vendor.WebContainerInjectionProvider.invokeAnnotatedMethod
   (WebContainerInjectionProvider.java:119)
  at com.sun.faces.vendor.WebContainerInjectionProvider.invokePostConstruct
  (WebContainerInjectionProvider.java:99)
  at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct
  (BeanBuilder.java:223)
  ... 56 more
  Caused by: java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at com.sun.faces.vendor.WebContainerInjectionProvider.invokeAnnotatedMethod
  (WebContainerInjectionProvider.java:117)
  ... 58 more
  Caused by: java.lang.NullPointerException
  at com.plasticum.beans.LoginBean.init(LoginBean.java:29)
  ... 63 more
  
  + - Component Tree
  &lt;UIViewRoot id="j_id1" inView="true" locale="fr_FR" renderKitId="HTML_BASIC"     
  rendered="true" transient="false" viewId="/pages/loginx.xhtml"&gt;
  javax_faces_location_HEAD
  &lt;ComponentResourceContainer id="javax_faces_location_HEAD" inView="true"    
  rendered="true" transient="false"&gt;
  &lt;UIOutput inView="true" rendered="true" transient="false"/&gt;
  &lt;UIOutput inView="true" rendered="true" transient="false"/&gt;
  &lt;UIOutput inView="true" rendered="true" transient="false"/&gt;
  &lt;UIOutput inView="true" rendered="true" transient="false"/&gt;
  &lt;UIOutput inView="true" rendered="true" transient="false"/&gt;
  &lt;UIOutput inView="true" rendered="true" transient="false"/&gt;
  &lt;/ComponentResourceContainer&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:a4j="http://richfaces.org/a4j"   
  xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib"&gt;
  &lt;UIOutput id="j_idt3" inView="true" rendered="true" transient="false"&gt;
  &lt;title&gt;Authentification&lt;/title&gt; &lt;link rel="stylesheet" type="text/css"    
  href="../css/styles.css"/&gt;
  &lt;/UIOutput&gt;
  &lt;UIOutput id="j_idt5" inView="true" rendered="true" transient="false"&gt;
  &lt;center&gt;
  &lt;HtmlForm enctype="application/x-www-form-urlencoded" id="form" inView="true"   
  prependId="true" rendered="true" submitted="false" transient="false"&gt;
  &lt;Panel closable="false" closeSpeed="500" collapsed="false" header="Authentification"   
  id="panel" inView="true" rendered="true" toggleOrientation="vertical" toggleSpeed="500" 
  toggleable="false" transient="false" visible="true"&gt;
  &lt;Messages autoUpdate="false" closable="false" escape="true" globalOnly="false"   
  id="msgs" inView="true" redisplay="true" rendered="true" showDetail="false" 
  showSummary="true" transient="false"/&gt;
  &lt;Clock autoSync="false" id="j_idt7" inView="true" mode="server" pattern="HH:mm:ss   
  dd.MM.yyyy" rendered="true" syncInterval="60000" transient="false"/&gt;
  &lt;HtmlPanelGrid border="-2147483648" columns="3" id="j_idt8" inView="true"   
  rendered="true" 
  transient="false"&gt;
  &lt;HtmlOutputLabel escape="true" for="identifiant" id="j_idt9" inView="true"    
  rendered="true" transient="false" value="Identifiant "/&gt;
  &lt;InputText disabled="false" id="identifiant" immediate="false" inView="true"    
  label="Identifiant" localValueSet="false" maxlength="-2147483648" readonly="false" 
  rendered="true" required="true" size="-2147483648" transient="false" type="text"    
  valid="true"/&gt;
  &lt;Message display="icon" escape="true" for="identifiant" id="j_idt10" inView="true"    
  redisplay="true" rendered="true" showDetail="true" showSummary="false"   
  transient="false"/&gt;
  &lt;HtmlOutputLabel escape="true" id="j_idt11" inView="true" rendered="true"    
  transient="false" value="Mot de passe"/&gt;
  &lt;Password disabled="false" feedback="false" goodLabel="Good" id="mp" immediate="false"   
  inView="true" inline="false" label="mot de passe" localValueSet="false" 
  maxlength="-2147483648" promptLabel="Please enter a password" readonly="false"   
  redisplay="false" rendered="true" required="true" size="-2147483648"    
  strongLabel="Strong" 
  transient="false" valid="true" weakLabel="Weak"/&gt;
  &lt;Message display="icon" escape="true" for="mp" id="msgSurname" inView="true"    
  redisplay="true" rendered="true" showDetail="true" showSummary="false"    
  transient="false"/&gt;  
  &lt;/HtmlPanelGrid&gt;
  &lt;CommandButton action="#{loginBean.connect()}" actionExpression="#   
  {loginBean.connect()}" ajax="true" async="false" disabled="false" escape="true" 
  global="true" iconPos="left" id="btn" immediate="false" inView="true" inline="false" 
  partialSubmit="false" readonly="false" rendered="true" transient="false" type="submit"
  update="panel" value="Valider"/&gt;
  &lt;/Panel&gt;
  &lt;/HtmlForm&gt;
  &lt;/center&gt;
  &lt;/UIOutput&gt;
  &lt;/html&gt;
  &lt;/UIViewRoot&gt;
  +- Scoped Variables
  Request Parameters Name Value 
  None 
  View Attributes Name Value 
  None 
  Request Attributes Name Value 
  None 
  Flash Attributes Name Value 
  None 
  Session Attributes Name Value 
  None 
  Application Attributes Name Value 
  csfcff com.sun.faces.context.flash.ELFlash@1c8a2ab 
  </code></pre>