tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Saegesser" <marc.saeges...@apropos.com>
Subject RE: Tomcat dies immediately under windows
Date Tue, 02 Jan 2001 19:00:01 GMT
I'll commit the changes as soon as someone can verify that the new
tomcat.bat file works on Win98.  I don't have the resources to test on that
platform at the moment.  If someone would kindly test this I would
appreciate it.

I sent this file to TOMCAT-USER yesterday as an attachment and it set off
lots alarms due to the .bat file attachment.  I'm including it here inline
in case yesterday's copy didn't make to all subscribers.

------- Begin tomcat.bat
@echo off
rem ------------------------------------------------------------------------
-
rem tomcat.bat - Start/Stop Script for the TOMCAT Server
rem
rem Environment Variable Prerequisites:
rem
rem   TOMCAT_HOME  (Optional) May point at your Tomcat distribution
rem                directory.  If not present, the current working
rem                directory is assumed.
rem                Note: This batch file does not function properly
rem                if TOMCAT_HOME contains spaces.
rem
rem   TOMCAT_OPTS  (Optional) Java runtime options used when the "start",
rem                "stop", or "run" command is executed
rem
rem   CLASSPATH    (Optional) This batch file will automatically add
rem                what Tomcat needs to the CLASSPATH.  This consists
rem                of TOMCAT_HOME\classes and all the jar files in
rem                TOMCAT_HOME\lib. This will include the "jaxp.jar"
rem                and "parser.jar" files from the JAXP Reference
rem                implementation, and the "tools.jar" from the JDK.
rem
rem   JAVA_HOME    Must point at your Java Development Kit installation.
rem
rem $Id: tomcat.bat,v 1.24.2.4 2000/09/23 21:52:56 larryi Exp $
rem ------------------------------------------------------------------------
-


rem ----- Save Environment Variables That May
Change ------------------------

set _CP=%CP%
set _TOMCAT_HOME=%TOMCAT_HOME%
rem set _CLASSPATH=%CLASSPATH%


rem ----- Verify and Set Required Environment
Variables ---------------------

if not "%JAVA_HOME%" == "" goto gotJavaHome
echo You must set JAVA_HOME to point at your Java Development Kit
installation
goto cleanup
:gotJavaHome

if not "%TOMCAT_HOME%" == "" goto gotTomcatHome
set TOMCAT_HOME=.
:gotTomcatHome
if exist "%TOMCAT_HOME%\lib\servlet.jar" goto okTomcatHome
echo Unable to locate servlet.jar, check the value of TOMCAT_HOME.
goto cleanup
:okTomcatHome


rem ----- Prepare Appropriate Java Execution
Commands -----------------------

if not "%OS%" == "Windows_NT" goto noTitle
set _SECSTARTJAVA=start "Secure Tomcat 3.2" "%JAVA_HOME%\bin\java"
set _STARTJAVA=start "Tomcat 3.2" "%JAVA_HOME%\bin\java"
set _RUNJAVA="%JAVA_HOME%\bin\java"
goto setClasspath

:noTitle
set _SECSTARTJAVA=start "%JAVA_HOME%\bin\java"
set _STARTJAVA=start "%JAVA_HOME%\bin\java"
set _RUNJAVA="%JAVA_HOME%\bin\java"


rem ----- Set Up The Runtime
Classpath --------------------------------------

:setClasspath
set CP=%TOMCAT_HOME%\classes

rem Try to determine if TOMCAT_HOME contains spaces
if exist %TOMCAT_HOME%\lib\servlet.jar goto dynClasspath
echo Your TOMCAT_HOME appears to contain spaces.
echo Unable to set CLASSPATH dynamically.
goto staticClasspath

:dynClasspath
set _LIBJARS=
for %%i in (%TOMCAT_HOME%\lib\*.jar) do call %TOMCAT_HOME%\bin\cpappend.bat
%%i
if not "%_LIBJARS%" == "" goto gotLibJars
echo Unable to set CLASSPATH dynamically.
if "%OS%" == "Windows_NT" goto staticClasspath
echo Note: To set the CLASSPATH dynamically on Win9x systems
echo       only DOS 8.3 names may be used in TOMCAT_HOME!
goto staticClasspath

:gotLibJars
echo Including all jars in %TOMCAT_HOME%\lib in your CLASSPATH.
rem Note: _LIBJARS already contains a leading semicolon
set CP=%CP%%_LIBJARS%
goto chkClasspath

:staticClasspath
echo Setting your CLASSPATH statically.
if exist "%TOMCAT_HOME%\lib\ant.jar" set CP=%CP%;%TOMCAT_HOME%\lib\ant.jar
if exist "%TOMCAT_HOME%\lib\jasper.jar" set
CP=%CP%;%TOMCAT_HOME%\lib\jasper.jar
if exist "%TOMCAT_HOME%\lib\jaxp.jar" set CP=%CP%;%TOMCAT_HOME%\lib\jaxp.jar
if exist "%TOMCAT_HOME%\lib\parser.jar" set
CP=%CP%;%TOMCAT_HOME%\lib\parser.jar
if exist "%TOMCAT_HOME%\lib\servlet.jar" set
CP=%CP%;%TOMCAT_HOME%\lib\servlet.jar
if exist "%TOMCAT_HOME%\lib\webserver.jar" set
CP=%CP%;%TOMCAT_HOME%\lib\webserver.jar

