title: [Request processing failed; nested exception is java.lang.NullPointerException]
body: <p>I have added one more  class as UserDetails.java to my entity package. I have added all the necessary Controller and DAO classes to respective package. But I am using a single Service class for both the entities. Now, when I run service for  earlier  entity class, it works fine. But when I run service for entity class I added later I gives error message.</p>
  
  <p>May 20, 2020 12:20:26 AM org.apache.catalina.core.StandardWrapperValve invoke</p>
  
  <p>SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/TwoFactor] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause</p>
  
  <p>java.lang.NullPointerException</p>
  
  <p>at com.firstapp129.twofactor.service.DistScannerServiceImpl.getUsers(DistScannerServiceImpl.java:39)</p>
  
  <p>I am using the following Service Class Code:</p>
  
  <pre><code>package com.firstapp129.twofactor.service;
  
  import java.util.List;
  
  import javax.transaction.Transactional;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  
  import com.firstapp129.twofactor.dao.DistScannerDAO;
  import com.firstapp129.twofactor.dao.UserDetailsDAO;
  import com.firstapp129.twofactor.entity.DistScanner;
  import com.firstapp129.twofactor.entity.UserDetails;
  
  @Service
  public class DistScannerServiceImpl implements DistScannerService {
  
      @Autowired
      private DistScannerDAO distScannerDAO;
      private UserDetailsDAO userDetailsDAO;
  
      @Override
      @Transactional
      public List&lt;DistScanner&gt; getCustomers() {
          // TODO Auto-generated method stub
          return distScannerDAO.getCustomers();
      }
      @Override
      @Transactional
      public void saveDistScanner(DistScanner theDistScanner) {
          distScannerDAO.saveDistScanner(theDistScanner);
          // TODO Auto-generated method stub
      }
  
      @Override
      @Transactional
      public List&lt;UserDetails&gt; getUsers() {
          // TODO Auto-generated method stub
          return userDetailsDAO.getUsers();
      }
  
      @Override
      @Transactional
      public void saveUserDetails(UserDetails theUserDetails) {
  
          userDetailsDAO.saveUserDetails(theUserDetails);
          // TODO Auto-generated method stub
  
      }
  
  }
  </code></pre>