title: The APR based Apache Tomcat Native library was not found on the java.library.path
body: <p>I'm newly at server development and have been started from easy tutorial by 
  Lars Vogel.
  <a href="http://www.vogella.com/articles/EclipseWTP/article.html" rel="noreferrer">Servlet and JSP development with Eclipse WTP </a>.</p>
  
  <p><strong><em>Step by step</em></strong> accord this tutorial:  </p>
  
  <ul>
  <li>installed Eclipse Java EE Kepler;</li>
  <li>installed tomcat 7 on Ubuntu 12.04 - <code>http://localhost:8080/</code> shows correct tomcat page;</li>
  <li>Setting up tomcat runtime environments into eclipse;</li>
  <li>added tomcat server to eclipse;</li>
  <li>create <code>DAO</code>;</li>
  <li>created the Servlet;</li>
  <li>run =></li>
  </ul>
  
  <p>And here I caught next prompt:</p>
  
  <pre><code>Sep 15, 2013 3:40:39 PM org.apache.catalina.core.AprLifecycleListener init
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
  Sep 15, 2013 3:40:42 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
  WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:com.filecounter' did not find a matching property.
  Sep 15, 2013 3:40:43 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8080"]
  Sep 15, 2013 3:40:43 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  Sep 15, 2013 3:40:43 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 5203 ms
  Sep 15, 2013 3:40:43 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Sep 15, 2013 3:40:43 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
  Sep 15, 2013 3:40:45 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
  INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [171] milliseconds.
  Sep 15, 2013 3:40:46 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8080"]
  Sep 15, 2013 3:40:46 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  Sep 15, 2013 3:40:46 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 2882 ms
  </code></pre>
  
  <p>Here is content of <code>tomcat/lib</code> folder:</p>
  
  <pre><code>nazar_art@nazar-desctop:/usr/local/tomcat/apache-tomcat-7.0.42/lib$ ls -lg
  total 6132
  -rwxrwxrwx 1 nazar_art   15264 Jul  2 10:59 annotations-api.jar
  -rwxrwxrwx 1 nazar_art   54142 Jul  2 10:59 catalina-ant.jar
  -rwxrwxrwx 1 nazar_art  134215 Jul  2 10:59 catalina-ha.jar
  -rwxrwxrwx 1 nazar_art 1581311 Jul  2 10:59 catalina.jar
  -rwxrwxrwx 1 nazar_art  257520 Jul  2 10:59 catalina-tribes.jar
  -rwxrwxrwx 1 nazar_art 1801636 Jul  2 10:59 ecj-4.2.2.jar
  -rwxrwxrwx 1 nazar_art   46085 Jul  2 10:59 el-api.jar
  -rwxrwxrwx 1 nazar_art  123241 Jul  2 10:59 jasper-el.jar
  -rwxrwxrwx 1 nazar_art  599428 Jul  2 10:59 jasper.jar
  -rwxrwxrwx 1 nazar_art   88690 Jul  2 10:59 jsp-api.jar
  -rwxrwxrwx 1 nazar_art  177598 Jul  2 10:59 servlet-api.jar
  -rwxrwxrwx 1 nazar_art    6873 Jul  2 10:59 tomcat-api.jar
  -rwxrwxrwx 1 nazar_art  796527 Jul  2 10:59 tomcat-coyote.jar
  -rwxrwxrwx 1 nazar_art  235411 Jul  2 10:59 tomcat-dbcp.jar
  -rwxrwxrwx 1 nazar_art   77364 Jul  2 10:59 tomcat-i18n-es.jar
  -rwxrwxrwx 1 nazar_art   48693 Jul  2 10:59 tomcat-i18n-fr.jar
  -rwxrwxrwx 1 nazar_art   51678 Jul  2 10:59 tomcat-i18n-ja.jar
  -rwxrwxrwx 1 nazar_art  124006 Jul  2 10:59 tomcat-jdbc.jar
  -rwxrwxrwx 1 nazar_art   23201 Jul  2 10:59 tomcat-util.jar
  </code></pre>
  
  <p><a href="http://pastebin.com/vaB7jV19" rel="noreferrer">Here is content of catalina.2013-09-15.log</a>.  </p>
  
  <p><strong>Update:</strong></p>
  
  <p>Here is tutorial:<br>
  <a href="http://www.sheroz.com/installing-apache-tomcat-native-linux-ubuntu-1204" rel="noreferrer">Installing Apache Tomcat Native on Linux Ubuntu 12.04</a></p>
  
  <p><strong>Update2:</strong></p>
  
  <p>Here is content of Data Access Object:</p>
  
  <pre><code>public class FileDao {
  
    public int getCount() {
      int count = 0;
      // Load the file with the counter
      FileReader fileReader = null;
      BufferedReader bufferedReader = null;
      PrintWriter writer = null ; 
      try {
        File f = new File("FileCounter.initial");
        if (!f.exists()) {
          f.createNewFile();
          writer = new PrintWriter(new FileWriter(f));
          writer.println(0);
        }
        if (writer !=null){
          writer.close();
        }
  
        fileReader = new FileReader(f);
        bufferedReader = new BufferedReader(fileReader);
        String initial = bufferedReader.readLine();
        count = Integer.parseInt(initial);
      } catch (Exception ex) {
        if (writer !=null){
          writer.close();
        }
      }
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return count;
    }
  
    public void save(int count) throws Exception {
      FileWriter fileWriter = null;
      PrintWriter printWriter = null;
      fileWriter = new FileWriter("FileCounter.initial");
      printWriter = new PrintWriter(fileWriter);
      printWriter.println(count);
  
      // Make sure to close the file
      if (printWriter != null) {
        printWriter.close();
      }
    }
  
  } 
  </code></pre>
  
  <p>And here Servlet code:</p>
  
  <pre><code>public class FileCounter extends HttpServlet {
    private static final long serialVersionUID = 1L;
  
    int count;
    private FileDao dao;
  
    public void init() throws ServletException {
      dao = new FileDao();
      try {
        count = dao.getCount();
      } catch (Exception e) {
        getServletContext().log("An exception occurred in FileCounter", e);
        throw new ServletException("An exception occurred in FileCounter"
            + e.getMessage());
      }
    }
  
    protected void doGet(HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
      // Set a cookie for the user, so that the counter does not increate
      // every time the user press refresh
      HttpSession session = request.getSession(true);
      // Set the session valid for 5 secs
      session.setMaxInactiveInterval(5);
      response.setContentType("text/plain");
      PrintWriter out = response.getWriter();
      if (session.isNew()) {
        count++;
      }
      out.println("This site has been accessed " + count + " times.");
    }
  
    public void destroy() {
      super.destroy();
      try {
        dao.save(count);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  
  } 
  </code></pre>
  
  <p>I haven't had <code>web.xml</code> yet.</p>
  
  <p><strong><em>How to solve this trouble?</em></strong></p>