title: @Resource Injection stopped working suddenly
body: <p>Hello in my project to connect to the DB I was using contex.xml file (where I had all DB data) and @Resource(name = "xyz") annotation to and use it to create dataSource in my Servlet:</p>
  
  <pre><code>@WebServlet(name = "BookControllerServlet", urlPatterns = {"/BookControllerServlet"})
  public class BookControllerServlet extends HttpServlet {
  
  private static final long serialVersionUID = 1L;
  
  private BookDbUtil bookDbUtil;
  
  @Resource(name = "sql2226123")
  private DataSource dataSource;
  
  // init method will be called by the app server when this servlet is loaded or initialized
  @Override // we inherit it from GenericServlet
  public void init() throws ServletException {
      super.init(); //To change body of generated methods, choose Tools | Templates.
  
      // create our book db util ... and pass in the connection pool / datasource
      try {
          bookDbUtil = new BookDbUtil(dataSource); // bookDbUtil is a data member that we've defined
      } // dataSource is resource injection item our connection pool and we're passing it right here
      catch (Exception exc) {
          throw new ServletException(exc);
      }
  }
  </code></pre>
  
  <p>However, from day to day it suddenly stopped working. I mean @Resource(name = "sql2226123") does not provide any data. dataSource == null, myConn == null; What happened? context.xml is 100% good was not changed by this time. I had some jdk update recently if I remember correctly. Maybe it has something to do with it? My current java version is: 1.8.0_81-b13. Any ideas? Did anyone hear something about it?</p>
  
  <p>Here is my context.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE xml&gt;
  &lt;Context path="jadbc/ParkingSystem"&gt;
      &lt;Resource name="sql2226123" 
          auth="Container" type="javax.sql.DataSource"
          maxActive="20" maxIdle="5" maxWait="10000"
          username="sql2226123" password="xxxxxxxx" 
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://sql2.freemysqlhosting.net:3306/sql2226123"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>I also manage to get following error:
  <a href="https://i.stack.imgur.com/eUryW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eUryW.png" alt="enter image description here"></a></p>