I've been asked to update our existing Apache / ApacheJServ system to
Tomcat with Apache. At the moment I'm looking into Tomcat 3.3.1a but
might consider the newer versions. Currently I'm running tomcat as a
stand alone to test my servlets.
I've installed tomcat under d:\apps\tomcat\ but my TOMCAT_HOME is
under d:\tomcat\
The first line of my server.xml (d:\tomcat\conf\server.xml):
<ContextManager workDir="d:\tomcat\work" home="d:\tomcat">
My web app is under d:\test\ but all my servlets are NOT under
d:\test\WEB-INF\classes\ but rather somewhere else on the filesystem
My web.xml for this app looks like:
<web-app>
<servlet>
<servlet-name>
Test
</servlet-name>
<servlet-class>
dx.servlet.profile.TestServlet
</servlet-class>
</servlet>
</web-app>
The servlet dx.servlet.profile.TestServlet lies under
d:\sites\server\classes\dx\servlet\profile\
I know older versions of tomcat would use the system classpath on
start up, and I guess that's the problem as to why tomcat can't find
my servlets. Is there a way to have my servlets NOT under
WEB-INF\classes but under some other directory? If so how would I go
about doing this?
thanks
or copy your classes into a directory which Tomcat adds to CP
automatically - such as shared\classes in Tomcat 4.
The difference from putting to WEB-INF\classes is that
they will get loaded by a different ClassLoader - and
be shared by all Web Applications rather than one.
Which may or may not be what you want.
Good luck,
~Alexei
"M" <m_ma...@hotmail.com> wrote in message
news:69f2330f.03091...@posting.google.com...
Thanks for the reply.
I'm actually using tomcat 3.3.1a but I did modify tomcat.bat to add
d:\sites\server\classes to -classpath. This seems to do the trick,
there only seems to be one problem:
At the BOTTOM of tomcat.bat is a line like:
set CLASSPATH=%_CLASSPATH%
I simply added my additional classpath like:
set CLASSPATH=d:\sites\server\classes;%_CLASSPATH%
an "echo %CLASSPATH%" right after, however produces:
d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;;d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;d:\sites\server\classes;;d:\sites\server\classes;
in the dos window that runs tomcat.bat. This seems strange and I'm not
sure why. Any ideas?
The reason I don't want to put my classes under WEB-INF\classes is b/c
the package hierarchy is made up of two main components. The servlets
and a stand alone java server that has nothing do with the servlets.
My package structure looks something like:
-db
-log
-mainserver
-monitor
-servlets
-profile
-forms
-util
-xml
the servlets package uses classes from the other packages, but the
mainserver package does not use the servlets package. Therefore it
seems incorrect to me to place all the packages under WEB-INF, and I
definitely don't want to restructure the packages to separate the
servlets package from the rest of them as this would only cause
headaches.
thanks
"Alexei Betin" <abe...@futuretrade.com> wrote in message news:<bjtg6l$n3qap$1...@ID-21259.news.uni-berlin.de>...
weird, but you need to look at (debug) the all the scripts that are
involved,
they are tricky, maybe there's some unwanted recursion in how the
final classpath gets built - cannot tell you
>
> The reason I don't want to put my classes under WEB-INF\classes is b/c
> the package hierarchy is made up of two main components. The servlets
> and a stand alone java server that has nothing do with the servlets.
> My package structure looks something like:
>
> -db
> -log
> -mainserver
> -monitor
> -servlets
> -profile
> -forms
> -util
> -xml
>
> the servlets package uses classes from the other packages, but the
> mainserver package does not use the servlets package. Therefore it
> seems incorrect to me to place all the packages under WEB-INF, and I
> definitely don't want to restructure the packages to separate the
> servlets package from the rest of them as this would only cause
> headaches.
>
well, if all your classes are used in the same WebApp I'd still keep
them under this Apps' WEB-INF, having said that, it does not have
to be WEB-INF\classes, I instead prefer
WEB-INF\lib\myservlets.jar
WEB-INF\lib\mycorelibs.jar
with a clear dependency separation, and all that sits inside the WAR
file which is a single deployment unit.
Tomcat will be able to unpack it for you automatically with no need
for hacking with CLASSPATH.
Thanks,
~Alexei
> I've been asked to update our existing Apache / ApacheJServ system to
> Tomcat with Apache. At the moment I'm looking into Tomcat 3.3.1a but might
> consider the newer versions.
Why not consider Tomcat 4.x from the start ?
Lordy
Exaclty. wasn't it also so that Tomcat 4 is a (complete) rewrite, and that
it performs much better than the 3.x series?
I'd even suggest using Tomcat 5, JSP 2 syntax is much better on the eyes :)
But that would of course depend on the timescale / requirements of the
project in question: Tomcat 5 is still in beta.
--
mvg,
Christophe Vanfleteren