I have a problem compiling servlets bymeans of NetBeans IDE 3.6.

If I compile a servlet by means of another IDE, they are oK and work well with NetBeans too.
On the contrary, if I compile it bymeans of Netbeans 3.6, I get a .class which does not work. I
have realized also that for instance if the .class i get with the other IDE is 1,58 KB, if I use
NetBeans I get a .class smaller, that is 1,53 Kb.
Can you help me?
Thanks
Eugenia Mariani

ok
This is the servlet named Contatore.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Contatore extends HttpServlet
private int conta;
public void init(ServletConfig config) throws ServletException
conta = 0;
public void doGet(HttpServletRequest richiesta, HttpServletResponse risposta)
throws IOException, ServletException
conta++;
risposta.setContentType("text/html");
PrintWriter out = risposta.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Pagina con contatore</title>");
out.println("</head>");
out.println("<body>");
out.println("Questa pagina e' stata visualizzata");
out.println("<h1>"+conta+ "</h1> volte.");
out.println("</body>");
out.println("</html>");
out.close();
Before using the compiler of NetBeans (that is after getting Contatore.class by means of Bluej) when I use Execute I see in Internet Explorer 6.0 with win Xp Pro at the
http://localhost:8084/esempi/Contatore
Questa pagina e' stata visualizzata
1
volte.
and Contatore.class is 1,58 KB
After that I use the compiler of NetBeans when I use Execute here the error from Tomcat 5.0
I see in Internet Explorer 6.0 with win Xp Pro at the
http://localhost:8084/esempi/Contatore
HTTP Status 404 - Servlet Contatore is not available
type Status report
message Servlet Contatore is not available
description The requested resource (Servlet Contatore is not available) is not available.
Apache Tomcat/5.0.19
and Contatore.class is 1,53 KB
I hope to have said everything
I wait a help, please.
Thanks

