Using classes not specified in javax.servlet.*;

I have a java program whose pupose is to execute a Login function. It uses the servlet and jsp classes although it also uses java.io.*; and java.sql.*;. When I attempt to execute the class from Tomcat I receive a 405 error listing one of my methods ("Get" which is part of the sql class) as not supported. Is there a way for Tomcat to accept these external classes? (They are of course imported in the compiled code which I have written.)
Any help would be appreciated!

I have implemented your suggestion and unfortunately it states that (now instead of not supporting the Get Method) it does not support the Post Method.
This does seem to say that I need both a doGet() and a doPost().
I am stumped on this one, any help would be appreciated. My code (including the change as suggested in the previous reply) is as follows:
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Login extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doPost(req, res);
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
String userId = req.getParameter("name");
String password = req.getParameter("password");
try {
String uName = validateUser(userId, password);
if (uName == null) {
PrintWriter out = res.getWriter();
out.println("Please verify the UserId and password");
out.close();
else
HttpSession userSession = req.getSession(true);
userSession.setAttribute("userName", uName);
RequestDispatcher rd =
getServletContext().getRequestDispatcher
("/SF_board.jsp");
if (rd != null)
rd.forward(req,res);
catch (SQLException e)
catch (ClassNotFoundException ex)
}

Similar Messages

  • Package javax.servlet.http does not exist & package javax.servlet does not

    Hello!
    I am trying to compile this file:
    /* serv2.java 29 Sep 04 */
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class serv2 extends HttpServlet
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
                                  throws ServletException, IOException
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              out.println("<HTML><HEAD><TITLE>Sample Servlet</TITLE></HEAD>"+'\n'+
                                  "<BODY BGCOLOR='lightgreen'>"+'\n'+
                                  "<H1 ALIGN=CENTER>Heading</H1>" + '\n' +
                                  "<P><H2 ALIGN=CENTER>Message</H2");
              out.println("</BODY></HTML>");
    }And I am getting this error message:
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:7: cannot resolve symbol
    symbol : class HttpServlet
    location: class serv2
    public class serv2 extends HttpServlet
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:9: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class serv2
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:9: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class serv2
         protected void doPost(HttpServletRequest req, HttpServletResponse res)
    ^
    C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\WEB-INF\classes\serv2.java:10: cannot resolve symbol
    symbol : class ServletException
    location: class serv2
                                  throws ServletException, IOException
    ^
    6 errors
    Tool completed with exit code 1
    I have tried setting CLASSPATH lib/servlet.jar but it still will not work.
    Please help me!!!

    Please check this page,
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    and also
    serv2 -> set it to Serv2
    another nice to read :-)
    http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
    +"Class names should be nouns, in mixed case with the first letter of each internal word capitalized"+
    Another thing,
    Put your class in a package, thanks =)
    regards and goodluck,
    jie

  • Package javax.servlet does not exist, package javax.servlet.http does not

    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    I tried locating these packages, but in vain. I also tried setting the CLASSPATH to many values, still it did not work.
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    Thank you very much.

    davidgoodman wrote:
    Dear All,
    I am a newbie to JAVA.
    I installed JDK1.6.0_04, then NetBeans IDE 6.0
    I tried compiling an example servlet, but got this error message:
    package javax.servlet does not exist, package javax.servlet.http does not exist
    What servlet/JSP engine do you plan to deploy to? Tomcat, perhaps?I think it's Tomcat (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14). Are there other engines that come with NetBeans IDE 6.0 (when I downloaded NetBeans, I chose ALL)
    >
    If so, you'll need to put the servlet JAR in your CLASSPATH. (servlet-api.jar for Tomcat 5.5 and earlier, servlet.jar for 6.0 >and later.)
    I tried locating these packages, but in vain.
    You won't find them until you realize that you have to deploy that servlet someplace.How to deploy?
    I also tried setting the CLASSPATH to many values, still it did not work.
    See above. What were you planning to set CLASSPATH to?First I set to:
    C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\lib (because I found jar named servlet-api.jar in this folder)
    Later I added this:
    C:\Program Files\Java\jdk1.6.0_04\lib (out of trial-and-fail)
    Finally I added some paths that lead to a library such as
    C:\Program Files\glassfish-v2\lib
    C:\Program Files\glassfish-v2\lib\ant\lib
    Can anyone, please, help me with this.
    Should I be able to see/locate these packages, do I have to download them?
    You have to get a servlet/JSP engine. Step 1.Thank you for your help

  • Class not found for Startup servlet

    I have deployed a war file under weblogic 7. The application has some startup servlets,
    which are failing to load during startup. It returns the following error messages
    for each servlet
    ####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer> <Thread-8>
    <kernel identity> <> <101249> <[ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
    Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet for servlet
    StartupTSContentDaemonServlet could not be loaded because the requested class
    was not found in the classpath D:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerces2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
    java.lang.UnsupportedClassVersionError: com/abc/servlets/startup/StartupTSContentDaemonServlet
    (Unsupported major.minor version 48.0)>
    ####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer> <Thread-8>
    <kernel identity> <> <101216> <Servlet: "StartupTSContentDaemonServlet" failed
    to preload on startup in webapp: "abcApps">
    javax.servlet.ServletException: [ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
    Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet for servlet
    StartupTSContentDaemonServlet could not be loaded because the requested class
    was not found in the classpath D:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerces2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
    java.lang.UnsupportedClassVersionError: com/abc/servlets/startup/StartupTSContentDaemonServlet
    (Unsupported major.minor version 48.0)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:785)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:2763)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:2708)
         at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:2681)
         at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:552)
         at weblogic.servlet.internal.WebService.preloadResources(WebService.java:476)
         at weblogic.t3.srvr.ServletInitRunner$1.run(ServletInitRunner.java:50)
         at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:744)
         at weblogic.t3.srvr.ServletInitRunner.run(ServletInitRunner.java:46)
         at java.lang.Thread.run(Thread.java:479)
    When i look into the directories weblogic created after deployment, there is a
    cls2372.jar at 1 level above the web-inf folder and it has all the servlets in
    the correct package structure i.e. com/abc/servlets/startup
    Any idea on why this is happening or what i am doing wrong?

    also posting to servlet newsgroup.
    "Ram" <[email protected]> wrote in message
    news:[email protected]...
    >
    I have deployed a war file under weblogic 7. The application has somestartup servlets,
    which are failing to load during startup. It returns the following errormessages
    for each servlet
    ####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer><Thread-8>
    <kernel identity> <> <101249><[ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
    Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet forservlet
    StartupTSContentDaemonServlet could not be loaded because the requestedclass
    was not found in the classpathD:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea
    \user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381
    \jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAp
    pServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.j
    ar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApp
    s_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.
    \abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerc
    es2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApp
    s_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\ab
    cdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF
    \lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdel
    ete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
    java.lang.UnsupportedClassVersionError:com/abc/servlets/startup/StartupTSContentDaemonServlet
    (Unsupported major.minor version 48.0)>
    ####<Jan 8, 2003 2:00:25 PM CST> <Error> <HTTP> <abc-web1> <abcAppServer><Thread-8>
    <kernel identity> <> <101216> <Servlet: "StartupTSContentDaemonServlet"failed
    to preload on startup in webapp: "abcApps">
    javax.servlet.ServletException:[ServletContext(id=3959381,name=abcApps,context-path=/abcApps)]:
    Servlet class com.abc.servlets.startup.StartupTSContentDaemonServlet forservlet
    StartupTSContentDaemonServlet could not be loaded because the requestedclass
    was not found in the classpathD:\bea\user_projects\abcdomain\abcAppServer\stage\abcApps\abcApps.war;D:\bea
    \user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381
    \jarfiles\WEB-INF\lib\servlet2373.jar;D:\bea\user_projects\abcdomain\.\abcAp
    pServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\jbcl2374.j
    ar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApp
    s_3959381\jarfiles\WEB-INF\lib\jaxp2375.jar;D:\bea\user_projects\abcdomain\.
    \abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF\lib\xerc
    es2376.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdelete\abcApp
    s_abcApps_3959381\jarfiles\WEB-INF\lib\AS4002377.jar;D:\bea\user_projects\ab
    cdomain\.\abcAppServer\.wlnotdelete\abcApps_abcApps_3959381\jarfiles\WEB-INF
    \lib\decrypt2378.jar;D:\bea\user_projects\abcdomain\.\abcAppServer\.wlnotdel
    ete\abcApps_abcApps_3959381\jarfiles\cls2372.jar.
    java.lang.UnsupportedClassVersionError:com/abc/servlets/startup/StartupTSContentDaemonServlet
    (Unsupported major.minor version 48.0)
    atweblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
    a:785)
    atweblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletC
    ontext.java:2763)
    atweblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServlet
    Context.java:2708)
    atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServle
    tContext.java:2681)
    atweblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:552)
    atweblogic.servlet.internal.WebService.preloadResources(WebService.java:476)
    at weblogic.t3.srvr.ServletInitRunner$1.run(ServletInitRunner.java:50)
    atweblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:744)
    at weblogic.t3.srvr.ServletInitRunner.run(ServletInitRunner.java:46)
    at java.lang.Thread.run(Thread.java:479)
    When i look into the directories weblogic created after deployment, thereis a
    cls2372.jar at 1 level above the web-inf folder and it has all theservlets in
    the correct package structure i.e. com/abc/servlets/startup
    Any idea on why this is happening or what i am doing wrong?

  • In compileng time this class not found import javax.media.jai.JA

    Hi,
    I�m download
    jai_imageio-1_0_01-lib-windows-i586
    jai_imageio-1_0_01-lib-windows-i586-jdk
    jai_imageio-1_0_01-lib-windows-i586-jre
    jdk-1_5_0_02-windows-i586-p
    in compel time
    import com.sun.media.jai.codec.*;
    import javax.media.jai.JAI;
    The complier gave me error class not found
    How can i configured my system
    I have Windows XP
    [email protected]

    try compiling like this:
    java -cp "." myTest
    This is not compiling, here you execute the already
    compiled myTest.java file (or it should be already
    compiled). To compile you may want to use javac or any
    other available compiler.Oops, sorry, I didn't mean compiling.
    If you were able to compile ok, you can try running the program by using:
    java -cp "." myTest
    This usually will solve the problem when your program comples fine but can't find the class when you try to run it. It's almost like the compiler assumes to look in the current directory but the VM (java.exe) doesn't make this assumption.

  • Javax.servlet.http.* package does not exist ?

    i am using j2sdk which does not include servlets, so in the forums i found that including servlet.jar file in jdk1.6.0\jre\lib\ext javax.servlet.* was included but javax.servlet.http did not ..... now this is strange either both do not work or both work. here is the code
    import javax.servlet.*;
    import javax.servlet.Http.*;
    class login
    error is package javax.servlet.Http.*; does not exist.

    Dear,
    javax.servlet is one of the J2EE (Java Enterprise Edition) packages that is not included in the J2SE (Java Standard Edition) , so that one used for developing server side application.
    I hope this help.
    Regards.

  • Package javax.servlet does not exist - settings appear to be correct

    laugh as I write this post...it's hardly a "new topic."...but everything seems set just as it should be...
    Okay...I'm a seasoned programmer in every language but JAVA. Here's the issue...every time I try to use the Core Servlets book/website by Marty Hall and Larry Brown I get hung up on the packages. This time, I downloaded and followed step by step what the website said to do...it was even preconfigured for me! Alas...I am getting the following compliation errors on a "simple packagless" program with NetBeans:
    Compiling 1 source file to C:\Servlets+JSP\HelloServlet\build\classes
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:13: cannot find symbol
    symbol: class HttpServlet
    public class HelloServlet extends HttpServlet {
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:14: cannot find symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest request,
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:15: cannot find symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    HttpServletResponse response)
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:16: cannot find symbol
    symbol : class ServletException
    location: class HelloServlet
    throws ServletException, IOException {
    6 errors
    BUILD FAILED (total time: 0 seconds)
    These are my environment settings (note that the JAVAX package is located under the src folder in Java)
    Catalina Home:
    C:\apache-tomcat-6.0.10
    CLASSPATH:
    C:\apache-tomcat-6.0.10\lib\servlet-api.jar;
    C:\apache-tomcat-6.0.10\lib\jsp-api.jar;
    C:\apache-tomcat-6.0.10\lib\el-api.jar;
    C:\Servlets+JSP;..;..\..;
    C:\Program Files\Java\jdk1.6.0_03\src
    JAVA_HOME
    C:\Program Files\Java\jdk1.6.0_03
    Path:
    C:\Program Files\Java\jdk1.6.0_03\bin;%PATH%
    Any ideas (excluding the one that maybe I should let my hair grow out, put on some tackey shorts and sandles and start palying an instrument in the streets of Austin for living?)

    cabkats wrote:
    You are then suggesting that I make the corrections directly to the files in apache using notepad instead of using the envir. variables?No I am not suggesting that. I am suggesting that you need to read the documentation about the product(s) and set them up the way they require, rather than blindly think that the CLASSPATH environment variable is some magical entity.
    I will try this, but I was hoping that since my IDE auto configured (with exception to java_home) that I would not have to do this. I wil give it try....thanks for the suggestion.See, you're using an IDE. Like I mentioned, IDEs do not use the CLASSPATH environment variable. You need to set up your project in your IDE in such a way that it knows what the dependent jars are. I'm sure there's a way to add jars to your project's dependencies.

  • Problem: package javax.servlet.jsp does not exist

    I am a novice JSP programmer. My projects that use any javax.servlet classes are not seeing those at all. I am working with a group of folks using Java SE 1.5. (Note: I'm using Windows so the directory separator is "\")
    What Used to work:
    1. Nearly all my projects were working using Java version 1.6. These projects were developed as examples from Wrox and Apress books about JSP and Struts.
    What has changed:
    1. I un-installed the version 1.6 of JDK and JRE, as well as tomcat, netbeans, and all the associated libraries/jars.
    2. I installed version 1.5 of JDK and JRE, as well as tomcat, netbeans, and all the associated libraries/jars.
    3. I updated my JAVA_HOME, CATALINA_HOME, CLASSPATH, and PATH environmental variables. I made sure that the path to servlet-api.jar (in the tomcat common\lib) is included in the classpath.
    What is wrong:
    1. References to javax.servlet.* are not satisfied--they are flagged in the source code in NetBeans and I get compiler errors with any project containing those references. For example:
    ... package javax.servlet.jsp does not exist
    import javax.servlet.jsp.*;
    What I've found:
    1. My CATALINA_HOME=C:\Java\Tomcat 5.5
    2. My JAVA_HOME=C:\Java\jdk1.5.0_11
    3. My CLASSPATH=.;C:\Program Files\QuickTime\QTSystem\QTJava.zip;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib;%JAVA_HOME%\lib\jsp-api.jar;%CATALINA_HOME%\common\lib\servlet-api.jar;C:\Java\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar
    4. My PATH=c:\wint\BIN;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%CATALINA_HOME%\bin;C:\MySQL\MySQL Server 5.0\bin;D:\MiKTeX 2.5\miktex\bin;C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\SFU\Perl\bin\;C:\SFU\common\;C:\Program Files\Lahey-Fujitsu Fortran\v7.1\Bin;C:\Program Files\Lahey-Fujitsu Fortran\v7.1\Win32\Bin
    What I need:
    1. I need to have some reference to the servlet classes satisfied in my configuration. Any help is appreciated.
    thanks
    jondr

    Oh. I got some over-the-shoulder debug help.
    My error was in the classpath specification:
    The path: %JAVA_HOME%\lib\jsp-api.jar
    Should be: %CATALINA_HOME%\lib\jsp-api.jar
    That contains the javax.servlet.jsp.*
    Thimk.
    Message was edited by: jon
    jondr

  • Package javax.servlet.jsp does not exist.

    dear all!
    I've one program which import javax.servlet.jsp.* as one of the package to be used in
    the program, and I am using j2sdk 1.4.0_01 to compiled it.
    However I got this error message : package javax.servlet.jsp does not exist.
    Where does it wrong?.
    error message like :
    logisticslib.java:6: package javax.servlet.jsp does not exist
    import javax.servlet.jsp.*;
    ^
    logisticslib.java:201: cannot resolve symbol
    symbol : class JspWriter
    location: class elogistic.db.logisticslib
    public void getServiceInfo(JspWriter out, String SQL) {

    You need a J2EE implementation, I recomemend Tomcat, you also need to put the .jar w/ the implementation in in your classpath.

  • Javax.servlet.* Not Found Error - Please help

    I am having a great deal deal of trouble trying to compile a program using javax.servlet and javax.servlet.hhtp.*. I have setup the JAVA_HOME and the CLASSPATH variables as per the Installation instructions. I appear to have hit a brick wall and I am absolutely desperate to get this working. I have installed the J2EE SDK as well as the Servletapi2.1. Please Help.
    Variables:
    CLASSPATH=c:\jdk1.3\lib\tools.jar;c:\j2sdkee1.3.1\lib\j2ee.jar;c:\jdk1.3\jre\bin;c:\jdk1.3\jre\lib;c:\mm.mysql-2.0.14\org;c:\jdk1.3\lib\servlet.jar;
    JAVA_HOME=c:\jdk1.3;
    J2EE_HOME=c:\j2sdkee1.3.1;
    PATH=%PATH%;c:\jdk1.3\bin;c:\j2sdkee1.3.1\bin;
    Error message from compiler:
    L:\PROGRA~1\allaire\jrun\servers\default\loanstest\web-inf\classes\PasswordServlet.java:27: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    L:\PROGRA~1\allaire\jrun\servers\default\loanstest\web-inf\classes\PasswordServlet.java:30: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    L:\PROGRA~1\allaire\jrun\servers\default\loanstest\web-inf\classes\PasswordServlet.java:39: cannot resolve symbol
    symbol : class HttpServlet
    location: class PasswordServlet
    public class PasswordServlet extends HttpServlet

    I can only think of three suggestions.
    One, use your mouse to "cut-n-paste" the value of CLASSPATH and verify that those files are exactly where you think they are, and are spelled right.
    E.g.
    CD C:\JDK1.3\LIB
    DIR SERVLET.JAR
    Two, if they're spelled right, run "jar tvf" on the files to make sure they aren't corrupted or something.
    E.g.:
    JAR TVF SERVLET.JAR
    Three, since you're working in Windoze, try putting the value inside double quotes. E.g.:
    SET CLASSPATH="c:\jdk1.3\lib\tools.jar;c:\j2sdkee1 ... etc ... "
    If you haven't tried the above, give it a go, see what happens.

  • Javax.servlet does not exist  (please help)

    i was going to try my first example nad follwing head first
    package com.myweb.trying;
    import  javax.servlet.*;
    import  javax.servlet.http.*;
    import  java.io.*;
    public class Serv1 extends HttpServlet {
         public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException{
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("Shutup and see this");
              String c = request.getParameter("color");
              out.println("<be>the color selected is"+ c);
    }on giving the command
    C:\project1\app1>javac -classpath c:\Tomcat6\lib\servlet-api.jar:classes:. -d classes src\com\myweb\trying\Serv1.java
    this is what i got
    src\com\myweb\trying\Serv1.java:3: package javax.servlet does not exist
    import  javax.servlet.*;
    ^
    src\com\myweb\trying\Serv1.java:4: package javax.servlet.http does not exist
    import  javax.servlet.http.*;
    ^
    src\com\myweb\trying\Serv1.java:7: cannot find symbol
    symbol: class HttpServlet
    public class Serv1 extends HttpServlet {
                              ^
    src\com\myweb\trying\Serv1.java:8: cannot find symbol
    symbol  : class HttpServletRequest
    location: class com.myweb.trying.Serv1
           public void doPost(HttpServletRequest request,HttpServletResponse respon
    se)throws IOException,ServletException{
                              ^
    src\com\myweb\trying\Serv1.java:8: cannot find symbol
    symbol  : class HttpServletResponse
    location: class com.myweb.trying.Serv1
           public void doPost(HttpServletRequest request,HttpServletResponse respon
    se)throws IOException,ServletException{
                                                         ^
    src\com\myweb\trying\Serv1.java:8: cannot find symbol
    symbol  : class ServletException
    location: class com.myweb.trying.Serv1
           public void doPost(HttpServletRequest request,HttpServletResponse respon
    se)throws IOException,ServletException{
                         ^
    6 errors please help what im doing wrong
    i have latest ver.6 of tomcat installed

    exchange the : in your classpath with a ;
    windows, in its infinite wisdom, uses a semi-colon as the path separator. the colon is what you would use if you were on unix, macosx, or linux.
    == eldrich

  • Package javax.servlet.http does not exist

    Hello All,
    A few problems here
    1. My classpath doesnt seem to work.:
    .;"C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
    2. As a result, i get many errors in my simple code, but there are still a few that are not related to javac not recognizing the servlet api.
    I also tried setting the classpath at the command line (event hough its temporary)
    set classpath="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar"
    but the servlet package is still not recognized
    I have 2 classes, one to read the database connection details from a file and another class, my servlet.
    Servlet Code:
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class CustomQuery extends HttpServlet
         public void init() throws ServletException
              EstablishDBConnetion.establishConnection();
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
              response.setContentType("text/html");
              PrintWriter printer = new response.getWriter();
              String title = "Result from custom query";
              Statement stmt = EstablishDBConnetion.establishConnection.con.createStatement();
              ResultSet rs = stmt.executeQuery("select customerID from customer");
              while(rs.next())
                   printer.println("<html> <head><title>" + title + "</title><br><br><table border=\"0\"> <tr><td>" + rs.getString(1));
              rs.close();
              stmt.close();
              EstablishDBConnetion.establishConnection.con.close();
    Database connection code
    import java.io.*;
    import java.sql.*;
    import java.util.StringTokenizer;
    class EstablishDBConnetion
         public static void establishConnection()
              try
                   String dbDriver = "";
                   String dbUrl = "";
                   String dbName = "";
                   String dbUser = "";
                   String dbPassword = "";
                   String newLine = "";
                   BufferedReader fileRead = new BufferedReader(new FileReader("connection.txt"));
                   boolean readerStatus = fileRead.ready();
                   newLine = fileRead.readLine();
                   while (readerStatus)
                        StringTokenizer st = new StringTokenizer(newLine, ",");
                        while (st.hasMoreTokens())
                            dbDriver   = st.nextToken();
                           dbUrl      = st.nextToken();
                           dbName     = st.nextToken();
                            dbUser     = st.nextToken();
                            dbPassword = st.nextToken();
                        readerStatus = fileRead.ready();
                   Class.forName(dbDriver);
                   String url = dbUrl + dbName;
                   System.out.print(url);
                   Connection con = DriverManager.getConnection(url, dbUser, dbPassword);
              catch (IOException e)
                   System.out.println("IO exception in establishConnection()");
                   e.printStackTrace();
              catch (java.lang.Exception ex)
                   System.out.println("General exception in establishConnection()");
                   ex.printStackTrace();
         public static void main(String[] args)
              //EstablishDBConnetion edbc = new EstablishDBConnetion();
              establishConnection();
    }also, full error list below
    CustomQuery.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    CustomQuery.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    CustomQuery.java:7: cannot find symbol
    symbol: class HttpServlet
    public class CustomQuery extends HttpServlet
    ^
    CustomQuery.java:10: cannot find symbol
    symbol : class ServletException
    location: class CustomQuery
    public void init() throws ServletException
    ^
    CustomQuery.java:16: cannot find symbol
    symbol : class HttpServletRequest
    location: class CustomQuery
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    ^
    CustomQuery.java:16: cannot find symbol
    symbol : class HttpServletResponse
    location: class CustomQuery
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    ^
    CustomQuery.java:16: cannot find symbol
    symbol : class ServletException
    location: class CustomQuery
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    ^
    CustomQuery.java:19: package response does not exist
    PrintWriter printer = new response.getWriter();
    ^
    CustomQuery.java:24: cannot find symbol
    symbol : variable establishConnection
    location: class EstablishDBConnetion
    Statement stmt = EstablishDBConnetion.establishConnection.con.createStatement();
    ^
    CustomQuery.java:39: cannot find symbol
    symbol : variable establishConnection
    location: class EstablishDBConnetion
    EstablishDBConnetion.establishConnection.con.close();
    ^
    10 errors
    I appreciate your help
    Message was edited by:
    paulchwd
    null
    Message was edited by:
    paulchwd

    The library is in tomcat/common/lib, not in tomcat/lib.

  • Javax.servlet.* package does not exit

    While compiling servlet followinng errors are coming
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:13: cannot find symbol
    symbol: class HttpServlet
    public class HelloServlet extends HttpServlet {
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:14: cannot find symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest request,
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:15: cannot find symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    HttpServletResponse response)
    C:\Servlets+JSP\HelloServlet\src\helloservlet\HelloServlet.java:16: cannot find symbol
    symbol : class ServletException
    location: class HelloServlet
    throws ServletException, IOException {
    Plz help me out for this problem.

    Hi There, I have recently got new pc and lost my development/test environment and have to setup tomcat/eclipse environment again. i installed Tomcat 5.5 and Java 1.5.0.22 version on my pc and also created local dev directory as C:\Java to compile and test sample .java files.
    here is the class path i set:
    CLASSPATH=.;C:\Java;"C:\Program Files\Apache\Tomcat 5.5\common\lib\servlet-api.jar";"C:\Program Files\Apache\Tomcat 5.5\common\lib\jsp-api.jar";"C:\Program Files\Apache\Tomcat 5.5\common\lib\jasper-runtime.jar";"C:\Documents and Settings\UserId\My Documents\ServletWork\workspace";..;..\..
    However when I try to compile sample HelloServlet.java file, i get following errors:
    C:\Java>javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloServlet.java:13: cannot find symbol
    symbol: class HttpServlet
    public class HelloServlet extends HttpServlet {
    ^
    HelloServlet.java:14: cannot find symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest request,
    ^
    HelloServlet.java:15: cannot find symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    HttpServletResponse response)
    ^
    HelloServlet.java:16: cannot find symbol
    symbol : class ServletException
    location: class HelloServlet
    throws ServletException, IOException {
    ^
    6 errors
    Not sure if I missed anything. I would appreciate any help/hint to resolve this issue.
    Thanks,
    SunIT

  • Error:    package javax.servlet.http does not exist

    Hi all,
    How do I import javax.servlet?
    package com.example.web;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class BeerSelect extends HttpServlet {
      public void doPost(HttpServletRequest request,
                         HttpServletResponse response)
                         throws IOException, ServletException {
        response.setContentType("text/html");
        PrintWriter out = response.getWrite();
        out.println ("Beer Selection Advide<br>");
        String c = request.getParameter("color");
        out.println ("<br>Got beer color " + c);
    }What does this error mean? The error message:
    Compiling 1 source file to C:\Program Files\Apache Software Foundation\MyProjects\J2EE\build\classes
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:3:
    package javax.servlet does not exist
    import javax.servlet.*;
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:4:
    package javax.servlet.http does not exist
    import javax.servlet.http.*;
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:7:
    cannot find symbol
    symbol: class HttpServlet
    public class BeerSelect extends HttpServlet {
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:8:
    cannot find symbol
    symbol  : class HttpServletRequest
    location: class com.example.web.BeerSelect
      public void doPost(HttpServletRequest request,
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:9:
    cannot find symbol
    symbol  : class HttpServletResponse
    location: class com.example.web.BeerSelect
                         HttpServletResponse response)
    C:\Program Files\Apache Software Foundation\MyProjects\J2EE\src\com\example\web\BeerSelect.java:10:
    cannot find symbol
    symbol  : class ServletException
    location: class com.example.web.BeerSelect
                         throws IOException, ServletException {
    6 errors
    BUILD FAILED (total time: 0 seconds)Thank you.

    Hi,
    The file servlet-api.jar / servlet.jar is not available in your classpath.
    To compile an Servlet you need the jar file to be in classpath.
    The jar file can be found in your webserver / application server lib folder.
    Regards,
    Zack

  • ATMTag.java:5: package javax.servlet does not exist

    My j2ee jdk1.4.2 is not supporting javx package.
    i already set all pathh and class path.
    anybody can help me.
    details are given below ::
    C:\AVA\J2EE Programs\JSP\JSPCustomTag>javac ATMTag.java
    ATMTag.java:5: package javax.servlet does not exist
    import javax.servlet.*;
    ^<br>
    ATMTag.java:6: package javax.servlet.http does not exist
    <br>
    import javax.servlet.http.*;
    <br>
    ATMTag.java:18: cannot resolve symbol
    symbol : class TagSupport
    location: class ATMTag
    public class ATMTag extends TagSupport{
    <br> ^
    ATMTag.java:29: cannot resolve symbol
    symbol : class JspTagException
    location: class ATMTag
    public int doStartTag() throws JspTagException{
    <br> ^
    ATMTag.java:31: cannot resolve symbol
    symbol : class JspWriter
    location: class ATMTag
    <br> JspWriter out =pageContext.getOut();
    ^
    ATMTag.java:31: cannot resolve symbol
    symbol : variable pageContext
    location: class ATMTag
    <br> JspWriter out =pageContext.getOut();
    ^
    ATMTag.java:56: cannot resolve symbol
    symbol : variable pageContext
    location: class ATMTag
    pageContext.getOut().write(str);
    <br> ^
    ATMTag.java:60: cannot resolve symbol
    symbol : variable EVAL_PAGE
    location: class ATMTag
    return EVAL_PAGE;
    ^
    8 errors

    When compiling servlets etc, you need to include in your classpath a jar file with all the javax.* classes defined in it.
    For Tomcat this is called servlet.jar and is in (I think) [TOMCAT_HOME]/shared/lib or /common/lib
    For J2EE 1.4 Server, the jar is [J2EE_HOME]/lib/j2ee.jar
    Where the _HOME directory is the directory where you installed J2EE.
    Include this jar file in your classpath when compiling.
    Good luck,
    evnafets

Maybe you are looking for

  • Frame issue in Workspace with IE8/XP/Reader 9.4

    When a user opens a form from a "to do" in Workspace, the form opens in a frame outside of and superimposed over the normal Workspace interface.  This obscures the user action buttons, which stops the process at that user (since they can perform no a

  • SAP_INFOCUBE_DESIGNS do not shown the current data

    Hi guru's, I have deleted all data from an InfoCube with the dimensions and the data from all the master data around the InfoCube. But when I execute SAP_INFOCUBE_DESIGNS with the transaction SE38 I see that there are rows in the F-table and the dime

  • Failure extracting WAR classes

    Hi, I am not sure whether this is the right forum... but I guess somebody here should be able to answer my question. I am deploying a war file on Weblogic 6.1 on Solaris. But when I start Weblogic after deploying the application, I get the error : <S

  • Wild card highlighting

    CTX_DOC.MARKUP is working fine for basic word search & stemming, but does not highlight for wild card search. For example, searches for "roam" and "$roam" highlight the word "roams", but searches for "roam%" do NOT highlight the word "roams". The Tex

  • Macbook Air - Dead Pixel

    I bought my early 2014 Macbook Air a little over 4 weeks ago, and I have just noticed a dead pixel in the middle of the screen. Will Apple fix this for free? I didn't buy my Macbook at an Apple shop, but at an authorized Apple retailer, so should I t