access a tomcat project builded in eclipse

Discussion in 'Java' started by marcelino, Jan 26, 2004.

  1. marcelino

    marcelino Guest

    Hello java-community,

    I'm trying to run a servlet in tomcat 4.1.27 developed in eclipse
    using the tomcat-plugin from sysdeo version 2.2.1.
    If I copy the binary from my eclipse workspace to the
    webapps/examples/WEB-INF/classes- directory it runs with this call:

    http://localhost:8080/examples/servlet/HelloWorld2


    The Location of binaries rendered by eclipse is:

    file:/home/myhome/workspace/tctest/WEB-INF/classes

    If I try to run the servlet from the eclipse-workspace -after updated
    the server.xml- with this call:

    http://localhost:8080/tctest/servlet/HelloWorld2
    and also
    http://localhost:8080/servlet/tctest.HellowWorld2

    I see the error 404.
    tctest is my eclipse- project HelloWorld2 is part of.
    In server.xml I can find the following context-element:

    <Context path="/tctest" reloadable="true"
    docBase="/home/mbert/workspace/tctest"
    workDir="/home/mbert/workspace/tctest/work/org/apache/jsp" />

    Maybe there is something wrong in the configuration. So here are some
    environment variables

    global:
    JRE_HOME=/usr/lib/java/jre
    PATH=/home/mbert/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    JAVA_BINDIR=/usr/lib/java/bin
    JAVA_HOME=/usr/lib/java
    SDK_HOME=/usr/lib/java
    JDK_HOME=/usr/lib/java
    JAVA_ROOT=/usr/lib/java

    eclipse:
    JRE_HOME=/usr/lib/SunJava-1.4.2/jre
    PATH=/home/mbert/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/SunJava-1.4.2/bin
    JAVA_BINDIR=/usr/lib/SunJava-1.4.2/bin
    JAVA_HOME=/usr/lib/SunJava-1.4.2
    SDK_HOME=/usr/lib/SunJava-1.4.2
    JDK_HOME=/usr/lib/SunJava-1.4.2
    JAVA_ROOT=/usr/lib/SunJava-1.4.2


    At the moment I can't figure out the cause of my problem. If somebody
    can give me a hint I would appreciate it.

    thanks in advance

    Marcelino

    thanks in advance

    martina
    marcelino, Jan 26, 2004
    #1
    1. Advertising

  2. Hi there,

    You actually need to modify web.xml inside the WEB-INF directory of your
    project to state which class is HelloWorld2.
    E.g.
    <servlet>
    <servlet-name>HelloWorld2</servlet-name>
    <servlet-class>[package-name].HelloWorld2</servlet-class>
    </servlet>

    You can also have an alias in the form of
    <servlet-mapping>
    <servlet-name>HelloWorld2</servlet-name>
    <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping>

    Also make sure that you put the <Context> element withing the
    <Host></Host> element in server.xml

    Let us know if you have further problems.
    Markos Charatzas

    marcelino wrote:
    > Hello java-community,
    >
    > I'm trying to run a servlet in tomcat 4.1.27 developed in eclipse
    > using the tomcat-plugin from sysdeo version 2.2.1.
    > If I copy the binary from my eclipse workspace to the
    > webapps/examples/WEB-INF/classes- directory it runs with this call:
    >
    > http://localhost:8080/examples/servlet/HelloWorld2
    >
    >
    > The Location of binaries rendered by eclipse is:
    >
    > file:/home/myhome/workspace/tctest/WEB-INF/classes
    >
    > If I try to run the servlet from the eclipse-workspace -after updated
    > the server.xml- with this call:
    >
    > http://localhost:8080/tctest/servlet/HelloWorld2
    > and also
    > http://localhost:8080/servlet/tctest.HellowWorld2
    >
    > I see the error 404.
    > tctest is my eclipse- project HelloWorld2 is part of.
    > In server.xml I can find the following context-element:
    >
    > <Context path="/tctest" reloadable="true"
    > docBase="/home/mbert/workspace/tctest"
    > workDir="/home/mbert/workspace/tctest/work/org/apache/jsp" />
    >
    > Maybe there is something wrong in the configuration. So here are some
    > environment variables
    >
    > global:
    > JRE_HOME=/usr/lib/java/jre
    > PATH=/home/mbert/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/bin
    > JAVA_BINDIR=/usr/lib/java/bin
    > JAVA_HOME=/usr/lib/java
    > SDK_HOME=/usr/lib/java
    > JDK_HOME=/usr/lib/java
    > JAVA_ROOT=/usr/lib/java
    >
    > eclipse:
    > JRE_HOME=/usr/lib/SunJava-1.4.2/jre
    > PATH=/home/mbert/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/SunJava-1.4.2/bin
    > JAVA_BINDIR=/usr/lib/SunJava-1.4.2/bin
    > JAVA_HOME=/usr/lib/SunJava-1.4.2
    > SDK_HOME=/usr/lib/SunJava-1.4.2
    > JDK_HOME=/usr/lib/SunJava-1.4.2
    > JAVA_ROOT=/usr/lib/SunJava-1.4.2
    >
    >
    > At the moment I can't figure out the cause of my problem. If somebody
    > can give me a hint I would appreciate it.
    >
    > thanks in advance
    >
    > Marcelino
    >
    > thanks in advance
    >
    > martina
    Markos Charatzas, Jan 26, 2004
    #2
    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.
Similar Threads
  1. Thomas
    Replies:
    1
    Views:
    728
    Robert Olofsson
    Oct 18, 2003
  2. javaguy44
    Replies:
    1
    Views:
    993
  3. Dagorlas
    Replies:
    7
    Views:
    370
    Dagorlas
    Jun 16, 2006
  4. Veerle
    Replies:
    0
    Views:
    1,363
    Veerle
    Mar 13, 2009
  5. Stephane Wirtel
    Replies:
    0
    Views:
    124
    Stephane Wirtel
    Jul 5, 2007
Loading...

Share This Page