'Hello world' servlet with Sun Java System Application Server

Discussion in 'Java' started by Thomas Armstrong, Oct 2, 2007.

  1. Hi.

    I'm trying to create a simple "Hello World" servlet to be served with
    Sun Java System Application Server Platform Edition 8.2.

    I installed it ok on Linux:
    /opt/SUNWappserver/
    http://localhost:8080 works fine
    http://localhost:4848 works fine

    But I'm not able to fin the way to serve my 'HelloWorld' servlet:
    -------
    import java.io.*;

    import javax.servlet.http.*;
    import javax.servlet.*;

    public class HelloServlet extends HttpServlet {
    public void doGet (HttpServletRequest req,
    HttpServletResponse res)
    throws ServletException, IOException
    {
    PrintWriter out = res.getWriter();

    out.println("Hello, world!");
    out.close();
    }
    }
    --------------

    No idea about where to copy it or how to modify 'web.xml' file.

    Any suggestion?
     
    Thomas Armstrong, Oct 2, 2007
    #1
    1. Advertising

  2. Thomas Armstrong

    Lew Guest

    Thomas Armstrong wrote:
    > Hi.
    >
    > I'm trying to create a simple "Hello World" servlet to be served with
    > Sun Java System Application Server Platform Edition 8.2.
    >
    > I installed it ok on Linux:
    > /opt/SUNWappserver/
    > http://localhost:8080 works fine
    > http://localhost:4848 works fine
    >
    >
    > No idea about where to copy it or how to modify 'web.xml' file.
    >
    > Any suggestion?


    <http://java.sun.com/javaee/5/docs/tutorial/doc/bnadx.html#bnadz>

    --
    Lew
     
    Lew, Oct 2, 2007
    #2
    1. Advertising

  3. Thomas Armstrong

    mkw

    Joined:
    Aug 20, 2008
    Messages:
    4
    Hi,

    Has anybody managed to get this simple HelloWorld servlet to work on Sun Java System Application Server 9.1_02 (build b04-fcs) ?

    I can deploy it and send request to it, but all I get in response is a web page from the Application Server titled "Directory Listing For /".

    I've tried deploying both as simple .class file and also in a .war file - both with same result. Also, I could not get the Web Applications deployment to work properly from the admin console, but dropping it in the autodeploy folder is OK.

    Thanks for any help on this.
    MKW
     
    mkw, Aug 20, 2008
    #3
  4. Thomas Armstrong

    mkw

    Joined:
    Aug 20, 2008
    Messages:
    4
    Hi,

    OK - finally, I got it to work!

    MKW
     
    mkw, Aug 21, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page