:chkClasspath
if "%CLASSPATH%" == "" goto noClasspath
set CP=%CP%;%CLASSPATH%
:noClasspath
if not exist "%JAVA_HOME%\lib\tools.jar" goto installClasspath
set CP=%CP%;%JAVA_HOME%\lib\tools.jar
:installClasspath
echo.
echo Using CLASSPATH: %CP%
echo.
rem set CLASSPATH=%CP%


rem ----- Execute The Requested
Command -------------------------------------

if "%1" == "start" goto startServer
if "%1" == "stop" goto stopServer
if "%1" == "run" goto runServer
if "%1" == "ant" goto runAnt
if "%1" == "env" goto doEnv
if "%1" == "jspc" goto runJspc

:doUsage
echo Usage:  tomcat ( ant ^| env ^| jspc ^| run ^| start ^| stop )
echo Commands:
echo   ant -   Run Ant in Tomcat's environment
echo   env -   Set up environment variables that Tomcat would use
echo   jspc -  Run JSPC in Tomcat's environment
echo   run -   Start Tomcat in the current window
echo   start - Start Tomcat in a separate window
echo   stop -  Stop Tomcat
goto cleanup

:doEnv
goto finish

:startServer
echo Starting Tomcat in new window
if "%2" == "-security" goto startSecure
%_STARTJAVA% %TOMCAT_OPTS% -classpath %CP% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:startSecure
echo Starting Tomcat with a SecurityManager
%_SECSTARTJAVA% %TOMCAT_OPTS% -classpath
%CP% -Djava.security.manager -Djava.security.policy=="%TOMCAT_HOME%/conf/tom
cat.policy" -Dtomcat.home="%TOMCAT_HOME%" org.apache.tomcat.startup.Tomcat
%3 %4 %5 %6 %7 %8 %9
goto cleanup

:runServer
rem Running Tomcat in this window
if "%2" == "-security" goto runSecure
%_RUNJAVA% %TOMCAT_OPTS% -classpath %CP% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:runSecure
rem Running Tomcat with a SecurityManager
%_RUNJAVA% %TOMCAT_OPTS% -classpath
%CP% -Djava.security.manager -Djava.security.policy=="%TOMCAT_HOME%/conf/tom
cat.policy" -Dtomcat.home="%TOMCAT_HOME%" org.apache.tomcat.startup.Tomcat
%3 %4 %5 %6 %7 %8 %9
goto cleanup

:stopServer
rem Stopping the Tomcat Server
%_RUNJAVA% %TOMCAT_OPTS% -classpath %CP% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tomcat.startup.Tomcat -stop %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:runAnt
rem Run ANT in Tomcat's Environment
set CP=%CP%;%TOMCAT_HOME%\lib\ant.jar
%_RUNJAVA% %ANT_OPTS% -classpath
%CP% -Dant.home="%TOMCAT_HOME%" -Dtomcat.home="%TOMCAT_HOME%"
org.apache.tools.ant.Main %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup

:runJspc
rem Run JSPC in Tomcat's Environment
%_RUNJAVA% %JSPC_OPTS% -classpath %CP% -Dtomcat.home="%TOMCAT_HOME%"
org.apache.jasper.JspC %2 %3 %4 %5 %6 %7 %8 %9
goto cleanup


rem ----- Restore Environment
Variables ---------------------------------------

:cleanup
set _LIBJARS=
set _SECSTARTJAVA=
set _STARTJAVA=
set _RUNJAVA=
rem set CLASSPATH=%_CLASSPATH%
set _CLASSPATH=
set TOMCAT_HOME=%_TOMCAT_HOME%
set _TOMCAT_HOME=
set CP=%_CP%
set _CP=
:finish
------- End tomcat.bat

-----Original Message-----
From: Eric Armstrong [mailto:eric@treelight.com]
Sent: Tuesday, January 02, 2001 12:44 PM
To: Alef Arendsen; tomcat-user@jakarta.apache.org
Subject: Re: Tomcat dies immediately under windows


Thanks for the pointer.
Interesting solution to the problem.

The changes I made to the .bat file still
need to be folded in to the release, though.

What's the best way to take care of that?

Alef Arendsen wrote:
>
> There was a discussion on this a couple of days ago...
>
> what solved the problem was: http://www.geocities.com/jdrudnicki/
>
> I think it had got something to do with environment space of command
prompt
> on Win98 or something...
>
> Alef
>
> ----- Original Message -----
> From: "Eric Armstrong" <eric@treelight.com>
> To: <tomcat-user@jakarta.apache.org>; "me" <eric@treelight.com>
> Sent: Monday, January 01, 2001 22:35
> Subject: Re: Tomcat dies immediately under windows
>
> > More info:
> >   "tomcat run"  works fine. (runs in the same window)
> >   "tomcat start" fails.     (separate window dies)
> >
> > Some environment setting must be missing in the new
> > window.
> >
> > Eric Armstrong wrote:
> > >
> > > Note: Please use "reply all", as I am not
> > >       subscribed at this address.
> > >
> > > Problem:
> > >   * OS = Win98.
> > >   * Tomcat startup announces "it is starting in a new
> > >     window".
> > >   * A window flashes up for an instant, and then
> > >     disappears.
> > >   * No LOGS directory was created.
> > >   * After manually creating the directory, no log is
> > >     written there after a retry.
> > >   * The process list does not show any instance of
> > >     tomcat running
> > >
> > > I've set up Tomcat successfully under Solaris,
> > > so I'm somewhat familiar with the process. Obviously,
> > > I have some setting wrong, but what? How can I find
> > > out, or has anyone experienced a similar problem?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, email: tomcat-user-help@jakarta.apache.org
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org


Mime
View raw message