How to configure applet/servlet in Tomcat?

I'm building a web application which is going to be deployed in Tomcat. I have an applet(called MYAPPLET here) which "calls" a servlet(called MYSERVLET here). I cannot figure out how to configure the whole thing.
/test is my docbase. In /test I made a directory "applet classes" and a directory "servlet". The applet tag I use in the HTML file looks like this:
<applet
code="MYAPPLET.class"
codebase="http://localhost:8080/test/applet classes/"
<!-- Tell the applet where its peer is located -->
<param
name="servlet"
value="http://localhost:8080/test/servlet/MYSERVLET" />
</applet>
Now, when opening the page, the applet can be found but Tomcat gives an error 404 saying that it can not find the servlet. On the other hand, If I make an entry in my web.xml (with url mapping
<url-pattern>/test </url-pattern> or <url-pattern>/test/servlet </url-pattern>, depending on where I put MYSERVLET)
for the servlet mentioned above and I put the MYSERVLET in either the WEB-INF/classes directory or in /test/servlet Tomcat gives an error 403. It refuses to connect to the servlet!
Please can anyone help me. THanx in advance
debeumers

You are configuring Tomcat and if you have further questions then post new questions in the forum "Java Servlet Technology".
Given that your servlet url is "localhost:8080/test/servlet/MyServlet"
This assumes -
1) You have created a web application called "test". You have a directory called "test" under- $CATALINA_HOME/webapps
2) Your html files, jsp files, and subdirectory "applet-classes" (Note - do Not use spaces when naming directories) exist in this top level directory of your web app. If you choose to place your applet classes in this subdir then the codebase can be "applet-classes" - omitting the "/" means this directory is located relative to the current directory of the html file. (No jar files? No archive param then..)
3) You have a class file called "MyServlet" located - $CATALINA_HOME/webapps/test/WEB-INF/classes
Some versions of Tomcat require you to uncomment out the area of the Mapping for the Invoker Servlet element in $CAT_HOME/conf/web.xml.
<servlet-name>invoker</servlet-name>
<url-mapping>/servlet/*</url-mapping>
Once this is done, you need not create a directory called "servlet" anywhere in your structure. It is the url mapping.
You will want to apply url-patterns and mappings to your application specific web.xml (This is located in - $C_H/webapps/test/WEB-INF) when it comes time to deploy the app, but that is not required for testing and development. You need not make changes to the app specific web.xml at this time just to get the servlet to run.
And finally I suggest you read a book on this subject...

Similar Messages

  • How to configure connection pooling in tomcat?

    how to configure connection pooling in tomcat and how to use the connection pooling in the jsp and servlets?

    thanks for the reply, i have configured the connection pool settings in the tomcat.
    I created a class with static method, which will return the connection object.
    whenever i need the connection object, iam invoking the static method, once its usage is over iam closing thew connection..
    is it the right way of using the connection object in the web application.

  • How to run a servlet in tomcat 5.0.

    Hi all,
    how to run a servlet in tomcat 5.0
    please tell me the entire procedure....(directory structure)
    step by step....

    hi :-)
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
    or
    http://www.google.com.ph/search?hl=en&q=java+servlet+tutorial&btnG=Google+Search&meta=
    regards,

  • How Can I Run Servlet in tomcat

    Hi My Friends
    Please can any one tell me how can I Run Servlet in tomcat using my own Virtual Directory � my ask about , what is the structure it must be make it in the hierarchy of the sub folder of Virtual Directory , and in watch folder it must be put the servlet files and there is any change it must be make it in any file of the tomcat files and so on
    Please give my full details about this thing
    And thanks

    What version of Tomcat are u using?

  • How to run a servlet in Tomcat 5.0 server

    HI Everybody,
    I want to know how to run the servlet file on my tomcat 5.0 server. that is where to place a class file and deployment details.
    Thanks In ADVANCE

    Sourav_cs wrote:
    I am a biginner to start servlet i get confusion to configure servlet in tomcat 5 where it should be saved in tomcat directory and how to execute that as first timeHi,
    goto
    tomcat 5.0\webappsnow create a folder here. this is your webapplication project name. Let's suppose it as "TestApp"
    inside this create directories as follows :
    TestApp
            |
            |-----JSP/htmls( if you have any )
            |
            |-----WEB-INF(File Folder)
                       |
                       |-----web.xml
                       |-----lib ( Directory. place all the .jar files which are required for this project(if any) )
                       |-----classes ( .class files. )[all of your java code should be placed here.](servlets / beans/ pojo )this is the general Directory structure of a web application. now you've to place the compiled .class file of your servlet in the "TestApp\WEB-INF\classes" directory. make sure that you've configured the servlet in Deploment Desctiptor, i.e, web.xml.
    now start the server and type the url like : "http://localhost:8080/TestApp/TestServlet"
    the port no. 8080 is the default port no. of tomcat. you have to give your port no. if u've modified it. and TestServlet is the <url-pattern> of your servlet.
    go through some tutorials .. then you can easily know that
    Diablo

  • How to run a servlet in tomcat

    how i can run a servlet in tomcat?

    how i can run a servlet in tomcat?Don't try to do that yet; in your other thread you have shown that your are
    not capable yet of setting up a proper development environment.
    Take my advice, you can't walk or run yet so start with the basics.
    kind regards,
    Jos

  • How to reach Applet- Servlet- OtherApplet comunication?

    I have reach a Applet<->Servlet<->Applet comunication....it is working very well....
    Now...i wish to reach Applet->Servlet->OtherApplet comunication....
    Applet will send a dataX to Servlet and the Servlet will send that dataX to OtherApplet.
    The OtherApplet would be presented in the same window parent....i know that it could be reached using:
    response.setHeader("Refresh","0; URL=http://212.22.31.12/OtherApplet.html");
    But...how indicate the dataX that i wish to send like input to OtherApplet?
    Somebody has a code example, ideas or suggestions that could help me please?
    Thanks,

    A servlet can only send something as a response to a request. So the servlet couldn't send the information to the second applet until the second applet asked for it, and that means you would have to write your applets so they constantly kept asking the servlet if there was anything new.

  • How to do Applet/Servlet permanent interactive connection

    Hi, I'm modifying an Instant Messaging Application originally implemented under the Applet client/standalone-server scheme that I'm implementing now under the Applet/Servlet scheme using HTTP Tunneling with Object Serialization. But this yet don't work correctly because the connection's flows are closed ever after a Servlet's response to a client request (in this moment are close the connection's flows). I'm using flows of type ObjectInputStream and ObjectOutputStream using Object Serialization with HTTP Tunneling.
    this is part of the connection code in the servlet side:
    public void doGet (HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException{
    doPost( request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException{
    is = new ObjectInputStream(
    new BufferedInputStream(request.getInputStream()));
    try{  
    response.setStatus(HttpServletResponse.SC_OK);
    out = new ObjectOutputStream (
    new BufferedOutputStream (response.getOutputStream ()));
    out.writeObject("OK");
    out.flush();
    // Send the input and output flows to the Thread the Handle the client Connection
    newUser(is, out);
    } catch(Exception ex){
    System.err.println("Exc1: "+ex.toString());
    ex.printStackTrace();
    Run Method to read client request:
    public void run() {
    SocketData sd;
    while ((sd = readObject()) != null) {                               
    sd.performAction(this);
    close();
    After a servlet response in the readObject() method the input flow is closed in the reader request of clients and the connection between the applet (client) and servlet is lost.
    How to can implement a smarter HTTP Tunneling with permanent interactive connection beetween the Applet and Servlet such as in the Applet /server Standalone connection using TCP/IP Socket connection.
    Is possible the use of TCP/IP Sockets in the implementation of HTTP Tunneling with Object Serialization in the Applet/Servlet permanent interactive communication scheme?
    some links or code samples?
    Please show me the ligth.
    Thanks greatly a smarter help.

    I'm not sure that I fully understand your problem, but HTTP is a stateless protocol. That means request-response pairs are completely separated from each other.
    You should ask yourself if you really need to use HTTP and a servlet or if a raw TCP/IP communication would be a better approach to your problem.

  • How to run a servlet in tomcat 5.5

    Hi,iam new to servlets,please help me regarding running a servlet in tomcat 5.5,
    I just want an example servlet to run first,
    the below is the code for the same :-
    //ExampleServlet.java
    package sig;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ExampleServlet extends HttpServlet {
         public void init(ServletConfig config) throws ServletException{
              super.init(config);
         public void service(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
              PrintWriter out = res.getWriter();
              out.println("<HTML>");
              out.println("<BODY>");
              out.println("<p>Hello World</p>");
              out.println("</BODY>");
              out.println("</HTML>");
    I have created a new folder named "SignatureServlet" under the "webapps" folder of tomcat and have created a "WEB-1NF" folder under it,
    again i have kept my "ExampleServlet.class" inside the "WEB-1NF->classes" folder and the entries for my servlet in the "web.xml" file are:-
    <servlet>
    <servlet-name>ExampleServlet</servlet-name>
    <servlet-class>ExampleServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ExampleServlet</servlet-name>
    <url-pattern>/ExampleServlet</url-pattern>
    </servlet-mapping>
    still when iam trying to access the servlet using "http://localhost:8080/ExampleServlet/"
    iam getting a HTTP:404 error
    The requested resource () is not available.,
    please help

    You better ask this on a Tomcat forum...
    Timo

  • How to Configure a Servlet Chain Using MIME Types with weblogic5.1?

    Hi ,
              I want to configure a servlet(cocoon) in weblogic 5.1 such that the
              servlet so configured is invoked each
              time a response with the mime-type "text/xml" is generated.
              1.) will weblogic support to configure a servlet with a particular
              mime-type so that it post-process any
              servlet's response with the corresponding mime-type?
              2.) if not what is the alternative?
              Thanks
              sumanth
              [sumo.vcf]
              

    We suggest that use the request dispatcher interface instead. Servlet
              chaining is not a standard's based possibility.
              Michael Girdley
              WLS Product Manager
              Sumanth Chinthagunta <[email protected]> wrote in message
              news:[email protected]..
              > Hi ,
              > I want to configure a servlet(cocoon) in weblogic 5.1 such that the
              > servlet so configured is invoked each
              > time a response with the mime-type "text/xml" is generated.
              > 1.) will weblogic support to configure a servlet with a particular
              > mime-type so that it post-process any
              > servlet's response with the corresponding mime-type?
              > 2.) if not what is the alternative?
              >
              > Thanks
              > sumanth
              >
              

  • How to configure for servlets

    i m new to servlets. can any body plz tell me what and how to do configurations for servlets

    hi,
    previously you installed any server or not,
    if not install any one of web server like javawebserver , tomcat etc...
    steps to install tomcat & configure:
    http://forum.java.sun.com/thread.jspa?threadID=5193463
    after successfull config,
    create a servlet program,compile and store under tomcatx.x\webapps\root\WEB-INF\classes
    open a web.xml under WEB-INF and add <servlet> & <servlet-mapping>
    ex:
         <servlet>
              <servlet-name>servletname</servlet-name>
              <servlet-class>package.classname</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>servletname</servlet-name>
              <url-pattern>/urlvalue</url-pattern>
         </servlet-mapping>
    restart tomcat
    run : http://localhost:8080/urlvalue

  • How to Compile/Run servlet in Tomcat 4.1

    Hi All,
    iam trying to compile my servlet program in tomcat4.1.. but its showing an error
    in the import statement..
    UN SOLVABLE SYMBOL... but the import ststement is correct...
    can any one help ... is there i have to set any path for compiling/running the servlet...
    Thanks in Advice

    hi thanks for your reply
    i have loaded tomcat4.1 exe -- for windows i am starting the tomcat server by clicking from the start menu..
    i dint set any env variable .. tell me how to set...
    regards
    ijay

  • How to Obtain Applet -servlet communication through https protocol

    We are trying to use https protocol.
    First I will explain Our Architecture. We are using JRun 3.0
    as servlet engine. We are using iplanet as a webserver.
    There are two iplanet webservers.
    There is a firewall between two iPlanet servers. i.e, one webserver
    is outside the firewall. JRun is communicating with inside iplannett
    webserver and inside iplannett webserver is communicating with
    outside iplannet server.
    If we are trying to run the application with
    this firewall, our applet is not loading,
    but the servlets and jsp pages are all working fine.
    Without the firewall, everything is working fine.
    The applet is also working fine.
    But, with the firewall, our applet is not loading.
    We are using JRE 1.3 as java plug-in.
    What is the problem so that the applet is not loading.
    and How to resolve this? can anybody give suggestion in this regard?
    Thanks in advance.

    No, I am not getting any security exception for the applet, but I am getting the following exception when working with HTTPS. The same application works fine with the default HTTP protocol
    java.net.UnknownServiceException: Input from HTTPS not expected until OutputStream is closed
         at sun.plugin.protocol.https.BrowserHttpsURLConnection.getInputStream(Unknown Source)
         at JBSchedulerXNew.initReceiveAppointmentData(JBSchedulerXNew.java:122)
         at JBSchedulerXNew.initReceiveAppointmentData(JBSchedulerXNew.java:92)
         at JBSchedulerXNewDemo.init(JBSchedulerXNewDemo.java:110)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

  • How to configure a servlet program using Eclipse?

    Hi,
    Am just learning Java and J2ee..Am not efficient..Don't laugh @ my question..
    I installed jdk 1.6, Apache tomcat 5.0 and eclipse 3.2.1 and also installed wtp plugin to work with j2ee perspective of eclipse..I did this in my PC..could U plz tell me what I need to install in addition?
    How come I write my Servlet program using Eclipse...
    Thanq
    Vani.

    This is the Sun Java System Messaging Server forum. Though this application software bears Java in it's name it has nothing to do with the programming language Java.

  • Configuring 2 servlets in Tomcat

    I've created 2 servlets that have been packaged into a single WAR file (call it MyWAR.war) and deployed onto Tomcat. Here's what I'd like to have happen:
    http://www.url.com/
    Goes to Servlet1
    http://www.url.com/MyWAR/xyz
    Goes to Servlet2
    Here's the mapping section of my web.xml
      <servlet-mapping>
        <servlet-name>Servlet1</servlet-name>
        <url-pattern>/*</url-pattern>
      </servlet-mapping> 
      <servlet-mapping>
        <servlet-name>Servlet2</servlet-name>
        <url-pattern>/xyz</url-pattern>
      </servlet-mapping>When I do this, I can get to Servlet1, but only at
    http://www.url.com/MyWAR
    I cannot get to Servlet2 at all
    However, if I comment out the mapping section for Servlet1, Servlet2 is correctly available at
    http://www.url.com/MyWAR/xyz
    Is it possible to do what I want to do? If so, how do I access Servlet1 without including the WAR file name in the URL?

    Thanks for the response. I wasn't aware of this ROOT.war option, I'll try it out.
    The fact that Servlet2 gets blocked off by the mapping of Server1 eventhough it's more specific bothers me. I swapped the order of the mappings thinking that the first thing that matched wins, but it still doesn't work. It seems that the most general mapping always wins, which isn't what I'd expect.
    Forwarding the request from Servlet1 to Servlet2 sounds reasonable, but I'm not sure I can do this. Servlet1 isn't simply a servlet, but contains some Jersey code. When my code finally gets called, I don't have the context to call another servlet because Jersey has boiled it all out for me. What and how can I filter? Any other ideas on how Servlet2 can naturally get called?

Maybe you are looking for

  • Spry Collapsible panel works in Safari, Firefox but not in IE 7 and 8

    Revising a page and wish to have the Spry Collapsible Panel load "closed". Never used Spry before but is works ok as mentioned but when page is opened in IE the panel is open and stays open. Clicking does not close it. The panel tab reads "CLICK To S

  • Create Radio button dynamically in Table column.

    HI All    I have used following code to create radio button dynamically. but it's getting dump saying that Could not find attribute STATUS.  Here STATUS is the attribute of the node in View context. But why this dump is coming.  Please correct me if

  • Showing crop lines on a printed or saved image

    Is it possible to either print or save an image that shows the crop lines from Lightroom (i.e. shows what is both in AND out of the image as it is cropped).  I'm working off a scanned negative and I want to show my printer just how to crop the image.

  • Field Symbol not assigning

    Here is my code field-symbols: <itfieldname> type any. DATA: lw_fieldname  LIKE ztfi_acctmap-zzfnam.             lw_fieldname = wa_ztfi_gl_acctmap-zzfnam.             ASSIGN (LW_FIELDNAME) TO <ITFIELDNAME>.             <itfieldname> = <lfs_excel>-val

  • To increase table space

    Hi all,          I am new to unix solaris, I have solaris10 64bit os, oracle 10.2.0.4,netweaver 7.0 Now i want to work with BRTOOLS in unix, i want to increase table space. how to extend table space in solaris environment, what are the commands to do