title: Why is my Concurrent call is giving NullPointerException
body: <p>This is my method:</p>
  
  <pre><code>private List&lt;OfficerAccountFilter&gt; createResult(List&lt;Account&gt; accountList) {
          List&lt;List&lt;Account&gt;&gt; partedList = Lists.partition(accountList, MAX_LIMIT);
          List&lt;OfficerAccountFilter&gt; result = new ArrayList&lt;&gt;();
          System.out.println("size of account" + accountList.size());
          int size = accountList.size() / 800;
          ExecutorService executorService = Executors.newFixedThreadPool(NTHREDS);
          List&lt;Future&lt;List&lt;OfficerAccountFilter&gt;&gt;&gt; futureList = new ArrayList&lt;Future&lt;List&lt;OfficerAccountFilter&gt;&gt;&gt;();
          for (int i = 0; i &lt;= size + 1; i++) {
              Callable&lt;List&lt;OfficerAccountFilter&gt;&gt; worker = new AccountCallable(accountList);
              Future&lt;List&lt;OfficerAccountFilter&gt;&gt; submit = executorService.submit(worker);
              futureList.add(submit);
  
          }
          for (Future&lt;List&lt;OfficerAccountFilter&gt;&gt; future : futureList) {
              try {
                  result = future.get();
              } catch (InterruptedException | ExecutionException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }
          executorService.shutdown();
          return result;
      }
  </code></pre>
  
  <p>my callable class:</p>
  
  <pre><code>public class AccountCallable implements Callable&lt;List&lt;OfficerAccountFilter&gt;&gt; {
  
      @Autowired
      private OfficerAccountSOAPRunner officerAccountSOAPRunner;
  
      private List&lt;Account&gt; accountList;
  
      public AccountCallable(List&lt;AccountIdentifier&gt; accountList) {
          this.accountList = accountList;
      }
  
      @Override
      public List&lt;OfficerAccountFilter&gt; call() throws Exception {
  
          List&lt;OfficerAccountFilter&gt; result = new ArrayList&lt;&gt;();
          for (Account account : accountList) {
              OfficerAccountRequest request = new OfficerAccountRequest();
              request.getAccounts().add(account);
              List&lt;OfficerAccountFilter&gt; accounts = officerAccountSOAPRunner.getAccounts(request);
              result.addAll(accounts);
          }
          return result;
      }
  }
  
  officerAccountSOAPRunner.getAccounts(request); 
  </code></pre>
  
  <p>this is where im invoking Soap service which gives the filtered accounts back to officer. Not sure why is it returning null at this point. If i do it sequentially, it works absolutely fine. Am i not setting the future Object right?</p>
  
  <pre><code>Error stack:
  java.util.concurrent.ExecutionException: java.lang.NullPointerException
      at java.util.concurrent.FutureTask.report(FutureTask.java:122)
      at java.util.concurrent.FutureTask.get(FutureTask.java:192)
      at com.test.service.impl.OfficerServiceImpl.createResult(OfficerServiceImpl.java:92)
      at com.test.ServiceImpl.limitOfficerAccounts(OfficerServiceImpl.java:61)
      at com.test.service.impl.OfficerServiceImpl.getOfficerAccounts(OfficerServiceImpl.java:54)
  
  
      Caused by: java.lang.NullPointerException
      at com.test.impl.AccountIdentifierCallable.call(AccountCallable.java:36)
      at com.test.impl.AccountIdentifierCallable.call(AccountCallable.java:1)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  </code></pre>
  
  <p>The error is SOAPRunner call: <code>List&lt;OfficerAccountFilter&gt; accounts = officerAccountSOAPRunner.getAccounts(request);</code></p>
  
  <p>I put it in debug mode and it's coming as soon as i set on @Autowired. So it's coming from there. Do i need to set the cope differently?</p>