Compiling a servlet file,HELP

Hi,
I have put the classpath of servlet-api.jar and jsp-api.jar in a batch file by name tomcat.bat.I ran the classpath and then tried javac on HelloServlet.java and I get a series of complation errors,
/****** Errors *******/
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 resolve symbol
symbol : class HttpServlet
location: class HelloServlet
public class HelloServlet extends HttpServlet {
^
HelloServlet.java:14: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloServlet
public void doGet(HttpServletRequest request,
^
HelloServlet.java:15: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloServlet
HttpServletResponse response)
^
HelloServlet.java:16: cannot resolve symbol
symbol : class ServletException
location: class HelloServlet
throws ServletException, IOException {
^
6 errors
/***************************Errors**********************/
Kindly let me know what this could be.
Hoping to hear from you at the earliest.
Thanks
AS
PS : The batch file is as follows
/***********************************tomcat.bat***********************/
set classpath=;E/tomcat/tomcat-5/common/lib/servlet-api.jar;E/tomcat/tomcat-5/common/lib/jsp-api.jar

Hi,
I have put the classpath of servlet-api.jar and
nd jsp-api.jar in a batch file by name tomcat.bat.I
ran the classpath and then tried javac on
HelloServlet.java and I get a series of complation
errors,
/****** Errors *******/
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 resolve symbol
symbol : class HttpServlet
location: class HelloServlet
public class HelloServlet extends HttpServlet {
^
HelloServlet.java:14: cannot resolve symbol
symbol : class HttpServletRequest
location: class HelloServlet
public void doGet(HttpServletRequest request,
^
HelloServlet.java:15: cannot resolve symbol
symbol : class HttpServletResponse
location: class HelloServlet
HttpServletResponse response)
^
HelloServlet.java:16: cannot resolve symbol
symbol : class ServletException
location: class HelloServlet
throws ServletException, IOException {
^
6 errors
/***************************Errors*********************
Kindly let me know what this could be.
Hoping to hear from you at the earliest.
Thanks
AS
PS : The batch file is as follows
/***********************************tomcat.bat*********
set
classpath=;E/tomcat/tomcat-5/common/lib/servlet-api.jar
E/tomcat/tomcat-5/common/lib/jsp-api.jarI did put in the tomcat batch file the classpath for servlet-api.jar file,please see the above lines.
Kindly help
As

Similar Messages

  • How to Compile servlet files in weblogic

    Hi,
    I would like to know how i can compile the servlet files to deploy in weblogic.
    I searched for servlet.jar or servlet-api.jar files in my weblogic 8.1 installed folder. Could not find it to set the classpath.
    Please help.

    You need to use weblogic.jar for Weblogic 8.1. It should be present under server\lib subdirectory in Weblogic installation directory.

  • Compiling the java file related to Servlet and Core java files in heirarchy

    I am working in Jakarta-Tomcat 4.0.4 with j2sdk1.4.1_01 and i have put all servlet files in package "com.java.servlet"
    and other core java files in package "com.java.action" . Also I am imorting java files in package
    "com.java.action" to the package "com.java.servlet".
    But when I am compiling the servlet files in package "com.java.servlet"
    then the servlet files are not compiling because it cannot able to import
    java files in package "com.java.action" . I have tried all the options.
    If anybody has solution then please respond immediately.

    I agree with the previous poster, this sounds like a generic compiling problem. FYI: I do not think that packages that start with "com.java." are special or reserved in any way.
    You are making a servlet, not a JSP, right? Since this is merely about compiling, you might want to re-post to "Java Programming".

  • How to compile and execute servlet file in j2ee

    In j2ee server when iam compiling servet i am getting error messages like package javax.servlet,and javax.servlet.http does not exist like that.
    i hsve set path like this.and i gave path for j2sdk .
    set CPATH=.;%J2EE_HOME%\lib\j2ee.jar
    javac -classpath %CPATH% AdderServlet.java
    can anybody tell me where to place
    servlet and how to compile it.
    Thank u,
    Renuga

    Make sure that '%J2EE_HOME%\lib\j2ee.jar' is existing. Where is your J2EE_HOME pointing to?
    The best thing I can suggest is, create your own bat file to compile the servlets. Like this,
    Save the lines below as "MyCompiler.bat" file.
    @echo off
    set JDK_HOME=<path to you jdk home upto bin directory>
    set J2EE_HOME=<path to you je22 home>
    set CLASSPATH=.;%J2EE_HOME%\lib\j2ee.jar
    %JDK_HOME%\javac %1
    Use the command,
    MyCompiler AdderServlet.java
    You can improve this MyCompiler.bat further, can add additional jar files to the classpath whenever you want. You can put this bat file in System's path, so that you can invoke it just by the name (MyCompiler) without giving the full path to it (like C:\mydir\MyCompiler).
    Hope this helps.
    Sudha

  • Urgent! Pls help me! Can't compile any *.java files

    I am a new user to Java2SDK. I am using Win2K sever and I have installed Java2SDK1.4.0 in D drive. When I compile any *.java files, a message " 'javac' is not recognized as an internal or external command, operable program or batch file" appears. How can I solve this problem?
    Please help me. I am busy with my homework. Thank you very much.

    In your PATH variable include %JAVA_HOME%\bin;
    For example:
    C:\jdk1.4\bin;

  • Cannot compile servlet file

    I cannot compile Servlet files on my WinXP environment.
    my servlet.jar file is located at
    c:\tomcat\jakarta-tomcat-3.3.1\common\lib\servlet.jar
    what shall I do?
    The error messages are only for servlet portion of code?

    In XP you can set the path by rightclicking on my computer - then go to environment vairables and edit the path but I cannot see any for classpath???
    What is the easist way yo use the class path?

  • How to compile a java file(Servlet) in J2EE v1.3.1

    This is my first time using J2EE instead of J2SE!!HOw to compile a java file in J2ee\bin because there is no javac in j2ee and when i compile in J2se i got
    G:\j2sdk1.4.1_01\bin>javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    This mean it doen;t support servlet in J2se!!so how can /what command to compile a servlet java file in j2ee.Thanks

    You'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
    For example (using weblogic):
    javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
    HelloServlet.java

  • Need help compiling external jar files into my one jar file from cmd line

    Here is my problem, let me see if I can explain it right:
    I am making a jar file on my development computer that will run my java project. In this java project, it references a couple Java3D jar files. On my development computer, I create the jar file and it runs correctly, but when I move that jar file over to the test computer, the parts of the application needing those Java3D jars are not found in my jar I created. I isolated the problem and it is because those Java3D jar files I needed are not on my test machine. But that is the way I need it to be. I need it so that when I compile all my code on the development machine, I need it to also compile those two Java3D files into my one jar that I move to the test machine. You get what I'm saying? I must do all the compiling from the command line and have only one jar file to put on the test machine that contains all my compiled code and the two Java3D files needed to run some of the applications in the project.
    Here a brief sample of what I'm doing:
    To compile my java files in my project, I simply to this for all my files:
    javac file.java
    javac file2.java... and so on for all my java files.
    Then I create my jar file:
    jar -cfm MyJar.jar manifest.mf file.class
    jar -fmu MyJar.jar manifest.mf file2.class... and so on for all my class files.
    Also when compiling my jar file, I do this thinking that it would include the two Java3D jars into my one jar file:
    jar -fmu MyJar.jar manifest.mf jars/j3d-org-images.jar
    jar -fmu MyJar.jar manifest.mf jars/j3d-org.jar
    My manifest file looks something like this:
    Manifest-Version: 1.0
    Main-Class: Main
    Class-Path: jars/j3d-org.jar jars/j3d-org-images.jar
    Do I have to have that Class-Path in there pointing to those jar files? Those jar files will not exist on my test machine because the directory structure will not be the same. I've tried a manifest without specifying my Class-Path to those jar files, but I get the same problem when I run my application on the part that needs the Java3D files.
    The error I am getting is that there is a RasterTextLabel class inside one of those Java3D jar files that my application cannot access because those jar files are not on my test machine.
    So basically what I really need to know is how I get those two Java3D jar files compiled into my one jar file that I move to a test machine and run with the following command:
    java -jar MyJar.jar
    Can anyone help me??
    Thanks.

    Here what you need is to have all the files present in a single jar file, and the classpath is set properly to the required jar files.
    Do the following in steps:
    1)
    Create a custom manifest file,say mymanifest.mf, with the following contenets, put it in current directory:
    Manifest-Version: 1.0
    Created-By: 1.4.0_01 (Sun Microsystems Inc.)
    main-Class: Main
    Class-Path: jars/j3d-org.jar jars/j3d-org-images.jar <press ENTER key>
    2)
    jar -cfm MyJar.jar manifest.mf file.class
    jar -fmu MyJar.jar manifest.mf file2.class... and so on for all class files.
    3)
    jar -fmu MyJar.jar manifest.mf jars/j3d-org.jar
    jar -fmu MyJar.jar manifest.mf jars/j3d-org-images.jar
    (Make sure that j3d-org-images.jar and j3d-org.jar are present in a subdirectory called 'jars')
    Now you would be able to run,
    java -jar myjar.jar

  • Help compiling BookStore  SERVLETS tutorial classes

    I am new to Java. Please be patient with my errors. I need help with compiling the servlets given as part of the SERVLET tutorial. I have previously installed JDK1.3.1.01. I have also downloaded the JSDK2.1 as part of the tutorial. As part of the tutorial several servlet classes were provided. Almost all of them have these import statements.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    However, the javac is unable to compile the classes. I think it is because javax.servlet is installed under /root/jsdk and JDK is installed under /usr/java/jdk1.3/bin. I can find the javax directory under /root/jsdk but not under /usr/java. I tried giving the classpath option to javac as:
    javac -classpath /root/jsdk BookStoreServlet.java
    But it did not work.
    I believe once the servlet classes are compiled it will be possible to view them from the JSDK browser. I was able to successfully start the jsdk browser with startserver script given with the distribution. And the example SnoopServlet worked fine.
    In summary, I believe the authors of the tutorial left out the details of compiling the classes and viewing from browser. I could be wrong about it.
    I will appreciate any help from the users of the tutorial and anyone who knows servlets.
    Many thanks.
    Murthy

    i found this info on how to set the classpath in linux
    http://java.sun.com/products/jdk/1.2/docs/tooldocs/sola
    is/classpath-linux.htmlThanks imp-cat. I could compile the BookStoreServlet.java into its corresponding class. I get the following error when I try to run it. What should I do? Thanks. Regards. Murthy
    java BookStoreServlet
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)

  • Help compiling with .class files

    I am using JGrasp and I am trying to compile a program that uses .class files instead of the .java files, but JGrasp will not recognize these at compile time. How do I get my program to compile with these .class files?

    I prefer using Jenuity:
    [http://www.nmmu.ac.za/jenuityIDE]
    It's much simpler to use than JGrasp and isn't nearly as confusing.
    For the record, you compile .java files into .class files. There is no need to "compile" existing .class files. If you have the class files you can run them from the command line. e.g. if you have a class file named Orange.class you should be able to type "java Orange" from the command line to run it. If Orange is inside a directory structure based on packages you may need to execute this command from just outside the 'highest" folder.
    If you just need to link to these class files, copy them into the "/jre/lib/ext" folder of your JDK.

  • Need HELP!! Where I have to place an web.xml(servlet) file on server

    I'm using E-business suite for oracle HR version 11.
    On localhost i have developed an servlet file with using web.xml. On web.xml i have customized the file that can load a class for my servlet.But when I deploy on the server i had a cnfused wher do i have to place web.xml and my servlet.
    I have made an servlet file for my custom. Where do I have to place an xml(servlet) file on server?
    Would you give me know forsolving my problem.Please give me know,I really appreciated if you want to give some solution.
    Regards,
    Dany Fauzi

    Copy web.xml to WEB-INF directory of the web application.

  • Not able to compile an xml file using jasper reports through jsp page

    hi,
    i have compiled an xml file and got html,pdf etc using jasperreports but that was from an java application and now i want to convert this application to an jsp page so i have copied these jar files "commons-beanutils-1.5.jar","commons-collections-2.1.jar","commons-digester-1.3.jar","itext-1.01.jar","jasperreports-0.5.2.jar" to the folder "C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\lib" and have set classpath to these jar files.
    my application(java class invoked by a servlet) is in C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes.
    i m using this API "JasperCompileManager.compileReportToFile(fileName);"
    but i m getting following error:
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Invoker service() exception
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:504)
         at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2312)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:536)
    root cause
    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
         at org.apache.commons.digester.Digester.(Digester.java:345)
         at dori.jasper.engine.xml.JRXmlDigester.(JRXmlDigester.java:115)
         at dori.jasper.engine.xml.JRXmlLoader.prepareDigester(JRXmlLoader.java:446)
         at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:384)
         at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:371)
         at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:339)
         at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:323)
         at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:102)
         at jasper_interact.file_exporter(jasper_interact.java:44)
         at reportcontroller.doGet(reportcontroller.java:59)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:446)
         at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2312)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:536)
    i have one folder "C:\Program Files\Apache Tomcat 4.0\org\apache\commons\logging" containing some LogFactory calsses but i dont know where to put this folder so that tomcat can find them.
    please help me..
    i know i may not be clear to u but plz give me some way out i m totally stucked.
    manish

    hi,
    thanx for your reply.
    ya i have "commons-logging-1.0.2.jar" file but when i tried to put it with other jar files and set the class path and run the application thru tomcat then it automatically stops the tomact.and when i removed this perticular logging jar file then tomcat works normally but gives the error which i mentioned before.
    i have also tried the second option u suggested, by putting the LogFactory class files in "C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\org\apache\commons\logging" but that was not working.shud i set some classpath for them? or shud i have to import these packages........ but when i copied this folder "org" to C:\Program Files\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes and in program wrote import org.* then copilation error occured "no such package found.
    what to do now.
    manish

  • JSP/Servlet/Bean help

    Pretty new to java and I am getting an error that I have tried to figure out for a few days here and ... well... not getting far.
    I have a servlet that calls one of two jsp pages depending on GET or POST. index.jsp is called on GET and works fine. On POST the servlet gets a db pool connection does a quick select count(*) query and then populates a bean with the results. This all works fine (as I have system.out.println's showing me the results)
    But when it forwards to the next jsp page the page bombs out because it can't seem to find the Bean.
    The error is below.
    my set up is Tomcat 4.x
    the main servlet AECPhoneServlet is in ...webapps/damn/WEB-INF/classes
    the bean (QueryBean) is in ...webapps/damn/WEB-INF/classes/com/phone
    jsp's are in ...webapps/damn
    web.xml looks like this
    <?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>
    <servlet>
    <servlet-name>AECPhoneServlet</servlet-name>
    <servlet-class>AECPhoneServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>AECPhoneServlet</servlet-name>
    <url-pattern>/AECPhone</url-pattern>
    </servlet-mapping>
    </web-app>
    Classpath is
    echo $CLASSPATH
    :/usr/tomcat/jakarta-tomcat-4.1.24/webapps/damn/WEB-INF/classes/com/phone:.:/usr/tomcat/jakarta-tomcat-4.1.24/common/lib/servlet.jar
    I am beating my head against the wall here. Any and all help would be greatly appreciated. Assume I know nothing. lol. Because basically I don't.
    ype Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /rs.jsp
    Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:8: package com does not exist
    [javac] import com.phone;
    [javac] ^
    [javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:45: cannot resolve symbol
    [javac] symbol : class TestBean
    [javac] location: class org.apache.jsp.rs_jsp
    [javac] TestBean tBean = null;
    [javac] ^
    An error occurred at line: 2 in the jsp file: /rs.jsp
    Generated servlet error:
    [javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:47: cannot resolve symbol
    [javac] symbol : class TestBean
    [javac] location: class org.apache.jsp.rs_jsp
    [javac] tBean = (TestBean) pageContext.getAttribute("tBean", PageContext.PAGE_SCOPE);
    [javac] ^
    An error occurred at line: 2 in the jsp file: /rs.jsp
    Generated servlet error:
    [javac] /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/damn/rs_jsp.java:50: cannot resolve symbol
    [javac] symbol : class TestBean
    [javac] location: class org.apache.jsp.rs_jsp
    [javac] tBean = (TestBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TestBean");
    [javac] ^
    [javac] 4 errors
         at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
         at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
         at AECPhoneServlet.doPost(AECPhoneServlet.java:56)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:536)

    my set up is Tomcat 4.x
    the main servlet AECPhoneServlet is in
    ...webapps/damn/WEB-INF/classes
    the bean (QueryBean) is in
    ...webapps/damn/WEB-INF/classes/com/phone
    jsp's are in ...webapps/damn
    /usr/tomcat/jakarta-tomcat-4.1.24/work/Standalone/local
    ost/damn/rs_jsp.java:45: cannot resolve symbol
    [javac] symbol : class TestBean
    [javac] location: class org.apache.jsp.rs_jsp
    [javac] TestBean tBean = null;
    [javac] ^
    I don't know if this is a typo, but above you say the class name is QueryBean. However, the compiler errors refer to a class called TestBean.

  • Compiling a Servlet that uses JavaBean

    I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
    --------------------Configuration: JDK version 1.3 <Default>--------------------
    Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
    Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean = (SimpleBean) session.getAttribute
    ^
    ("simpleBean");
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
    ^
    2 errors
    Process completed.
    Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

    Looks like an import Problem.
    The Compiler is not able to "see" the SimpleBean Class.
    Take care of the Classpath and your imports.
    Happy Coding. :-)

  • How to compile a servlet

    I am trying to compile a servlet using the import javax.servlet.*;
    import javax.servlet.http.*; packages. But the only thing I keep getting is :
    BasicServlet.java:1: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    BasicServlet.java:2: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    BasicServlet.java:6: cannot resolve symbol
    symbol : class HttpServlet
    location: class BasicServlet
    public class BasicServlet extends HttpServlet
    I have included the servletapi2_1_1-win package from the sun site containing the servlet.jar in my classpath. Still it refuses to compile. Besides does anybody know how to compile using the servlet packages available in Tomcat or j2ee, both of which I have on my machine , but can't figure what to include.
    Please help.
    ^

    have you actually included the servlet.jar file in your classpath or just the directory, as you need to explicity declare jar files in the classpath...
    javac -classpath %CLASSPATH%;C:\[servlet-jar-path]\servlet.jar Servlet.class

Maybe you are looking for