Problem in compiling servlet class - using Tomcat

Hi,
I have a servlet pgm that I'm trying to compile.I using Tomcat application server.I have my servlet class in D:\servlet_wrk\project1\src
and my deployment descriptor in D:\servlet_wrk\project1\etc
my CLASSPATH var is set to C:\Sun\AppServer\jdk\bin
and
my PATH var is set to C:\Sun\AppServer\bin.
When I compile my servlet class Ch1Servlet.java in the command line from the directory
D:\servlet_wrk\project1 using the command
javac -classpath D:\applications\tomcat-5.5.12\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java,
it says error:cannot read: src/Ch1Servlet.java
Can somebody help me to solve this problem and help me to compile my servlet class.
Thanks.

Thanks...as u said I tried putting dir & found that
my file was saved as Ch1Servlet.java.txt instead for
Ch1Servlet.java......So that was a problem.Now I'm
able to compile.Oh, yeah. Notepad will do that to you. I think when you save in Notepad if you put quotes around the name "Whatever.java" then it won't add the .txt.
But on compiling I'm getting the following error
package java.servlet.* does not exist
package java.servlet.http.* does not exist
package java.io.* does not exist
Do u the reason for this??? The servlet stuff is java[b]x.servlet. For the io stuff, I don't know, I'd have to see your code. Either you have a typo or a corrupt installation.

