access a tomcat project builded in eclipse

M

marcelino

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
 
M

Markos Charatzas

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top