Servlet.jar problem

Hi all
Could anyone help me out this problem, I keep trying to figure it out these days but I still cant find my way.
I cannot compile a simple HelloWorldServlet.java, as it gave me 6 errors:
===========================================
package javax.servlet does not exist
import javax.servlet/*;
^
package javax.servlet.http does not exist
import javax.servlet.http/*;
^
the other 4 errors also pointing to the HttpServlet, HttpServletRequest, HttpServletResponse and ServletException
===========================================
I have installed Tomcat 4.1.24 and j2sdk1.4.1_01 on my computer. I know the compiler javac needs the servlet.jar when compiling servlet source code, so I have set the path like this
PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\J2SDK1.4.1_01\BIN;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar
However, same errors are still generated after I set the path. So can anyone can tell me what thing goes wrong with my setting? or this is not the servlet.jar and path problem?
With uncountable thank : )
Kelvin

Hi,
My questions are the same.
But I have also set up the classpath for the servlet component.
After that, I found I can't call user-defined obecjts in my servlet.
Even when I just write a simple Java command-line progarm which call the outside objects, it also can't find the user-defined objects; unless I move out the setup of CLASSPATH. So does anyone have the further solution? or tell me where I can find the answer!
Thank you so much!

Similar Messages

  • Some problems with servlet.jar and tomcat 4.1.27

    Hello everybody,
    I used to work with tomcat 3.3.1 and i've decided to use tomcat 4.1.27 now. The manual explains that we have to change de version of servlet.jar, it's done with servlet-2.3.jar but on tomcat starting i have this message:
    jar not loaded. See servlet spec [...]. Offending class: javax/servlet/Servlet.class
    what can i do, i've red all de documentation and i think all versions a OK??
    thanks per advance
    antoine

    I am running Tomcat 4.1.18, so your configuration may be slightly different. I found the Servlet.class file you are missing residing in the Tomcat/common/lib directory in the Servlet.jar file. Check your path and also make sure your Servlet.jar file contains the missing class.

  • Servlet Compilation Problem !

    Hi,
    I am just starting to learn servlets and I got problem in compiling them. I got compilation error in
    import javax.servlet.*;statement. Seems that the compiler cannot find the servlet package. I got J2EE 1.4 beta installed on my machine but there is no servlet.jar package. I am using J2SDK 1.4.1_02, J2EE 1.4 beta and Tomcat 4.1.24.
    Can anyone help me with my servlet compilation problem?
    Thanks in advance!
    Josh

    servlet.jar is here :
    <tomcatdir>\common\lib
    add it to your compiler classpath

  • Error loading servlet.jar

    I deployed a web application in tomcat server. I'm getting following error when starting the server
    WebappClassLoader: validateJarFile(D:\jakarta-tomcat-4.1.27\webapps\registeruser
    \WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2.
    Offending class: javax/servlet/Servlet.class

    I am trying to deploy a web application using Netbeans 6.1 but when I am running it I am getting the following errors:
    deployed with moduleid = S
    validateJarFile(/home/aadhya/sanju/S/build/web/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    ##### Error java.lang.ClassNotFoundException: com.mysql.Driver
    ##### Error java.lang.ClassNotFoundException: com.mysql.Driver
    Can any body please tell me how to solve this problem???
    I tried even by deleting servlet.jar from my application but still the same problem exists.
    Thanks & Regards,
    Sanjeev K
    Edited by: sanjeev.pk on Sep 2, 2008 3:35 PM

  • Error message - servlet.jar ?

    can anyone tell me what this error message means. Ive installed a .war file that should work. but i get this error. Is it something to do with not being able to find servlet.jar ? if it is where do i need to put it?
    Thanks
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.products_jsp._jspService(org.apache.jsp.products_jsp:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    can anyone tell me what this error message means. Ive
    installed a .war file that should work. but i get
    this error. Is it something to do with not being able
    to find servlet.jar ? if it is where do i need to put
    it?
    Thanks
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(J
    spServletWrapper.java:373)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(J
    spServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServl
    et.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:802)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.products_jsp._jspService(org.apache.js
    p.products_jsp:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJsp
    Base.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:802)
         org.apache.jasper.servlet.JspServletWrapper.service(J
    spServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(J
    spServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServl
    et.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:802)
    Pal..pls quote d JSP code....
    Hope the forum could get more info regarding your problem, and help u !
    Cheers !
    Shekhar

  • Compiling file with servlet.jar

    Hi,
    I can compile my file under the arm/pdm package fine by using this command:
    javac -classpath .;.. pdm\FileName.java
    but now i wrote a servlet which imports the javax.servlet directory.
    So in order for the class to compile i have to give it the path of the servlet.jar file which is in this directory: c:/jdk1.3.1_07/lib/servlet.jar
    The problem am having is that i can't give both the classpaths at one time in order to compile my servlet which also uses classes in the pdm directory and also from a different directory under arm.
    Please help
    Thanks

    Perhaps
    javac -classpath .;..;c:\jdk1.3.1_07\lib\servlet.jar pdm\FileName.java

  • Looking for servlet.jar

    I've loaded a project into Eclipse that requires servlet.jar. This apparently doesn't come with the current version of Tomcat or Sun Application Server. How can I get the file and if I get an older version, is it going to work with Tomcat 5.5?

    Alice Sufka wrote:
    >
    > Anyone else come across this problem? :
    >
    > When trying to define a new sever runtime for JBoss 3.2.x, cannot create
    > runtime if version 3.2.6 of JBoss is selected. The error "Missing
    > classpath
    > entry c:\jboss-3.2.6\server\default\lib\javax.servlet.jar" is displayed
    > and the
    > "Finish" button is disabled.
    >
    > This occurs using the Server/Installed Runtimes preferences dialog.
    >
    > The definition of a server runtime using the same procedure but pointing
    > to an
    > install of version 3.2.3 of JBoss does not give this error and completes
    > successfully.
    >
    > A clean install of JBoss 3.2.6 does not have the javax.servlet.jar file
    > that
    > the eclipse process is looking for; I believe that the eclipse process is
    > looking for that file in error and that it should not be looking for
    > that file
    > for the 3.2.6 version of JBoss. Since the dialog is for the option of
    > defining
    > any 3.2.x JBoss runtime, I am guessing it is expecting all 3.2.x
    > installs of
    > JBoss to look alike when this is not the case.
    >
    Any way to fix this?

  • Replacing servlet.jar

    I need to upgrade the javax.servlet to the current version.
    Is it simply a matter of replacing the servlet.jar file and reloading or is it more complicated than that ?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Alan Smith:
    I am facing the same difficulty! I downloaded the TomCat added to the project path in JDev. I'm still having JDev recognizing getAttribute() and setAttribute() methods. You have mentioned 2.2 servlet api solves the problem. I couldn't find that in the TomCat website. Do I need to do anything additional from JDev in order to recognize 2.2 servlet API?
    TIA,
    A<HR></BLOCKQUOTE>
    Download the jakarta-servletapi file, extract into a directory and add to classpath. This will cater for the command line compiles.
    For JDev put the newly extracted servlet.jar on top of the one in the JDEV hierarchy ..\jswdk-1.01\servlet.jar if i remember correctly. This will BREAK servlet debugging from within the IDE - but at least you can compile and deploy.
    null

  • I need servlets.jar Can anyone send it?

    Hi all,
    I am working on a windows nt 4 staion. My problem is that I need to compile servlets but everytime I try to install the JSDK, I have a probleme NT don't want to install it.
    Could anyone send me servlets.jar to [email protected]?
    Thanks for your help
    Cecile

    Hi
    I shall send it to you today.
    bye

  • Servlet run problem..plz help

    hi
    i have made a simple servlet..compile it and put the .class file into web INF's classes folder..set the classpath to servlet. jar file ..the servlets java code is in root folder..i had also put jar file into web inf's lib folder..all the enviroment variables are setted ok.. but still when i am running it, it gives error 404..the url ,i am using for browser is ..http://localhost:8080/servlet/HelloServlet..
    please help me to resolve this problem.
    thanx
    gyan

    web xml file is..
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <!-- Copyright 2004 The Apache Software Foundation
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    -->
    - <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
    <display-name>Welcome to Tomcat</display-name>
    <description>Welcome to Tomcat</description>
    - <!-- JSPC servlet mappings start
    -->
    - <servlet>
    <servlet-name>org.apache.jsp.index_jsp</servlet-name>
    <servlet-class>org.apache.jsp.index_jsp</servlet-class>
    </servlet>
    - <servlet-mapping>
    <servlet-name>org.apache.jsp.index_jsp</servlet-name>
    <url-pattern>/index.jsp</url-pattern>
    </servlet-mapping>
    - <!-- JSPC servlet mappings end
    -->
    </web-app>

  • Error compilng servlet - even after including servlet.jar in classpath

    I have the tomcat installation , which shows the default page on stating the tomcat.
    I have my classpath set to -
    set CLASSPATH=c:\tomcat4.1\comman\lib\servlet.jar;c:\j2sdk1.4\lib\tools.jar;
    set PATH=c:\j2sdk1.4\bin;
    I have a greetserv.java which is a simple example servlet. When i try to compile this, it gives me the error javax.servlet.jar does not exist.I have it included in the classpath, but it still doesnt work.
    Any help will be appreciated.
    Thanks,
    Jyothi

    What is javax.servlet.jar?

  • Servlet Compile problem

    I am trying to compile a java servlet in a Win2000 prof
    My home drive is d:\, because I have another drive c:\, that has Win95.
    I recently downloaded JDK1.3.1_02 and J2EE1.3.1. I followed the instructions carefully. My env are
    J2EE_HOME=d:\j2sdkee1.3.1
    JAVA_HOME=d:\jdk1.3.1_02
    PATH=D:\WINNT\system32;D:\WINNT;D:\WINNT\System32\Wbem;d:\jdk1.3.1_02\bin;d:\j2sdkee1.3.1\bin;d:\j2sdkee1.3.1\lib;
    (I am aware that lib is not required here in the PATH)
    I am able to compile a simple java program. However I am not able to compile the following servlet program. I am getting the error
    package javax.servlet does not exist
    import javax.servlet.*;
    and few more errors(which is basically related to the non-availability of the package)
    Please help me and thanks for your time.
    The complete source code is
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Courses extends HttpServlet {
         public void doPost(HttpServletRequest req, HttpServletResponse resp)
              throws ServletException, java.io.IOException {
    resp.setContentType("text/html");
    java.io.PrintWriter out = resp.getWriter();
    out.println("<html><head>");
    out.println("<title> Trident </Title></head>");
    String values[];
    values = req.getParameterValues("Name");
    String name = " ";
    if (values != null) {
    name = values[0];
    else {
    name = "Friend";
    out.println("<b> Dear " + name+",here are the course details </b>");
         out.println("</html>");
         out.flush();

    I am trying to compile a java servlet in a Win2000 prof using jdk 1.4.0 and I got the same message - javax.servlet does not exist.
    I have apache tomat 4.0 installed on my machine and my classpath is
    .;d:\jtest;c:\Program_Files\Apache_Tomcat_4.0\common\lib\servlet.jar;c:\s2jdk1.4.0_01\bin;
    I compile the servlet program in d:\jtest\HelloServlet.java:
    javac -classpath c:\program_files\apache_tomcat4.0\common\lib\servlet.jar HelloServlet.java
    I am not sure why I got the javax.servlet does not exist message.
    Can you help?
    Thanks.

  • Servlet chaining problem..

    import java.io.*;
        import javax.servlet.*;
        import javax.servlet.http.*;
        public class Deblink extends HttpServlet {
          public void doGet(HttpServletRequest req, HttpServletResponse res)
                                       throws ServletException, IOException {
            String contentType = req.getContentType();  // get the incoming type
            if (contentType == null) return;  // nothing incoming, nothing to do
            res.setContentType(contentType);  // set outgoing type to be incoming type
            PrintWriter out = res.getWriter();
            BufferedReader in = req.getReader();
            String line = null;
            while ((line = in.readLine()) != null) {
              line = replace(line, "<BLINK>", "");
              line = replace(line, "</BLINK>", "");
              out.println(line);
          public void doPost(HttpServletRequest req, HttpServletResponse res)
                                        throws ServletException, IOException {
            doGet(req, res);
          private String replace(String line, String oldString, String newString) {
            int index = 0;
            while ((index = line.indexOf(oldString, index)) >= 0) {
              // Replace the old string with the new string (inefficiently)
              line = line.substring(0, index) +
                     newString +
                     line.substring(index + oldString.length());
              index += newString.length();
            return line;
    What is pre request fo above code to work.
    I had tried this many time but it is not working, what will be calling servlet look like

    And can you explain why your title is "Servlet chaining problem"?

  • JDBC/Servlets Connectivity Problems.

    Hi,
    I'm new to Java development.
    I'm trying to run this simple Servlet on
    OS : Sun Solaris 2.6
    Web Server : Netscape Enterprise Server
    Database : Oracle 8i
    JDK2 and JSDK2 installed on the Server.
    JDBC Driver : Native Oracle JDBC Driver
    This program works perfect on the Server if I run it as a program (Not a Servlet). However when running it as a Servlet, JUST DOESN't do ANYTHING. Doesn't return any error nor does execute the SQL Command.
    Also how can I enable tracing to Trap errors generated on the Server by the Servlet.
    Thanks for all your help....
    Here's the Pogram:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public class CreateTable1 extends HttpServlet {
    public void init(ServletConfig config)
    throws ServletException {
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    ServletOutputStream out = response.getOutputStream();
    out.println("<html>");
    out.println("<head><title>CR2Reat Table Server</title></head>");
    out.println("<body>");
    out.println("<br>Before Create...");
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection con = DriverManager.getConnection("jdbc:oracle:kprb:@oracle","uername","password");
    Statement statement = con.createStatement();
    statement.executeUpdate("CREATE TABLE kj_newCont1" +
    "(title_id NUMBER, title_name VARCHAR2(50)," +
    "rating CHAR(5), price NUMBER(7,2), quantity NUMBER," +
    "type_id INTEGER, category_id INTEGER)");
    catch (SQLException sqle) {
    System.err.println(sqle.getMessage());
    catch (Exception e) {
    System.err.println(e.getMessage());
    out.println("<br>AfterClose");
    out.println("</body></html>");
    out.close();
    public String getServletInfo() {
    return "Title Servlet return Information...";
    null

    To run servlets you must have a special server to run them like JRun or Java Web Server visit www.allaire.com to download JRun
    You must also download the servlet.jar
    java.sun.com
    you must configure your CLASSPATH too
    CLASSPATH=".:<path>classes12_01.zip":".:<path>servelet.jar"
    I'm using Red Hat Linux 6.2 I think this can Help you

  • Servlet.jar

    can anyone tell me what this error message means. Ive installed a .war file that should work. but i get this error. Is it something to do with not being able to find servlet.jar ? if it is where do i need to put it?
    Thanks
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.products_jsp._jspService(org.apache.jsp.products_jsp:72)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    No, it means you have a null reference in your JSP page.

Maybe you are looking for

  • IMAP-Mail sender adapter handling with read messages in mailbox

    Hi, (PI 7.0) we have a "funny" situation: We are using imap-mail-sender adapter polling a mailbox. Sometimes there are read messages in mailbox so the adapter cannot read these messages. When we sort all read messages and we mark e.g. the second mess

  • Reading through a text file and then sorting

    I'm having a lot of problems with this. I have to read through a text file and I have to split the string up so that it is seperated into individual tokens. A line from the text file looks like this. addEvent(new Bell(tm + 9000)). I have to grab the

  • Gray circle with Exclamation point instead of photo?

    I get that....er still can't paste the bugger. when I try to open a photo from viewing the event. The event pics are there but when I double click on the pic the gray circle appears. I have been a mac user for years and this is an annoying problem. A

  • I have 4 and 8 - but which is the BEST version to use for a big project?

    I have a G4 Powerbook with iMovie 4.0 but have never been able to do a movie longer than about 35 minutes (the last step - burning it?). I also have access to a new Intel iMac that has iMovie 8.0 but I have heard this is a 'dumb' version. I have an i

  • List of query result in UDF

    Dear all expert, I make an UDF and put query to that UDF.  I want to make list of value of that query result is always appear when user click that UDF. It's working fine if, the result of query is 2 rows (the list of value is pop up) but if the resul