I am getting this error:
this is the init portion of the servlet:
Can anyone tell me what is going on? I am not familiar with reading error output yet. (but i am trying!!)
thanks
Code:
javax.servlet.ServletException: Error instantiating servlet class test.FetchEmployeeServlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)
this is the init portion of the servlet:
Code:
package test;
import javax.servlet.*;
import javax.naming.*;
import javax.servlet.http.*;
import java.io.*;
import javax.sql.*;
import java.sql.*;
import java.util.*;
public class FetchEmployeeServlet extends HttpServlet {
private final static String sql = "select * from employee where id = ?";
private PreparedStatement statement = null;
private ServletContext context;
private Connection connection;
private Context ctx;
private DataSource ds;
public void init(ServletConfig config) throws ServletException {
super.init(config);
context = config.getServletContext();
try{
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/BankDB");
Connection connection = ds.getConnection();
statement = connection.prepareStatement(sql);
}
catch(Exception e) {
e.printStackTrace();
}
}
Can anyone tell me what is going on? I am not familiar with reading error output yet. (but i am trying!!)
thanks