Servlet HelloWorld

I am new in servlet , so I am trying to run HelloWorld example but I couldn't success till now:
this is my servlet example 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("Hello World");
I compiled successufly ,
and this is the web.xml
<!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>hello</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
I am using t omcat , I did put the compiled class on : C:\Tomcat 4.1\webapps\ROOT\WEB-INF\classes
afetr that i runed tomcat then
http://localhost:8080/WEB-INF\classes\HelloWorld
but there is an error : description The requested resource (/WEB-INF/classes/HelloWorld) is not available.
any help :)

I did read the documentation , and i flowed all steps but it doesn't work, so i think the task of this forum is to exchange knowledge !!
i did change the xml file and i did get new error
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
Cannot allocate servlet instance for path /servlet/HelloWorld
any help

Similar Messages

  • How to Run a simple servlet "HelloWorld.java" in JBoss 3.0 ?

    Dear all,
    I am a beginner and I want to run a simple "HelloWorld.java" servlet .
    I need to use JBoss 3.0 .
    After I run this simple servlet, I need to use EJB-Servlet-JSP to implement MVC .
    I have the servlet code and I am able to compile it.
    But I dont know how to proceed as to where to put the class files , where do I specify an alias for my servlet and what modifications I need in Web.xml,Jboss.xml,Application.xml ?
    I do not anything about tools like Ant or Xdoclet so need to proceed without them.Please alos let me know where I can fond complete info about Ant and Xdoclet .
    Thanx in Advance,
    Sujith

    I am not sure of the JBoss package that you are using. If you are using the JBoss-Tomcat package, here's the solution. Create either a .war file or create a directory with the name <your-webapp>.war under <jboss-root>/server/default/deploy. If you are creating a war file, you have to place that war file in the same directory. JBoss-Tomcat will keep looking at this directory for new files or updates to files and deploys/re-deploys as required.
    The contents of the war file should be something like this.
    WEB-INF - directory
    WEB-INF/classes - your servlet classes
    WEB-INF.web.xml - your configuration. Here you can specify the servlet name, class and URI mapping.
    Now, you can call your servlet using the browser in this way: http://localhost:8080/<your-webapp>/servlet/<servlet-alias>. Here the <your-webapp> is the prefix of the .war file.
    Resources:
    Ant - http://jakarta.apache.org/ant/
    Xdoclet - http://xdoclet.sourceforge.net/

  • My HelloWorld servlet just dont want to work

    Hi,
    I know that there's many posts about this issue but still it doesn't want to work for me :(
    i made this HelloWorld.java file with this code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld 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("<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>");
    }then i made these steps:
    - compiled this file to HelloWorld.class
    - shutdown the tomcat server (4.1.31)
    - copied the file to c:\<tomcat dir>\webapps\ROOT\WEB-INF\classes
    - started the server again
    - launch the url : http://localhost:8080/servlet/HelloWorld.
    still i keep getting this annoying message: "The requested resource (/servlet/HelloWorld) is not available."
    i tried to launch this servlet on tomcat 5.5 but still the same annoying message.
    remark: when i launch http://localhost:8080/ i do see the tomcat homepage telling me that the setup went well, and when im trying to launch the servlet's example that came with the installation they work too.
    What am I missing here?

    hmmm... there's a little problem.
    i don't have any servlet.xml file,
    not in tomcat 5.5 nor 4.1.31.
    what should i do?edit server.xml
    And the proper way as already mentioned is to name the servlets in the web.xml file and use packages for your servlets.

  • Beginner's Stuff - HelloWorld Servlet

              Here's my net to nothing DD.
              <?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>HelloWorld</servlet-name>
                        <servlet-class>HelloWorldServlet</servlet-class>
                   </servlet>
              </web-app>
              The WebApp Name is Hello
              Whatever I do (hostname:port/Hello/HelloWorld or hostname:port/Hello/servlet/HelloWorld
              - This one run fine on Tomcat), I keep getting 404.
              What Wrong ??? Somebody help before I go crazy.
              Thanx.
              

              You need to have a
              <servlet-mapping>
              <servlet-name>servlet</servlet-name>
              <url-pattern>/*</url-pattern>
              </servlet-mapping>
              see http://e-docs.bea.com/ for details :)
              "Lindsay Chap" <[email protected]> wrote:
              >
              >Here's my net to nothing DD.
              >
              ><?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>HelloWorld</servlet-name>
              >           <servlet-class>HelloWorldServlet</servlet-class>
              >     </servlet>
              ></web-app>
              >
              >The WebApp Name is Hello
              >Whatever I do (hostname:port/Hello/HelloWorld or hostname:port/Hello/servlet/HelloWorld
              >- This one run fine on Tomcat), I keep getting 404.
              >
              >What Wrong ??? Somebody help before I go crazy.
              >
              >Thanx.
              

  • Running HelloWorld Servlet--Tomcat 4.1

    Dear Sir,
    With most humble submission I would like to inform you that I have recently downloaded Tomcat 4.1 from http://jakarta.apache.org/ and installed it on Windows 98. I am using jdk1.3
    I am an amateur for Java Servlets. I am following the instructions given in the book "Java Servlet Programming" by O'reilly and according to this book I have to store my class files(I tried with HelloWorld.class) in the dir server_root/webapps/root/web-inf/classes dir. but when i called it from microsoft internet explorer 5.0(the browser i am using currently) using the URL http://localhost:8080/servlet/HelloWorld
    I get the 404 error.
    I also tried to call a static file (.html) by storing it in the dir server_root/webapps/root(according to the book) and i get the proper output but not in case of .class file. Even the example codes provided with the server do not run.
    Please help me to fix out my problem.
    Thanking you in anticipation,
    Yours sincerely
    roopesh

    Hi:
    1)You need set classpath
    2) do you open your Tomcat?
    Thank

  • HelloWorld servlet help !

    Hi,
    I compiled the simple HelloWorld.java and put it under /jakata-install-dir/webapps/webapp1/WEB-INF/classes/HelloWorld.class
    Then, started the tomcat and this
    http://localhost:8080/webapp1/servlet/HelloWorld
    gave 404 error ??? file not found ???
    Pls help. thanks.
    P

    I agree tomcat is fussy !!!
    Yes, the webapps/examples/WEB-INF/classes works, but
    I want to create a new application name say webapp1 to replace the name of "examples" above, then it failed !
    I guess there must be some configuration needed to add a new application name after /install-dir/webapps/ ?
    Moreover, I can't even log into administration page without the username and password. Cant found them ?!
    P

  • HelloWorld Servlet Problem

    Hi,
    I recently wanted to try my hands on servlets.
    I downloaded the eclipse J2EE ST (jst). I copied all the plugins and feature in to eclipse.
    I created a Dynamic Web Project > New J2EE Project
    Then I created a servlet HelloWorld.java, Now in the eclipse environment I keep getting this problem message
    The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files     HelloWorld.java     EDaFS_Web/JavaSource     line 1     April 7, 2005 12:13:50 PM
    I can compile it at the prompt and the servlet does work in
    localhost:8080/EDaFS_Web/HelloWorld
    But I would like to remove this error.
    Thanx in advance
    Venky

    i am having the follwoing error... pls any one help me
    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
    1. The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
    public class report1_1195628974_967 extends JREvaluator
    <--------->
    1 errors
         at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193)
         at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
         at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:212)
         at com.amslogic.reports.BolReports.doGet(BolReports.java:111)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:177)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)

  • Having problem running a servlet program in Tomcat5.5

    Hi,
    I wrote a sample servlet, HelloWorld.java and I compiled it and put the .class file in the WEB-INF\Classes directory in the Tomcat directory. Now when I do this,
    http://localhost:8080/ it's working fine but when I do this, http://localhost:8080/servlet/HelloWorld I am getting an error message "*HTTP Status 404"*.
    I have done no changes to web.xml and server.xml. Should I be doing anything?
    My HelloWorld.Java file is as below.
    package Users.Ravi.Desktop.CurrentProject.Servlets;
    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("Hello World");
    }Thanks.

    Ah, I see the problem now. You need to put servlet class as
    <code class="jive-code jive-java">Users.Ravi.Desktop.CurrentProject.Servlets.HelloWorld</code>
    <code class="jive-code jive-java">So, your web.xml will have</code>
    <servlet>
         <servlet-name>HelloWorld</servlet-name>
         <servlet-class></code><code class="jive-code jive-java">Users.Ravi.Desktop.CurrentProject.Servlets.HelloWorld</code><code class="jive-code jive-java"></servlet-class>
    </servlet>{code}

  • Tomcat 6 – Calling a  Java Servlet from a JSP Page

    Below is a very simple JSP Page that calls a Java Servlet. The question is given Tomcat security constraints, is it possible to call a servlet from a JSP and get the correct output without getting an error message? If so, how would you code the web.xml file?
    c:\apache-tomcat-6.0.18
    Under conf
    catalina
    localhost
    HelloWorldExample.xml is directly under localhost
    The application would have this directory structure:
    webapps
    HelloWorldExample
    hello.jsp is directly under HelloWorldExample
    Under HelloWorldExample
    src
    WEB-INF
    classes
    Under classes
    jservlets
    HelloWorld.java is in src folder
    HelloWorld.class is in jservlets folder
    HelloWorldExample.xml
    <Context path="/HelloWorldExample" docBase="HelloWorldExample" debug="0"
          reloadable="true" crossContext="true">    
    </Context>**************************
    hello.jsp
    <HTML>
    <HEAD>
    <TITLE>Hello</TITLE>
    </HEAD>
    <BODY>
    <FONT SIZE="4">
    <P>
    Please enter your name:
    <FORM 
       METHOD="Post"
       ACTION="servlet/jservlets.HelloWorld">
    <TABLE BORDER="3" CELLPADDING="1" WIDTH="100%" ALIGN="CENTER">
    <TR>
        <TD><B>Name:</B></TD>
        <TD><INPUT TYPE="text" NAME="Name" VALUE="" SIZE="65"> </TD>      
    </TR>
    </TABLE>
    <P>
    <INPUT TYPE="SUBMIT" VALUE="Submit">
    </FORM>
    </FONT>
    </BODY>
    </HTML>******************
    HelloWorld.java
    package jservlets;
    import java.io.*;
    import java.util.Date;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld extends HttpServlet
       PrintWriter out;
       PrintWriter err; 
       String strName;
    public void displayMessage(HttpServletRequest request, HttpServletResponse response)
          throws Exception
             try
                if (!strName.equals("") && strName != null)
                   out.println("Hello " + strName + "" + "<P>");
                    out.println("Hello World" + "<P>");
                else
                    out.println("Hello World" + "<P>");
            catch (Exception e)
                out.println("Exception: Could not display message." + "<P>");
                err.println (e.getMessage () ) ;
                out.println("<P>");
    public void doPost(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException
          try
               response.setContentType("text/html"); 
               out = response.getWriter();
               err = response.getWriter();
               strName = request.getParameter("Name").trim();
               out.println("<html><head><title>");        
              out.println("</title></head><body>");
               out.println("<FORM");
               out.println("METHOD=POST");
               out.println("ACTION=http://localhost:8080/HelloWorldExample/hello.jsp>");
             out.println("<TABLE ALIGN='RIGHT'>");
             out.println("<TR>");
             out.println("<TD>");          
               out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Hello World Page\";>");
               out.println("</INPUT>");
              out.println("</TD>");
             out.println("</TR>");
             out.println("</TABLE>");
             out.println("</FORM>");
             out.println("<BR CLEAR='all'>");
               out.println("<P>");        
               displayMessage(request, response);
               out.close();
             out.println("</body></html>");               
           catch(Throwable e)
              e.printStackTrace();
          public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
             doPost(request, response);
    web.xml
    <servlet>
          <servlet-name>HelloWorld</servlet-name>
          <servlet-class>jservlets.HelloWorld</servlet-class>
    </servlet>  
    <servlet-mapping>
            <servlet-name>HelloWorld</servlet-name>
            <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping>      ******************************
    HelloWorld.java can be compiled by using javac.
    Once compiled, HelloWorld.class would be moved to the jservlets folder.
    FYI, coding the above url-pattern results in:
    HTTP Status 404
    The requested resource (/HelloWorldExample/servlet/jservlets.HelloWorld) is not available
    The following url-pattern in the web.xml file permits the servlet to be executed but results in a null pointer exception:
    <servlet-mapping>
            <servlet-name>HelloWorld</servlet-name>
            <url-pattern>/ </url-pattern>
    </servlet-mapping>      **************************************************
    Robin

    This problem was resolved.
    In hello.jsp
    ACTION="servlet/jservlets.HelloWorld">
    was replaced with
    ACTION="servlet/HelloWorld">
    Robin

  • How to publish a servlet class to web server?

    background:
    web server: tomcat apache 4
    context path: webapp\test\
    servlet path: webapp\test\WEB-INF
    servlet name: HelloWorld.class
    i tried to placed the servlet class file to above servlet path,
    but i can't invoke the servlet by http://localhost:8080/test/HelloWorld
    what should i do in order to invoke the servlet at browser?
    Is a web.xml necessary a must to provided a mapping between request name and actual class name?

    First of all you need a *.war structure which look like this
    /app-name
    /app-name/WEB-INF/
    /app-name/WEB-INF/lib
    /app-name/WEB-INF/classes
    When you have created this structure you add your servlet (HelloWorld.class) in the classes directory (Create the package structure first).
    When this is done you need to map the servlet to a given uri which is done in the web.xml. An example is found below:
    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>package.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello/*</url-pattern>
    </servlet-mapping>
    Hopefully this will help :-)
    best regards
    Stig

  • Firing a servlet from the web..

    I am using Win2000 IIS5 and ServletExec. I have configured the server so I can fire up a 'HelloWorld' servlet from the local machine but when I call the servlet from the web i.e. http://www.???.com/servlet/HelloWorld it does not fire. I have configured the virtual server for the web site address.
    any ideas greatly appreciated.
    Nigel

    HelloWorld is the servlet class so no extension. I've tried various ways of firing including referencing the servlet in a html page but always the same result of being able to fire the servlet if I include the server name i.e. http://websrv1/servlet/HelloWorld but not if I use http://www.mysite.com/servlet/HelloWorld.
    Nigel

  • Servlet can't run,Could not find the Main class,but how ?

    well i have made a simple servlet,but when i run it i get the following error.
    C:\jdev903_pre\jdk\bin\javaw.exe -ojvm -classpath C:\jdev903_pre\j2ee\home\oc4j.jar -Doracle.j2ee.dont.use.memory.archive=true com.evermind.server.OC4JServer -config C:\jdev903_pre\jdev\system9.0.3.988\oc4j-config\server.xml
    [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
    [waiting for the server to complete its initialization...]
    java.lang.NoClassDefFoundError: com.evermind.server.OC4JServer
    Exception in thread main
    Process exited with exit code 1.
    kind regards
    Thanks for the very fast response,but how ?
    Can you run your servlet on OC4J standalone directly, to narrow down the problem..
    thanks,
    -Prasad

    A quick way to test would be
    - Assuming you have OC4J standalone installed
    - copy your servlet (HelloWorld.java) file into \default-web-app\WEB-INF\classes
    - compile it
    - run it using the url http://localhost:8888/servlet/HelloWorld
    -Prasad

  • Problem with first servlet

    Hi
    I am trying to run my first servlet HelloWorld
    I have my servlet in the directory
    Tomcat 4.1/webapps/test/web-inf/classes/HelloWorld.class
    and my web.xml file in the directory
    Tomcat 4.1/webapps/test/web-inf/web.xml
    contains the following lines
    <web-app>
    <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
    </web-app>
    I also have changed the conf/server.xml file for the context as follows
         <Context path="/test" docBase="test" debug="0"
    reloadable="true" crossContext="true">
    and now when I try http://localhost:8080/test/servlet/HelloWorld
    Still I am getting the error status 404 The requested resource /test/servlet/HelloWorld not found.
    What am I doing wrong ????
    When I put my HelloWorld.class file in the webapps/examples directory it runs fine.WHy is it so ?
    Also for the above I have not started my tomcat server since I tried to run my HelloWorld from examples using http://localhost:8080/examples/servlet/HelloWorld it works perfect so I think I do not need to start server.
    Please reply me

    Try fully qualifying your servlet-class so that it reads something like this: <servlet-class>examples.servlet.HelloWorld</servlet-class>

  • Deploy of hello world servlet

    I installed Bea Web Logic 6.1 and I wrote a simple servlet HelloWorld to test it but now I explain it better:
    1) I created the directory "c:\prova" where I made a subdirectory "C:\prova\WEB-INF\classes" where I put the .class file of the Servlet.
    2) I made this web.xml:
    <?xml version="1.0"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <servlet>
         <servlet-name>CiaoMondoServlet</servlet-name>
    <servlet-class>CiaoMondoServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>CiaoMondoServlet</servlet-name>
    <url-pattern>CiaoMondoServlet</url-pattern>
    </servlet-mapping>
    </web-app>
    3) I put it in the subdirectory : "C:\prova\WEB-INF"
    4) I made the war file: prova.war (c:\prova> jar cvf prova.war *.*)
    5) I put the war file int his directory :
    "C:\bea\wlserver6.1\config\examples\applications"
    6) I make the server start (The icon "Start Examples Server") and when I try to access this resource:
    http://localhost:7001/prova/CiaoMondoServlet
    It answers :
    Error 500--Internal Server Error
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.5.1 500 Internal Server Error
    The server encountered an unexpected condition which prevented it from fulfilling the request.

    Hi
    I supose that this error due to the server doesn't recognize the application context.
    Please try to deploy the war file using the administrative console and try again.
    Jin

  • Accessing Servlets in Browser

    Hi all
    I am new to servlets and till now everything went well but one thing! :)
    I am trying to access a servlet I did through the browser. When I added the servlet class to the ROOT/WEB-INF/classes dir I could access the servlet by typing http://localhost:8080/servlet/HelloWorld such that HelloWorld is the name of the class. This all went ok and I accessed the servlet with success.
    Now I wanted to put my servlet in another directory. I created a dir called my-servlets under the dir webapps of TomCat 5.
    Inside I created a dir WEB-INF. In the web.xml file I specified the servlet HelloWorld and the mapping. If I try to access the servlet in the browser through the mapping it works fine.
    But if I do http://localhost:8080/my-servlets/HelloWorld and HelloWorld is the name of the class I get an error: The requested resource is not available.
    My question is: If I have my servlet in another dir than the ROOT I cannot access it through the class name? Or am I doing something wrong?
    With best regards,

    Try
    http://localhost:8080/my-servlets/servlet/HelloServlet
    The /servlet/ is a key to a special handler that loads servlets rather than a directory that holds servlet classes.
    Also, make sure that you didn't stuff HelloServlet into a package. If you did, you'll either need a url-mapping in the web.xml file or a fully-qualified classname in the url.
    For example, if HelloServlet is in 'mypackage', you'd use:
    http://localhost:8080/my-servlets/servlet/mypackage.HelloServlet

Maybe you are looking for