Hi All,

I am new to Java servlet. I have successfully added and loaded a ConnectionPool 
servlet (database.ConnectionServlet) on the java web server 2.0.
I want to test the connectionServlet using another servlet "TestConnectionServlet". 
But, I get an error "ConnectionServlet not found" while executing the following code. 
Hope some one can answer to my question. Thanks in advance.

/*
 *@(#)TestConnectionServlet.java
*/
package database;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;

public class TestConnectionServlet extends HttpServlet
{
  public void init(ServletConfig config)
  {
    super.init(config);
  }
  public void doGet(HttpServletRequest req, HttpServletResponse res)
  throws ServletException
  {
   //accepts dynamic SQL, and calls a <FORM method=POST>
  }

  public void doPost(HttpServletRequest req, HttpServletResponse res)
  throws ServletException
  {
   //define Jdbc connection object
   Connection con = null;
   Statement stmt = null;
   ResultSet rs = null;
   //Get the ConnectionServlet that holds the connectionPool
   ServletConfig config = getServletConfig();
   ServletContext context = config.getServletContext();
   Servlet servlet = context.getServlet("ConnectionServlet");
   if (servlet == null) {
     throw new ServletException ("ConnectionServlet not found.");
   }
   ConnectionServlet conServlet = (ConnectionServlet) servlet;
  }
  //Get available connection from our connection pool
}

===================================================================
*** the ERROR is as follows
===================================================================
The servlet named database.TestConnectionServlet at the requested URL

http://hostname/servlet/database.TestConnectionServlet
reported this exception: ConnectionServlet not found. Please report this to the 
administrator of the web server.

javax.servlet.ServletException: ConnectionServlet not found at 
database.TestConnectionServlet.query(Compiled Code) at 
database.TestConnectionServlet.doPost(TestConnectionServlet.java:62) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:747) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at 
com.sun.server.ServletState.callService(ServletState.java:226) at 
com.sun.server.ServletManager.callServletService(ServletManager.java:936) at 
com.sun.server.http.servlet.InvokerServlet.service(InvokerServlet.java:137) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at 
com.sun.server.ServletState.callService(ServletState.java:226) at 
com.sun.server.ServletManager.callServletService(ServletManager.java:936) at 
com.sun.server.ProcessingState.invokeTargetServlet(ProcessingState.java:423) at 
com.sun.server.http.HttpProcessingState.execute(HttpProcessingState.java:79) at 
com.sun.server.http.stages.Runner.process(Runner.java:79) at com.sun.server.Processi!
!
ngSupport.process(Compiled Code) at com.sun.server.Service.process(Service.java:204) 
at com.sun.server.http.HttpServiceHandler.handleRequest(HttpServiceHandler.java:374) 
at com.sun.server.http.HttpServiceHandler.handleRequest(Compiled Code) at 
com.sun.server.HandlerThread.run(Compiled Code)

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to