title: Tomcat server HTTP Status 500 ? Internal Server Error
body: <h3>Code</h3>
  
  <pre><code>@WebServlet("/TestMySqlServlet")
  public class TestMySqlServlet extends HttpServlet {
  private static final long serialVersionUID = 1L;
  
  @Resource(name="jdbc/test")
  private DataSource dataSource;
  
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      PrintWriter out = response.getWriter();
      response.setContentType("text/plain");
  
      Connection con;
      Statement stmt;
  
          try {
  
              con = dataSource.getConnection();
  
              String uname;
              String uclass;
  
              uname = request.getParameter("name");
              uclass = request.getParameter("class");
  
              String query = "insert into info Values('"+uname+"','"+uclass+"')";
  
              stmt = con.createStatement();
  
              boolean flag = stmt.execute(query);
  
              if(flag) {
                  out.write("&lt;h3&gt;Data Inserted Successfully&lt;/h3&gt;");
              }else {
                  out.write("&lt;h3&gt;Data Insertion Failed&lt;/h3&gt;");
              }
  
          } catch (SQLException e) {
              out.print("Connection Error");
              e.printStackTrace();
          }   
      }
  }
  </code></pre>
  
  <h3>Context</h3>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE xml&gt;
  &lt;Context&gt;
  &lt;Resource name="jdbc/test" 
          auth="Container" 
          type="javax.sql.DataSource"
          maxActive="20"
          maxIdle="5"
          maxWait="10000"
          username="hamza" 
          password="qwerty" 
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost:3306/test?useSSL=false"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <h3>exception stack-trace</h3>
  
  <pre><code>SEVERE: Servlet.service() for servlet [main.TestMySqlServlet] in context with path [/TestMySql] threw exception [Servlet execution threw an exception] with root cause
  java.lang.ClassNotFoundException: org.aspectj.lang.Signature
  at java.net.URLClassLoader.findClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Unknown Source)
  at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2154)
  at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2061)
  at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1543)
  at main.TestMySqlServlet.doPost(TestMySqlServlet.java:44)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
  at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>When i run my code it show error  HTTP Status 500 ? Internal Server Error. What is the issue? how can i solve this? i also add mysql-connector-java-5.1.38-bin.jar file in the WEB-INF/lib directory. I use MySQL Workbench for database.In print console it says SEVERE: Servlet.service() for servlet [main.TestMySqlServlet] in 
  context with path [/TestMySql] threw exception [Servlet execution 
  threw an exception] with root cause</p>