title: ERROR o.s.web.context.ContextLoader - Context initialization failed
body: <p>I am struck with this error from 2 days. Any help?</p>
  
  <pre><code> ERROR o.s.web.context.ContextLoader - Context initialization failed
  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionFilter' defined in file [/usr/local/tomcat/webapps/portal/WEB-INF/classes/META-INF/spring/applicationContext-security.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [com.xxx.cloud.common.sessionclient.retrievers.SessionRetrievalStrategy]: : Error creating bean with name 'securityConfig': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxx/abc/realm_id' is defined: not found in JNDI environment; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfig': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxx/abc/realm_id' is defined: not found in JNDI environment
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>@Resource(mappedName = "xyz/abc/realm_id")
  private String assId;
  
  @Bean
  public String assId() {
      return assId;
  }
  </code></pre>
  
  <p>applicationContext-Security.xml where the bean is defined, but it doesnt pick up</p>
  
  <pre><code>&lt;beans:bean id="xyz/abc/realm_id" class="com.xxxxxxxx.SecurityConfig"&gt;
              &lt;beans:property name="assId" value="123456789"/&gt;
          &lt;/beans:bean&gt;
  </code></pre>
  
  <p>We cannot use tomcat context.xml.</p>