Similar Messages

  • Problem compiling servlet

    I have IIS5 and Jrun and jdk1.3.1. Im trying to compile a basic servlet for the first time....
    I get errors regarding the Http....here is the code.....
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld extends HttpServlet {
         public void doGet (HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException
              PrintWriter out = response.getWriter();
              out.println("<HTML>");
              out.println("<HEAD>");
              out.println("<TITLE>");
              out.println("An HTML Hello World");
              out.println("</TITLE>");
              out.println("</HEAD>");
              out.println("<BODY>");
              out.println("<H1>Hello World</H1>");
              out.println("</BODY>");
              out.println("</HTML>");

    I didnt find the servlet.jar in the Jrun dir. I'm still a newbie obviously so any more help either of you can give would be appreciated. Thanks
    BTW, the code is taken from the book JSP Weekend Crash Course, so if the code is wrong then I dont know how to fix just yet.

  • Since updating to ios7 i keep getting requests to enter my password for yahoo mail, my email account, and the itunes account details too. The email is connected though and i have no problem receiving new emails. Any ideas ?

    ...I am also concerned as I found an email in my sent items today to someone i have never heard of before....saying hello. I suspect this might mean the problem is the yahoo account maybe hacked but I have no idea....thanks, Stewart

    It sounds as if your account has been compromised. I would recommend logging into those accounts from your computer and their websites and changing your password.

  • Problems compiling with packages

    Hi,
    I wonder if anyone could help me.
    I have had problems compiling using a package. I have altered the classpath in autoexec.bat with:
    SET CLASSPATH=%classpath%;C:\jdk1.3.1_02\classes;.
    the package class files are stored in C:\jdk1.3.1_02\classes\helliker\id3
    and I have imported the class with:
    import helliker.id3.*;
    I am getting the following error:
    C:\My Documents\Uni work\mp3 project\test\Driver.java:1: package helliker.id3 does not exist
    import helliker.id3.*;
    ^
    Can anybody help?
    Thanks,
    Dave

    Perhaps the version of Windows you are using does not use autoexec.bat. For example, in NT and XP, you set Classpath using ControlPanel/System/Advanced/Environment Variables.
    Perhaps there is a typo in your Classpath, for example an extra space.
    On a command line, try this:
    javac -classpath C:\jdk1.3.1_02\classes C:\My Documents\Uni work\mp3 project\test\Driver.java
    If that works, then definitely Classpath is not set as you think it is.

  • Problem with netbeans IDE

    hey! i am a learner of j2se 5.0 and am horrible at command line compiling. so i use netbeans IDE and well it has been doing excellently till now.
    recently i had a porblem with ImageIcons and i found the exact problem which i was having but with repect to applets , that is, the images were not displaying properly. i have managed to solve the problem as far as applets are concerned, but it is not so with applications.
    the thing is when i use the run function of the IDE, it displays all icons perfectly and its as if nothing is wrong.
    it creates a .jar file which when i separately click to execute by going to its folder, does so but does not display any images. In fact it executes and behaves in such a way that it's exactly as if i have not used icons in the program- it displays everything else. should i change some setting of the IDE? but if some setting is to be changed, y is it running normally when run from the IDE( F6 key).
    also when i used the command line (after some research to learn to use it) to extract all files from the .jar file, all the images were in it!!!as well as all the class files. so i can't even say that the IDE has not bundled up the images into the .jar file.
    could some1 please help??i need help with .jar files and not applets.

    first i deefined a method as shown in the Java tutorial
    ImageIcon icon =createImageIcon("lion.jpg","name");
    ( within the contructor of the class)
    then after completing the constructor for the class- (I am trying to display an ImageIcon on the background of a JFrame)
    i provided the following definition after the constructor and b4 the main method:
    protected static ImageIcon createImageIcon(String path,
    String description) {
    java.net.URL imgURL = LabelDemo.class.getResource(path);
    if (imgURL != null) {
    return new ImageIcon(imgURL, description);
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    this is what i did-and when run from the IDE-it is perfect, but the jar file ggenerated when executed displays every single thing-all swing components e.t.c EXCEPT the image
    the image is in the same folder as the source file- i checked because if not, an error is indicated- so that is not the problem here.
    this same exact code works perfectly with applets and they execute perfectly both from the IDE and also when executed separately.
    the same problem also iccurs when trying to display on labels and buttons.(only for JFrames not for JApplets)
    the thing is in the java tutorial the method is given for applets and so my applets worked -so is there somethin i'm missing for frames- as far as i know they r very similar as far as usage is concerned.

  • Problem during installation of EHP4 on IDES with preinstalled EHP3

    I have a problem during installation of EHP4 on IDES with preinstalled EHP3(I got it with media sent last year in april).
    Namely during PREP_EXTENSION/EHP_INCLUSION! phase i got error:
    Severe error(s) occured in phase PREP_EXTENSION/EHP_INCLUSION!
    Last error code set: Component 'WEBCUIF' not found
    When checking components of ECC system I did not found 'WEBCUIF' component whereas in xml file (generated by SOLMAN) it exists. Which direction I should take. I am afraid to delete entries in xml file.
    I need help

    When checking components of ECC system I did not found 'WEBCUIF' component whereas in xml file (generated by SOLMAN) it exists. Which direction I should take. I am afraid to delete entries in xml file.
    You need to download and install all requirements as selected by Solution Manager for EHP4, WEBCUIF is a required component. Do not delete any entries in the xml file.
    Nelis

  • Problem with NetBeans IDE 5

    Hi All,
    I' m using NetBeans IDE 5 . Present my IDE works fine with J2SE. I would like to work with Servlets. There is an error while using servlet classes.
    Is this Installing problem ? or
    am i add servlet.jar for NetBeans IDE 5?
    Plase any one help me..................

    Right click on the library tab under your project in the projects window and click "add library". Servlet should be on the list.
    If not, check your installed modules and make sure servlet support is included.

  • Having problems compiling *.java with import javax.servlet.jsp......

    I've been trying to do the tutorials in a book titled Apache Jakarta-Tomcat as part of my introduction to JSP. I'm new to Java but do know the basics. I have on my machine Java 1.3, Java 1.4, Java FrameWorks 2.1 and Jython 2.1 on Win2000 Pro. So enough about my configuration. I have never worked with packages also.
    I downloaded the files from the books site due to the fact I make a lot of typos when hand coding Java (I've become a pretty good debugger of my own code). But everytime I go to compile the *.java I get error messages. So below you will find HelloTag.java and beneath that the error messages that are thrown when I try and compile it. I tested other bits of *.java and have had no problem compiling them. Is there a JSP module I'm missing?
    Am I doing something wrong or am I missing something from my configuration.
    Marijan Madunic
    package chapter2;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.JspTagException;
    import javax.servlet.jsp.tagext.TagSupport;
    public class HelloTag extends TagSupport
    public void HelloTag() {
    // Method called when the closing hello tag is encountered
    public int doEndTag() throws JspException {
    try {
    // We use the pageContext to get a Writer
    // We then print the text string Hello
    pageContext.getOut().print("Hello");
    catch (Exception e) {
    throw new JspTagException(e.getMessage());
    // We want to return SKIP_BODY because this Tag does not support
    // a Tag Body
    return SKIP_BODY;
    public void release() {
    // Call the parent's release to release any resources
    // used by the parent tag.
    // This is just good practice for when you start creating
    // hierarchies of tags.
    super.release();
    D:\Java\JDK 1.3\bin>javac HelloTag.java
    HelloTag.java:3: cannot resolve symbol
    symbol : class JspException
    location: package jsp
    import javax.servlet.jsp.JspException;
    ^
    HelloTag.java:4: cannot resolve symbol
    symbol : class JspTagException
    location: package jsp
    import javax.servlet.jsp.JspTagException;
    ^
    HelloTag.java:5: cannot resolve symbol
    symbol : class TagSupport
    location: package tagext
    import javax.servlet.jsp.tagext.TagSupport;
    ^
    HelloTag.java:7: cannot resolve symbol
    symbol : class TagSupport
    location: class chapter2.HelloTag
    public class HelloTag extends TagSupport
    ^
    HelloTag.java:14: cannot resolve symbol
    symbol : class JspException
    location: class chapter2.HelloTag
    public int doEndTag() throws JspException {
    ^
    HelloTag.java:20: cannot resolve symbol
    symbol : variable pageContext
    location: class chapter2.HelloTag
    pageContext.getOut().print("Hello");
    ^
    HelloTag.java:24: cannot resolve symbol
    symbol : class JspTagException
    location: class chapter2.HelloTag
    throw new JspTagException(e.getMessage());
    ^
    HelloTag.java:28: cannot resolve symbol
    symbol : variable SKIP_BODY
    location: class chapter2.HelloTag
    return SKIP_BODY;
    ^
    HelloTag.java:37: cannot resolve symbol
    symbol : variable super
    location: class chapter2.HelloTag
    super.release();
    ^
    9 errors

    Well, it looks like you've not got the servlet development kit JAR on your classpath. I think it'll probably be called servlet.jar on your system. Add that to the classpath if it's not already there.
    Incidentally, you've bumped into one of the areas Java's slightly lenient - declaring a method that looks like a constructor:
    public HelloTag() { }
    public void HelloTag() { }The first is a constructor, the second is a normal method. I'm assuming you intended to have the former instead of the latter.
    Anyway, hope this helps.

  • Problem in Servlet Compilation & Deployment

    Hi Friends,
    I have problem regarding Servlet Compilation & Deployment.
    At the time of compilation gives error message "import javax.servlet.* is not a recognize package.
    My J2ee Server gives FATAL Error it says it should be work on JDK1.2 or later.
    My JDK is :-j2sdk1.4.2_04
    MY J2EE Server is:-j2sdkee1.2.1
    My Servlet Runner is:-JSDK2.0
    My Java Enviorment is:- Version 1.5.0 (build 1.5.0_04-b05)
    Path setting is:-
    Class Path=C:\j2sdk1.4.2_04\lib;C:\j2sdkee1.2.1\lib\j2ee.jar;C:\JSDK2.0\lib
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=DCL-04
    ComSpec=C:\WINNT\system32\cmd.exe
    Please help me and give the desired result as soon as you all can
    Your's Harish
    Thanks

    At the time of compilation gives error message "import javax.servlet.* is not a recognize package.You have to include servlet.jar or j2ee.jar in the classpath when compiling.
    My JDK is :-j2sdk1.4.2_04
    My Java Enviorment is:- Version 1.5.0 (build 1.5.0_04-b05)Why are the versions of your JDK and Java runtime environment different? Why are you not using Java 5 to compile and run everything?
    Class Path=C:\j2sdk1.4.2_04\lib;C:\j2sdkee1.2.1\lib\j2ee.jar;C:\JSDK2.0\libIf this is an environment variable, it should be "classpath", not "Class Path" with a space in between.

  • Compiling Servlet problem that uses a 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.

    Hi,
    The problem is it is not finding the Bean. Put it in the classpath.
    The simplest way is put the class in /WEB-INF/classes/MyPackage folder.

  • Problem compiling HelloWorld servlet

    Hello,
    I'm trying to compile a "Hello World" servlet in Tomcat that I copied straight out of the book. The code is as follows:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld1 extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<body>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("</body>");
    out.println("</html>");
    However, neither HttpServlet, HttpServletRequest, HttpServletResponse, or ServletException are being recognized. In each case, the message I'm getting from the compiler is "cannot resolve symbol." I'm finding this whole situation very distressing. If someone could help me out, I'd greatly appreciate it.
    Thanks,
    Adam

    well i have tried out both Servlets and JSPs in Windows 98 and i did not get the problem you have mentioned, i am using Jakarta Tomcat 3.2.1, and i have set the classpath to servlet.jar, actually this file is present within the jakarta-tomcat-3.2.1\lib directory and i suppose the classpath is automatically set as u run the startup.bat file. What you can try is, while setting the TOMCAT_HOME and ANT_HOME in the autoexec.bat, try doing it using the old dos 8.3 file naming style, for eg.
    set JAVA_HOME=C:\jdk1.3
    set TOMCAT_HOME=c:\jakart~1.1
    set ANT_HOME=c:\jakart~1.1
    then try running the example again.

  • Problem when trying to compile servlets!

    Hi,
    Can someone help me with my problem.
    I have installed jakarta-tomcat-1.4.27 after instructions from the book 'Core Servlets and JavaServer Pages' but I have one problem. When I compile a servlet I get the following message:
    C:\Apache-Tomcat-4.1.27\jakarta-tomcat-4.1.27\webapps\ROOT\WEB-INF\classes>javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloServlet.java:13: cannot 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
    What is the problem, and how will i fix the problem? I think there is some problem with the CLASSPATH, but I don't now what!
    My classpath looks as follows:
    set JAVA_HOME=C:\j2sdk1.4.1_01;CLASSPATH=.;C:\ServletDevel;C:\Apache-Tomcat-4.1.27\jakarta-tomcat-4.1.27\common\lib\servlet.jar
    N.B. I use Java version j2sdk1.4.1_01!

    OK, I have tried to do this but it does n't solve my problem. Maybe my problem is that I don't put my environment variables in a proper way (my windows knowledge is not the best). How will I set this variables in a proper way? I use windows XP Pro.
    Now I have put all my variables in one row as follows:
    Variable name: set
    Variable value: JAVA_HOME=C:\j2sdk1.4.1_01;CLASSPATH=.;C:\ServletsDevel;C:\Apache-Tomcat-4.1.27\jakarta-tomcat-4.1.27\common\lib\servlet.jar;C:\j2sdk1.4.1_01\bin
    Is this correct, or how will I make this in a proper way?
    N.B. I must restart my computer each time I have changed my settings, isn't that right?

  • Problems Compiling javax.servlet and javax.servlet.http

    When I try to compile a program that imports both javax.servlet and javax.servlet.http, the compiler keeps telling me that "package javax.servlet does not exist"... I have place the javax.servlet packages in the src.zip and in the src folder but i dont understand why the compiler isnt picking them up. Maybe I did something wrong ... could someone help please

    Try to compile vith the option "-classpath /your/path/to/servlet.jar"

  • Problems compiling a servlet

    Hello,
    I recently installed Tomcat 4.1.24 and I am trying to compile a servlet but with no success. The error I get is package javax.servlet does not exist. I have set up jdk1.3.1-3 and the environment paths. I have been successful in compiling regular java applications. I am currently just using the dos prompt and command line c:\javac somefile.java
    When I tried to compile a servlet, I ran into the javax.servlet error so I found a javax.jar file and added it to the jdk1/3/1-3\lib directory but the compile still fails.. I even tried to add it to the environment path but that still doesn't work...
    could someone tell me where I would need to add the javax.jar file? and what adjustment I need to make to be able to compile servlets?
    thanks in advance for any help
    gjcat777

    You need to get J2EE (Java 2 Enterprise Edition). Download it and install it. It's basically a couple of JAR files that you need to use. Under $J2EE_HOME/lib there is a file called J2EE.jar Include that JAR file into your project and carry on with your servlet development.

  • Problems compiling and running a servlet

    I have been trying to compile and run my servlet program to no avail. Please help. I am using Tomcat 5.5 and j2sdk1.4.2
    These are the errors I keep getting. I have already set the classpath appropriately.
    MyServletTest.java:5: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    MyServletTest.java:6: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    MyServletTest.java:10: cannot resolve symbol
    symbol : class HttpServlet
    location: class MyServletTest
    public class MyServletTest extends HttpServlet {
    ^
    MyServletTest.java:13: cannot resolve symbol
    symbol : class HttpServletRquest
    location: class MyServletTest
    public void doGet (HttpServletRquest req, HttpServletResponse resp)
    ^
    MyServletTest.java:13: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class MyServletTest
    public void doGet (HttpServletRquest req, HttpServletResponse resp)
    ^
    MyServletTest.java:48: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class MyServletTest
    private void printResultSet (HttpServletResponse resp, ResultSet rs)
    throws SQLException {
    ^
    MyServletTest.java:52: cannot resolve symbol
    symbol : method prinln (java.lang.String)
    location: class java.io.PrintWriter
    out.prinln("<html>");
    ^
    7 errors

    Thank you. I have managed to compile the program but
    when I run it I get:
    Exception in thread "main"
    java.lang.NoSuchMethodError: main
    How should I run a servlet?Servlets are not run like applications. You need to deploy them to a servlet container, and they get invoked and initialized by constructor, init() method and goGet/doPost().

Maybe you are looking for