Similar Messages

  • Not able to compile servlet pgm - using Tomcat

    Hi,
    I have a servlet pgm that I'm trying to compile.I using Tomcat application server.I have my servlet class in D:\servlet_wrk\project1\src
    and my deployment descriptor in D:\servlet_wrk\project1\etc
    my CLASSPATH var is set to C:\Sun\AppServer\jdk\bin
    and
    my PATH var is set to C:\Sun\AppServer\bin.
    When I compile my servlet class Ch1Servlet.java in the command line from the directory
    D:\servlet_wrk\project1 using the command
    javac -classpath D:\applications\tomcat-5.5.12\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java,
    it says error:cannot read: src/Ch1Servlet.java
    Can somebody help me to solve this problem and help me to compile my servlet class.
    Thanks.

    **MAJOR SPAMMING SCUM BAG ALERT**
    I was puzzled in that you asked a SQL Server question in one post and then in another thread asked a Oracle related question... and then I noticed you had cross posted one of your questions at JavaRanch and I was more annoyed....
    and then I found this....
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=10&t=002447
    You sir -> Michael Byrd -> are a scum sucking dirtbag.
    To quickly explain. Mr. Byrd posts his messages (which he copies wholesale from other posters) so that he can get better google caching for the website listed in his profile.
    This is such scummy behaviour I don't even know what to say. Other than basically everyone that has ever helped you had totally wasted their time.
    You are scum. Your company is scum. I hope you rot in hell.

  • Problem in Server side includes using Tomcat

    Problem in Server side includes using Tomcat:
    I am trying out small programs in servlet.
    I get one example program for server side includes from net.
    The code is:
    <HTML>
    <HEAD><TITLE>Times!</TITLE></HEAD>
    <BODY>
    <P>
    The current time in London is!!! :
    <SERVLET CODE="CurrentTime" codebase="../servlet">
    <PARAM NAME="zone" VALUE="GMT">
    </SERVLET>
    </P>
    </BODY>
    </HTML>
    I placed this test.shtml file in tomcat-home/webapps/ROOT folder and i kept the servlet in WEB-INF/classes folder.
    I renamed the servlets-ssi.jar and i removed the comments for SSI in web.xml file.
    When i run the servlet separately, i am getting the correct result. But if i run shtml file with the URL : http://localhost:8080/Test.shtml,
    i am getting the result as:
    The current time in London is!!! :
    It is not invoking servlet program.
    CAN ANYONE HELP ON THIS!
    Thanks.

    Thanks...as u said I tried putting dir & found that
    my file was saved as Ch1Servlet.java.txt instead for
    Ch1Servlet.java......So that was a problem.Now I'm
    able to compile.Oh, yeah. Notepad will do that to you. I think when you save in Notepad if you put quotes around the name "Whatever.java" then it won't add the .txt.
    But on compiling I'm getting the following error
    package java.servlet.* does not exist
    package java.servlet.http.* does not exist
    package java.io.* does not exist
    Do u the reason for this??? The servlet stuff is java[b]x.servlet. For the io stuff, I don't know, I'd have to see your code. Either you have a typo or a corrupt installation.

  • Where i can put my servlet class in tomcat 4.1

    where i can put my servlet class in tomcat 4.1 ?

    hi,
    you have to put your serlet class file in
    Tomcat\webapps\
    Here create a directory as you wish
    then, Tomcat\webapps\your directory\WEB-INF\classes
    and you have to copy web.xml to WEB-INF directoy.
    Hope this will help.
    Regards
    Sekhar

  • Tomcat session expires after compiling servlet/ class

    Hi,
    Does anybody know why tomcat(4.1) session expires if you modify a serlvet or class and compile it.
    After compiling I refresh the page and I get session invalidated page. And every time I compile I have to relogin.
    Any ideas ? Is there a work around ?

    In serverl.xml, if you have set the reloadable="true" attribute in your <Context/> tag for your web application then each time one of the servlet classes is modified, tomcat will reload the web application. Set reloadable="false" and this will stop.
    tobes

  • Serious problem of jdbc-mysql connectivity using tomcat

    hi everybody
    i m in serious problem since last 15-20 days. i m trying hard to make the connection jdbc-mysql using tomcat with the help of a jsp test page but every time i am facing almost the similar probems listed below in detail:
    to make sure that the jdrivers's .jar (mysql-connector-java-3.1.7-bin.jar) available for such connections working fine i have tried the above said connection without using tomcat....which is working fine...for this i have created a dummy database with a dummy table ..and written some queries in the .java file of my code which upon running inserts the specified values in the defined(dummy) database.
    this is the confirmation that the classpath etc..are ok in regard to the mysql-connector-java-3.1.7-bin.jar
    now i have placed a copy of this .jar file in to the commons/lib directory of the tomcat web server(which is suppossed to be the place for such external jars)
    after doing so i have followed 2 methods :
    method 1st:........
    i have made aone more jar file from the following .java file....
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class TestSQLLoad
    String user = "Not Connected";
    String pwd = "no pwd";
    int id = -1;
    public void init() {
    try{
    Context ctx = new InitialContext();
    if(ctx == null ) {
    throw new Exception("Boom - No Context");
    DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
    if (ds != null) {
    Connection conn = ds.getConnection();
    if(conn != null) {
    user = "Got Connection "+conn.toString();
    Statement stmt = conn.createStatement();
    String q = "select name, password, id from user";
    ResultSet rst = stmt.executeQuery(q);
    if(rst.next()) {
    user=rst.getString(1);
    pwd=rst.getString(2);
    id = rst.getInt(3);
    conn.close();
    }catch(Exception e) {
    e.printStackTrace();
    public String getUser() {
    return user;
    public String getPassword() {
    return pwd;
    public int getID()
    return id;
    after compiling it at the cmd prompt i made a .jar file from the .class of it and named it MySQLLoad.jar...then i placed it also in to the commons/lib directory where the mysql-connector-java-3.1.7-bin.jar was already placed.
    then i have changed the server.xml and web.xml files from the conf directory of the tomcat as given here:
    server.xml
    <!-- Example Server Configuration File -->
    <!-- Note that component elements are nested corresponding to their
    parent-child relationships with each other -->
    <!-- A "Server" is a singleton element that represents the entire JVM,
    which may contain one or more "Service" instances. The Server
    listens for a shutdown command on the indicated port.
    Note: A "Server" is not itself a "Container", so you may not
    define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <Server port="8005" shutdown="SHUTDOWN">
    <!-- Comment these entries out to disable JMX MBeans support used for the
    administration web application -->
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    </GlobalNamingResources>
    <!-- A "Service" is a collection of one or more "Connectors" that share
    a single "Container" (and therefore the web applications visible
    within that Container). Normally, that Container is an "Engine",
    but this is not required.
    Note: A "Service" is not itself a "Container", so you may not
    define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
    port="80" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
    to 0 -->
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
    resourceName="UserDatabase"/>
    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="/testdb" docBase="TOMCAT_HOME/webapps/tomcat-docs/testdb"
    debug="5" reloadable="true" crossContext="true" >
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_DBTest_log." suffix=".txt"
    timestamp="true"/>
    <Resource name="jdbc/TestDB"
    auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/TestDB">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>10</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>5</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>10000</value>
    </parameter>
    <!-- MySQL dB username and password for dB connections -->
    <parameter>
    <name>username</name>
    <value>root</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>mysql</value>
    </parameter>
    <!-- Class name for mm.mysql JDBC driver -->
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost/testdb?autoReconnect=true</value>
    </parameter>
    </ResourceParams>
    </Context>
    </Host>
    </Engine>
    </Service>
    </Server>
    and the other xml file i.e
    web.xml is here:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <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">
    <servlet>
    <servlet-name>default</servlet-name>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/TestDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-cl ***>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>invoker</servlet-name>
    <servlet-class>
    org.apache.catalina.servlets.InvokerServlet
    </servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
    <param-name>fork</param-name>
    <param-value>false</param-value>
    </init-param>
    <init-param>
    <param-name>xpoweredBy</param-name>
    <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    <!-- The mapping for the JSP servlet -->
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>abs</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ai</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aif</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aifc</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aiff</extension>
    <mime-type>audio/x-aiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>aim</extension>
    <mime-type>application/x-aim</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>art</extension>
    <mime-type>image/x-jg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asf</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>asx</extension>
    <mime-type>video/x-ms-asf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>au</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avi</extension>
    <mime-type>video/x-msvideo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>avx</extension>
    <mime-type>video/x-rad-screenplay</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bcpio</extension>
    <mime-type>application/x-bcpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bin</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>bmp</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>body</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cdf</extension>
    <mime-type>application/x-cdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cer</extension>
    <mime-type>application/x-x509-ca-cert</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>class</extension>
    <mime-type>application/java</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>cpio</extension>
    <mime-type>application/x-cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>csh</extension>
    <mime-type>application/x-csh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dib</extension>
    <mime-type>image/bmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dtd</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dv</extension>
    <mime-type>video/x-dv</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>dvi</extension>
    <mime-type>application/x-dvi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>eps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>etx</extension>
    <mime-type>text/x-setext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>exe</extension>
    <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gif</extension>
    <mime-type>image/gif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gtar</extension>
    <mime-type>application/x-gtar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>gz</extension>
    <mime-type>application/x-gzip</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hdf</extension>
    <mime-type>application/x-hdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htc</extension>
    <mime-type>text/x-component</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>htm</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>hqx</extension>
    <mime-type>application/mac-binhex40</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ief</extension>
    <mime-type>image/ief</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jad</extension>
    <mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jar</extension>
    <mime-type>application/java-archive</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>java</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jnlp</extension>
    <mime-type>application/x-java-jnlp-file</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpe</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpeg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jpg</extension>
    <mime-type>image/jpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>js</extension>
    <mime-type>text/javascript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jsf</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>jspf</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>kar</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>latex</extension>
    <mime-type>application/x-latex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>m3u</extension>
    <mime-type>audio/x-mpegurl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mac</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>man</extension>
    <mime-type>application/x-troff-man</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>me</extension>
    <mime-type>application/x-troff-me</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mid</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>midi</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mif</extension>
    <mime-type>application/x-mif</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mov</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>movie</extension>
    <mime-type>video/x-sgi-movie</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp1</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp2</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mp3</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpa</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpe</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpeg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpega</extension>
    <mime-type>audio/x-mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpg</extension>
    <mime-type>video/mpeg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>mpv2</extension>
    <mime-type>video/mpeg2</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ms</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>nc</extension>
    <mime-type>application/x-netcdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>oda</extension>
    <mime-type>application/oda</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pbm</extension>
    <mime-type>image/x-portable-bitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pct</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pdf</extension>
    <mime-type>application/pdf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pgm</extension>
    <mime-type>image/x-portable-graymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pic</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pict</extension>
    <mime-type>image/pict</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pls</extension>
    <mime-type>audio/x-scpls</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>png</extension>
    <mime-type>image/png</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnm</extension>
    <mime-type>image/x-portable-anymap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>pnt</extension>
    <mime-type>image/x-macpaint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppm</extension>
    <mime-type>image/x-portable-pixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ppt</extension>
    <mime-type>application/powerpoint</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ps</extension>
    <mime-type>application/postscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>psd</extension>
    <mime-type>image/x-photoshop</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qt</extension>
    <mime-type>video/quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qti</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>qtif</extension>
    <mime-type>image/x-quicktime</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ras</extension>
    <mime-type>image/x-cmu-raster</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rgb</extension>
    <mime-type>image/x-rgb</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rm</extension>
    <mime-type>application/vnd.rn-realmedia</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>roff</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtf</extension>
    <mime-type>application/rtf</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>rtx</extension>
    <mime-type>text/richtext</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sh</extension>
    <mime-type>application/x-sh</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>shar</extension>
    <mime-type>application/x-shar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>smf</extension>
    <mime-type>audio/x-midi</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sit</extension>
    <mime-type>application/x-stuffit</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>snd</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>src</extension>
    <mime-type>application/x-wais-source</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4cpio</extension>
    <mime-type>application/x-sv4cpio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>sv4crc</extension>
    <mime-type>application/x-sv4crc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>swf</extension>
    <mime-type>application/x-shockwave-flash</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>t</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tar</extension>
    <mime-type>application/x-tar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tcl</extension>
    <mime-type>application/x-tcl</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tex</extension>
    <mime-type>application/x-tex</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texi</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>texinfo</extension>
    <mime-type>application/x-texinfo</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tif</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tiff</extension>
    <mime-type>image/tiff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tr</extension>
    <mime-type>application/x-troff</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>tsv</extension>
    <mime-type>text/tab-separated-values</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ulw</extension>
    <mime-type>audio/basic</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>ustar</extension>
    <mime-type>application/x-ustar</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xbm</extension>
    <mime-type>image/x-xbitmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xht</extension>
    <mime-type>application/xhtml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xhtml</extension>
    <mime-type>application/xhtml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xml</extension>
    <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xpm</extension>
    <mime-type>image/x-xpixmap</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xsl</extension>
    <mime-type>text/xml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>xwd</extension>
    <mime-type>image/x-xwindowdump</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wav</extension>
    <mime-type>audio/x-wav</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>svg</extension>
    <mime-type>image/svg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>svgz</extension>
    <mime-type>image/svg</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>vsd</extension>
    <mime-type>application/x-visio</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Wireless Bitmap -->
    <extension>wbmp</extension>
    <mime-type>image/vnd.wap.wbmp</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- WML Source -->
    <extension>wml</extension>
    <mime-type>text/vnd.wap.wml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Compiled WML -->
    <extension>wmlc</extension>
    <mime-type>application/vnd.wap.wmlc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- WML Script Source -->
    <extension>wmls</extension>
    <mime-type>text/vnd.wap.wmlscript</mime-type>
    </mime-mapping>
    <mime-mapping>
    <!-- Compiled WML Script -->
    <extension>wmlscriptc</extension>
    <mime-type>application/vnd.wap.wmlscriptc</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>wrl</extension>
    <mime-type>x-world/x-vrml</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>Z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>z</extension>
    <mime-type>application/x-compress</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>zip</extension>
    <mime-type>application/zip</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    after all this i have taken a jsp page whose code is here:
    (the mysql database used is named as "testdb" and the table name is "user" which is having fields name,password and id)
    <html>
    <head>
    <title>DB Test</title>
    </head>
    <body>
    <%
    TestSQLLoad tst = new TestSQLLoad ( );
    tst.init();
    %>
    <h2>Results</h2>
    User <%= tst.getUser() %>
    Pwd <%= tst.getPassword() %>
    Id <%= tst.getID() %>
    </body>
    </html>
    and placed it in to the Tomcat 5.5\webapps\tomcat-docs\testdb directory and saved as test-db.jsp
    when i run this page on the browser i get a lot may errors stating
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    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)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
    AND NOW WHEN just to get rid of such errords i try to include a statement
    <%@ page import="pkg.TestSQLLoad" %> in the jsp page code (and also place the MySQLLoad.class file in a folder called pkg and place it in the same directory where the jsp page is )and make it look like
    <html>
    <head>
    <%@ page import="pkg.TestSQLLoad" %>
    <title>DB Test</title>
    </head>
    <body>
    <%
    TestSQLLoad tst = new TestSQLLoad ( );
    tst.init();
    %>
    <h2>Results</h2>
    User <%= tst.getUser() %>
    Pwd <%= tst.getPassword() %>
    Id <%= tst.getID() %>
    </body>
    </html>
    now when i run it i get the following errors:
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    Only a type can be imported. pkg.TestSQLLoad resolves to a package
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    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)
    in response to the above error i have even tried placing the MySQLLoad.class directly in the testdb folder along with the jsp page without keeping it in a package named pkg and then importing directly as <@page import="MySQLLoad" %>
    that too gave me the following errors
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    The import TestSQLLoad cannot be resolved
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 12 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    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)
    and if i do not use the statement <%@ page import="MySQLLoad"%> then also i get the errors like
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 11 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    An error occurred at line: 11 in the jsp file: /testdb/test-db.jsp
    Generated servlet error:
    TestSQLLoad cannot be resolved or is not a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
    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)
    THE 2nd Method:
    in my second method i did the same changes in the web.xml and server.xml
    then i took a jsp page with the following code:
    <%@ page import="javax.sql.*,java.sql.*,javax.naming.*,com.mysql.jdbc.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> trial doc </TITLE>
    </HEAD>
    <BODY>
    <h1>Trial Document</h1>
    <% InitialContext context=new InitialContext( );
    DataSource dataSource=(DataSource) context.lookup("java:comp/env/jdbc/testdb");
    Connection conn=dataSource.getConnection();
    Statement stmt=conn.createStatement();
    ResultSet rset=stmt.executeQuery("select * from user");
    if (rset.next()){
    %>
    <table width="100%" border="1">
    <tr align="left">
    <th>name</th> <th>password</th><th>id</th>
    </tr>
    <%
    do {
    %>
    <tr><td> <%=rset.getString(1)%> </td>
    <td><%=rset.getString(2) %></td>
    <td><%=rset.getString(3) %></td></tr>
    <%
    } while (rset.next());
    %>
    </table>
    <%
    } else{
    %>
    No results from query
    <%
    rset.close();
    stmt.close();
    conn.close();
    context.close();
    %>
    </BODY>
    </HTML>
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type Connection is ambiguous
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type Statement is ambiguous
    An error occurred at line: 15 in the jsp file: /testdb/Big1.jsp
    Generated servlet error:
    The type ResultSet is ambiguous
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.j ava:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
    org.apache.jasper.compiler.Compiler.compile(C

    thanx for ur response
    as u said that the problem is more of a jsp page not getting compiled....
    me also pointed towards the similar situation providing all the surrounding situations
    which i have met and gone through
    i m still thinking that problem may b in the tomcat's server.xml and web.xml as well
    so better if u plz guide me in that regard
    regards,
    kuldeep

  • Problem while compiling Servlet

    M using Tomcat.
    Environment variables :
    Variable :::::::::::::::: Values
    %TOMCAT_HOME% ::::::::::: C:\Tomcat\bin
    CLASSPATH :::::::::::::::: .;C:\jdk 1.4.2\lib;C:\jsdk2.1 \servlet.jar;C:\Tomcat\lib\servlet.jar;
    PATH ::::::::::::::::::::: ;C:\jdk 1.4.2\bin
    JAVA_HOME :::::::::::::::: C:\jdk 1.4.2
    Now problem is that When m trying to compile GreetingServlet.java
    problems are:::
    GreetingServlet.java:31: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<BODY>");
    ^
    GreetingServlet.java:32: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<p>"+message +","+name+"</p>");
    ^
    GreetingServlet.java:33: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<p> Thanks ("+email+")</p>");
    ^
    GreetingServlet.java:34: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<p> -The Pro Java Team.</p>");
    ^
    GreetingServlet.java:35: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("</BODY>");
    ^
    GreetingServlet.java:36: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("</HTML>");
    ^
    Source Code:
    import javax.servlet.* ;
    import javax.servlet.http.* ;
    import java.io.* ;
    import java.util.* ;
    public class GreetingServlet extends HttpServlet{
    protected void doPost (HttpServletRequest request,
                   HttpServletResponse response)
                        throws ServletException, IOException {
         String name = request.getParameter ("name");
         String email = request.getParameter ("email");
         String message = null;
         GregorianCalendar calendar = new GregorianCalendar();
         if (calendar.get(Calendar.AM_PM) == Calendar.AM) {
              message =" Good Morning";
         else {
              message = " Good Afternoon";
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         out .println("<HTML>");
         out .Println("<BODY>");
         out .Println("<p>"+message +","+name+"</p>");
         out .Println("<p> Thanks ("+email+")</p>");
         out .Println("<p> -The Pro Java Team.</p>");
         out .Println("</BODY>");
         out .Println("</HTML>");
         out .close();
    Thanks in Advance
    Please its an urjent.
    Hoping to get the solution soon from cream like you in Programming.

    hi
    it could be you have caps P.
    try:
    "println" instead of "Println".

  • Compiling servlet class:javac gives 'bad command'

    I have a servlet class in the path: E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    I am using Tomcat 3.2.4 and Just Go (the tomcat launcher) provides this log of my settings:
    CLASSPATH:
    .;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\servlet.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\ant.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jaxp.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\crimson.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\webserver.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jasper.jar
    Executable :
    E:\JBuilder35\jdk1.2.2\jre\bin\java.exe
    Command line arguments (in order appended) :
    -Dtomcat.home=E:\Tomcat324\jakarta-tomcat-3.2.4
    org.apache.tomcat.startup.Tomcat
    Environment Vars :
    TOMCAT_HOME=E:\Tomcat324\jakarta-tomcat-3.2.4
    TOMCAT_LIB=E:\Tomcat324\jakarta-tomcat-3.2.4\lib
    JAVA_HOME=E:\JBuilder35\jdk1.2.2\jre
    JAVA_EXE=E:\JBuilder35\jdk1.2.2\jre\bin\java.exe
    WINDIR=C:\WINDOWS
    CLASSPATH=.;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\servlet.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\ant.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jaxp.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\crimson.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\webserver.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jasper.jar
    In my DOS screen, I go to the path E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes and type in "javac helloWorld.java" and I get the message :Bad Command or File Name
    I'd greatly appreciate it if anyone could tell me what path to use in DOS to enable me to use the javac command.
    My problem is there are so many paths in the Tomcat settings (above), I am not sure which one to use to compile my servlet.

    Thanks for the suggestion. I am not trying to use JBuilder, just the command line from DOS so I hope that won't impact this.
    JAVAC is in e:\jbuilder35\jdk1.2.2\bin
    and the class that I am trying to run is in:
    e:\tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    and it's called CookieExample.java
    Here's a copy of my DOS Screen of what I did and the result:
    E:\>set path = javac e:\jbuilder35\jdk1.2.2\bin;%path%
    E:\>cd e:\tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes>javac CookieE
    xample.java
    Bad command or file name
    -Any idea why I am still getting the error?

  • Calling a servlet program using tomcat...

    I have placed a simple servlet(.class) program in my C:\jakarta-tomcat-4.1.24\webapps\ROOT\WEB-INF\classes folder. How should i call that in by browser.
    How to set classpath in tomcat for compiling servlets.
    THANX

    it's depend what port you are using
    http://localhost:8080/servlet/yourservletname
    http://localhost:80/servlet/yourservletname
    if you uncommented out the comment for the servlet invoker in the web.xml found in the conf directory
    It looked something like this
        <!--
        <servlet>
            <servlet-name>invoker</servlet-name>
            <servlet-class>
              org.apache.catalina.servlets.InvokerServlet
            </servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
        </servlet>
        -->get rid of the <!-- and --> to uncomment the comment out
    than you can do
    http://localhost:8080/yourservletname
    http://localhost:80/yourservletname
    Anyway..you should modify you web.xml file found in
    C:\jakarta-tomcat-4.1.24\webapps\ROOT\WEB-INF\ folder
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <display-name>Welcome to Tomcat</display-name>
      <description>
         Welcome to Tomcat
      </description>
    <servlet>
       <servlet-name>myServlet</servlet-name>
       <servlet-class>HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
       <servlet-name>myServlet</servlet-name>
       <url-pattern>/hi</url-pattern>
    </servlet-mapping>
    </web-app>then you can do (again..make sure you uncomment out the
    http://localhost:8080/hi
    http://localhost:80/hi
    servlet-name tag is the name of the servlet Tomcat will recognized (can be anything you make up)
    servlet-class is the servlet.class file that you want to use
    the url-pattern is what you have to type in the url to make a request to the servlet (again this can be anything you would like it to be)
    heck..it can even be a * for anything

  • Problem for retriveing servlet class file (error in DD) I think so

    hi to all ,
    my deployment descriptor is here ....
    I tried to access servlet ... I got the response is like that
    The requested Resource is not available
    why its happening ?
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <welcome-file-list>
         <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <listener>
         <listener-class>CallMonitor.MyListener</listener-class>
    </listener>
    <servlet>
         <servlet-name>LoginAction</servlet-name>
         <servlet-class>LoginAction</servlet-class>
    </servlet>
    <servlet>
         <servlet-name>InsertData</servlet-name>
         <servlet-class>InsertData</servelt-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>LoginAction</servlet-name>
         <url-pattern>/LoginAction</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
         <servlet-name>InsertData</servlet-name>
         <url-pattern>/InsertData</url-pattern>
    </servlet-mapping>
    <context-param>
         <param-name>jdbcurl</param-name>
         <param-value>jdbc:mysql://localhost:3306/test</param-value>
    </context-param>
    </web-app>But i remove the code from it , i can access LoginAction Servlet..
    <servlet>
         <servlet-name>InsertData</servlet-name>
         <servlet-class>InsertData</servelt-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>InsertData</servlet-name>
         <url-pattern>/InsertData</url-pattern>
    </servlet-mapping>
    In Tomcat manager i found the applicaton is not running.
    i started the application using start command...
    But i got error message
    FAIL - Application at context path /25.7 could not be started
    Message was edited by:
    kannankalli

    <servlet-class>InsertData</servelt-class>Closing element for <servlet-class> is wrong.
    Before posting for any help check following stuff
    - Whether deployment descriptor is well-formed
    - Whether it is valid i.e. all elements are properly placed

  • Silly problem when compiling main class

    hi there,
    i have a problem when compiling the main class.
    the classes used by the main class are not recognized. the compiler can't locate the children classes.
    i've already set the path and classpath environment variables, but there's still something missing.
    how should i organize my folders in order to be able to compile the main class successfully, please?
    thanks.

    It would be good to have a precise problem description: the actual command used, folder structure and environment variable settings. Even if you have to construct a simple test case with a couple of classes that illustrates the problem.
    In the absence of that some generic remarks:
    The PATH variable typically points at all the folders that contain executable files that you use often. You can always access other executable files by specifying there full names.
    The CLASSPATH variable is typically left unset.
    When you use the java tools (like the javac compiler or the java runtime) you can specify the classpath that you want to use with -cp. This will override any CLASSPATH value. So in the simple case of two classes (Main and MyClass), you can put them in anywhere you like (for example C:\MyJavaStuff) and compile and run with:
    {noformat}
    C:\MyJavaStuff> javac -cp . *.java
    C:\MyJavaStuff> java -cp . Main
    {noformat}(Mind the dot after -cp))
    By a "main" class I guess you mean a class with a static void main(String args[]) method, but I am suspicious of your "child" classes. Perhaps packages are involved. A precise description of the problem would help.

  • Add non-servlet class to Tomcat

    Hi,
    does anyone know, what I have to do, to be able
    to use a simple non-servlet class file in my
    jsp-pages.
    e.g.
    MyClass.class
    In my jsp page:
    <%
    MyClass m = new MyClass( );
    %>
    I was told that I simply have to put it in the
    web-inf/classes directory, but that doesn't seem
    to work ...
    Any help would be appreciated! Thanx. chris

    You need to use the "import" statement or else use the full class name. Also, some servers don't handle the default package well so you may want to try placing the class in a package.
    e.g. if class is mypackage.MyClass, it is placed in web-inf/classes/mypackage/MyClass.class
    In the JSP, code:
    <%@ page import="mypackage.MyClass" %>
    <%
    MyClass m = new MyClass();
    %>or you could use "useBean" to avoid scriptlets.

  • Problem in compiling servlets

    Hi
    I have j2sdk1.4.0 and i am using J2ee application server.My problem is while compiling i get error as "javax.servlet" package not found.Can anybody suggest me how to give the classpath for successful compilation.
    regrds
    Vaijayanthi

    hi vaiju
    basically it gets struck while finding as well loading the appropriate library files when there is a request for servlet.. tats where it gave the error of javax.servlet is missing..
    all servlet and jsp related files (class files) reside in this javax.servlet package.. its there javax.servlet jar or simply servlet.jar or even you can use the j2ee.jar which the superset of all of these..
    you can any one of the following 2 things:
    (1) you can either set the classpath of your pc to point to or include the location where it contains any of these .jar files
    (2) you can put the reqd lib files in the container's (web/app server's) location which it internally maintains for searching while loading/running the applications...
    here you have two options
    (a) either you can include the jar files with the individual applications (your applications WEB-INF/lib folder, which you can find inside the <TOMCAT_HOME>/webapps/ YOUR_APP_ROOT/WEB-INF/lib folder)
    (b) you can put the jar files in the common place of the container in case of being required by several applications (in case of tomcat, you can put in <TOMCAT_HOME>/common/lib folder).
    Dont forget to mention this in the build.xml file in case if you use ANT tool to build your application. you can set the <property> for the classpath.
    Hope this helps...
    Good luck to your journey in Servlets....

  • Problem in compiling servlet

    hi
    i'm trying to compile a simple servlet
    my directory structure is as follows
    c:\pr1
    |
    |____src
    |
    |______chservlet.java
    |
    |____classes
    |
    |____etc
    |
    |______web.xml
    c:\Tomcat5.0
    |
    |____webapps
    |
    |______ch1
    |
    |____WEB-INF
    |
    |____classes
    and the list of variables is as follows
    TOMCAT_HOME=c:\Tomcat 5.0\bin
    JAVA_HOME=c:\jsdk1.4
    classpath = %CLASSPATH%;c:\Tomcat 5.0\common\lib\servlet-api.jar
    now when i'm trying to compile the servlet by giving the following command
    javac -classpath ".;c:\Tomcat5.0\common\lib\servlet-api.ajr" -d classes c:\pr1\src\chservlet.java
    i'm getting the error package..
    javax.servlet.* doesnt exist
    can anybody help me at the earliest
    Regards
    jaismeen

    sorry guys..for starting each time new thread..just registered myself to the site yesterday after facing this problem..so cudnt get familiar with its working..
    i have given the commands as follows..
    set classpath=c:\Tomcat5.0\common\lib\servlet-api.jar,%classpath%
    set path=c:\jsdk1.4\bin;%path%
    javac c:\pr1\src\chservlet.java
    getting the following errors
    C:\>javac c:\pr1\src\chservlet.java
    c:\pr1\src\chservlet.java:1: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    c:\pr1\src\chservlet.java:2: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    c:\pr1\src\chservlet.java:5: cannot resolve symbol
    symbol : class HttpServlet
    location: class chservlet
    public class chservlet extends HttpServlet
    ^
    c:\pr1\src\chservlet.java:7: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class chservlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOExcep
    tion
    ^
    c:\pr1\src\chservlet.java:7: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class chservlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOExcep
    tion
    ^
    5 errors
    was just wondering.ihave windows xp..so does it effect in anyway(it shud not)
    and if name of the servlet is given wrong then it shudnt give these set of errors..it shud give kind a"cudnt find the file name"
    and i have checked the classpath..servlet-api.jar is present and is in this location
    c:\Tomcat 5.0\common\lib
    and i had tried giving the command
    jar -tvf servlet-api.jar..
    it gives the list of classes..which shows..its present in the directory
    jdk is present in c:\jsdk1.4
    location of servlet is c:\pr1\src\chservlet.java
    servlet code is as follows
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class chservlet extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException
    PrintWriter out =res.getWriter();
    java.util.Date today= new java.util.Date();
    out.println("<html>"+
    "<body>"+
    "<h1 align=center>HF\'s Chapter1 Servlet<h1>"
    +"<br>"+today+"</body>"+"</html>");
    even i tried copynig servlet-api.jar in the same directory as the servlet and compiling it..
    it gives the same set of errors
    am just wondering what cud be the problem.sure..must b very smal..but i m not progressing much
    regards

  • Problem to compile .java class

    hi,
    i'm using/creating a package of classes....and as per my knowledge there is no need to write explicit import if u r importing/using an instance of class1 in other class2 in the same package.....
    I'm doing the same.....
    but the problem arrises here that....while compiling class2 the error occures..........
    D:\tomcat\webapps\Books\WEB-INF\classes\BookForm.java:6: cannot resolve symbol
    symbol : class Book
    location: class BookForm
         private Book book =new Book();
    why so????? as i have included the package in CLASSPATH also..........
    PLZ reply....
    .....Amita

    You don't need to import classes that are in the same package but they do need to be in the classpath. My guess is that you are compiling BookForm.java from the D:\tomcat\webapps\Books\WEB-INF\classes directory. Either add "D:\tomcat\webapps\Books\WEB-INF\classes" explicitly to your classpath or add a dot (".") to your classpath.

Maybe you are looking for

  • Acrobat 9 Pro Windows 7 Ultimate 64 bit

    I am using Windows 7 Ultimate 64 bit with a Canon MX 850 on a wireless network for my notebook.  I am unable to scan any documents from the scanner to the notebook using Abode Acrobat 9 Pro.  I can print PDF from the notebook but unable to create PDF

  • Mass Close Schedule Lines

    I Need to mass close the schedule lines on a cuttoff date for the list of items and plant. Open schedule lines are affecting the mrp releases. Could any one suggest the solution. Regards, R.Srilakshmi

  • Character Set Migration - Arabic & English Language Support

    Hi, Sofware Specifications: OS Version : Windows 2003 EE Server, SP2, 32-Bit DB Version : 9.2.0.1 Application : Lotus Domino 6.5 Existing Set Up: DB CHAR SET : WE8MSWIN 1252 National Character Set : AL16UTF16 NLS_LANG : NA Now the customer extended t

  • How do I track doc download progress using jQuery UI progress indicator?

    How do I track document download progress using jQuery UI progress indicator? I'm looking at downloading a zip file in response to the onclick event in a jQuery button. I'd like to show the download progress on the page. I'm working with users who ma

  • HT204088 How do I find out what charges are for on my bank statement

    Outrageous charges posted to bank account associated with apple- id. I can't tell what they are for. How do I find out?