title: BeanCreationException caused by BeanInstantiationException caused by NullPointerException: name
body: <p>I am currently trying to test out a web application but I keep getting a NullPointerException whenever I try to start up Websphere 8.5, which causes the BeanInstantiationException and BeanCreationException.  I have tried playing around with the annotations and removing the beans in the mvc-dispatcher-servlet.xml file but the same error keeps occuring but with a different bean.  I am unsure of what I need to change to get this running.</p>
  
  <p>mvc-dispatcher-servlet.xml</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:jee="http://www.springframework.org/schema/jee"
  xmlns:aop="http://www.springframework.org/schema/aop"
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc.xsd
      http://www.springframework.org/schema/jee
      http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd
      http://www.springframework.org/schema/aop/
      http://www.springframework.org/schema/aop/spring-aop-4.1.xsd"&gt;
  
  &lt;context:component-scan base-package="com.trac.controller" /&gt;
  &lt;context:component-scan base-package="com.trac.model" /&gt;
  
  &lt;mvc:annotation-driven /&gt;
  
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/&gt;
      &lt;property name="prefix" value="/WEB-INF/pages/" /&gt;
      &lt;property name="suffix" value=".jsp" /&gt;
  &lt;/bean&gt;
  
  &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
  
  &lt;!-- Configure to plugin JSON as request and response in method handler --&gt;
  &lt;bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"&gt;
      &lt;property name="messageConverters"&gt;
          &lt;list&gt;
              &lt;ref bean="jsonMessageConverter"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Configure bean to convert JSON to POJO and vice versa --&gt;
  &lt;bean id="jsonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"&gt;
  &lt;/bean&gt; 
  
  &lt;bean id="agencyDao" class="com.trac.dao.AgencyDao"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  &lt;bean id="subsidyDao" class="com.trac.dao.SubsidyDao"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  &lt;bean id="agentDao" class="com.trac.dao.AgentDao"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  &lt;bean id="verificationDao" class="com.trac.dao.VerificationDao"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mainController" class="com.trac.controller.MainController"&gt;
      &lt;property name="sessionBean" ref="sessionBean"&gt;&lt;/property&gt;
      &lt;property name="racfGroup" ref="racfGroup"&gt;&lt;/property&gt; 
  &lt;/bean&gt;
  
  &lt;bean id="racfGroup" class="com.trac.verification.RacfGroupData"&gt;
      &lt;property name="securityService" ref="securityService"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="securityService" class="com.security.client.services.SecurityService"/&gt;
  
  &lt;jee:jndi-lookup id="dataSource" jndi-name="jdbc/aoa" resource-ref="true"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainController.java (where the beans are to be initiated)</p>
  
  <pre><code>@Controller
  public class MainController {
  
  private CompanyOrgVerification org = new CompanyOrgVerification();
  
  @Autowired
  private SessionBean session;
  private RacfGroupData racfGroup;
  
  //returns the agent search page
  @RequestMapping(URIConstants.WELCOME_PAGE)
  public ModelAndView welcome(HttpServletRequest request){ 
  
      session.setUserId("T5575");
      session.setPermission("INFOA", "U");
  
      if( racfGroup.getRacfGroups(session.getUserId()) ){
          session.setPermission("INFOA", "U"); 
          return new ModelAndView("index");
      }else{
          ModelAndView error = new ModelAndView();
          error.setViewName("error");
          return error;   
      }
  }public SessionBean getSessionBean(){
      return session;
  }
  public void setSessionBean(SessionBean session){
      this.session = session;
  }
  public RacfGroupData getRacfGroup(){
      return racfGroup;
  }
  public void setRacfGroup(RacfGroupData racfGroup){
      this.racfGroup = racfGroup;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>RacfGroupData.java</p>
  
  <pre><code>public class RacfGroupData {
     private SecurityService securityService;
  
     static{
        SystemProperties.setProperty("RacfAttempts", String.valueOf(ATTEMPTS));
        SystemProperties.setProperty("RacfServerIP", SERVER_IP);
        SystemProperties.setProperty("RacfServerKey", SERVER_KEY);
        SystemProperties.setProperty("RacfTimeout", String.valueOf(TIMEOUT));
     }
     // get racf groups for a given user ID.
     public boolean getRacfGroups(String userID){
         GroupLookupResponse groups = securityService.getGroups(userID);
         Iterator&lt;Group&gt; groupList = groups.getGroups().iterator();
         return validateGroup(groupList);
     }
     public SecurityService getSecurityService(){
         return securityService;
     }
     public void setSecurityService(SecurityService securityService){
         this.securityService = securityService;
     }
  </code></pre>
  
  <p>Error</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'racfGroup': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.security.client.services.SecurityService com.trac.verification.RacfGroupData.securityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityService' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.security.client.services.SecurityService]: Constructor threw exception; nested exception is java.lang.NullPointerException: name
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
  ... 98 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.security.client.services.SecurityService com.trac.verification.RacfGroupData.securityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityService' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.security.client.services.SecurityService]: Constructor threw exception; nested exception is java.lang.NullPointerException: name
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
  at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
  ... 106 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityService' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.security.client.services.SecurityService]: Constructor threw exception; nested exception is java.lang.NullPointerException: name
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1014)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:957)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:855)
  at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:480)
  ... 108 more
  Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.security.client.services.SecurityService]: Constructor threw exception; nested exception is java.lang.NullPointerException: name
  at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164)
  at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1069)
  ... 119 more
  Caused by: java.lang.NullPointerException: name
  at feign.Util.checkNotNull(Util.java:99)
  at feign.Target$HardCodedTarget.&lt;init&gt;(Target.java:67)
  at feign.Target$HardCodedTarget.&lt;init&gt;(Target.java:62)
  at feign.Feign$Builder.target(Feign.java:175)
  at com.security.client.services.SecurityService.&lt;init&gt;(SecurityService.java:29)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:539)
  at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
  ... 121 more
  </code></pre>
  
  <p>SecurityService</p>
  
  <pre><code>public class SecurityService implements ISecurityService
  {
  private JacksonDecoder _decoder = new JacksonDecoder();
  private SecurityServiceApi _securityServiceApi = Feign.builder()
       .decoder(_decoder)
       .encoder(new JacksonEncoder())
       .target(SecurityServiceApi.class, System.getProperty("securityServicesBaseUrl"));
  
  /**
  * @param id
  * @param useTestGroups
  * @return see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#getUser(java.lang.String, boolean)
  */
  @Override
  public UserLookupResponse getUser(String id, boolean useTestGroups)
  {
    return _securityServiceApi.getUser(id, useTestGroups);
  }
  
  /**
   * @param id
   * @param useTestGroups
   * @return see overriden class or implemented interface
   * @see com.security.client.services.ISecurityService#getGroups(java.lang.String, boolean)
   */
  @Override
  public GroupLookupResponse getGroups(String id, boolean useTestGroups)
  {
    return _securityServiceApi.getGroups(id, useTestGroups);
  }
  
  /**
  * @param id
  * @return see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#getUser(java.lang.String)
  */
  @Override
  public UserLookupResponse getUser(String id)
  {
    return getUser(id, false);
  }
  
  /**
  * @param id
  * @param testGroups
  * @return see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#getUser(java.lang.String, byte[])
  */
  @Override
  public UserLookupResponse getUser(String id, byte[] testGroups)
  {
    UserLookupRequest userLookupRequest = new UserLookupRequest();
    userLookupRequest.setTestGroupsBase64(Base64.encodeBase64String(testGroups));
  
    return _securityServiceApi.getUser(id, userLookupRequest);
  }
  
  /**
  * @param id
  * @return see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#getGroups(java.lang.String)
  */
  @Override
  public GroupLookupResponse getGroups(String id)
  {
    return getGroups(id, false);
  }
  
  /**
  * @param id
  * @param groups
  * @return see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#updateGroups(java.lang.String, java.util.List)
  */
  @Override
  public void updateGroups(String id, List&lt;Group&gt; groups)
  {
    _securityServiceApi.updateGroups(id, createGroupUpdateRequest(groups));
  }
  
  /**
  * @param id
  * @param groups see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#addGroups(java.lang.String, java.util.List)
  */
  @Override
  public void addGroups(String id, List&lt;Group&gt; groups)
  {
    _securityServiceApi.addGroups(id, createGroupUpdateRequest(groups));
  }
  
  /**
  * @param id
  * @param groupName see overriden class or implemented interface
  * @see com.security.client.services.ISecurityService#removeGroup(java.lang.String, java.lang.String)
  */
  @Override
  public void removeGroup(String id, String groupName)
  {
    _securityServiceApi.removeGroup(id, groupName);
  
  }
  
  private GroupUpdateRequest createGroupUpdateRequest(List&lt;Group&gt; groups)
  {
    GroupUpdateRequest groupUpdateRequest = new GroupUpdateRequest();
    groupUpdateRequest.getGroups().addAll(groups);
  
    return groupUpdateRequest;
  }
  </code></pre>
  
  <p>The SecurityClient bean comes from a jar called security-client-0.jar.  Any suggestions would be appreciated</p>