File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes startup.bat stops itself Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "startup.bat stops itself" Watch "startup.bat stops itself" New topic
Author

startup.bat stops itself

orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
I just installed jdk and tomcat on the server of the company i work for. I've configured tomcat,set the classpath properly and everything but when i start up tomcat , the console window just open, does some stuff then stops and close itself. Can someone tell me why it's doing this and how I can fix this problem?
THanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
You should look on the Tomcat forum for many recent problems just like this one.
Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

William speaks the truth. I'm moving this to said forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
Not sure how to solve your problem, but a good way to debug the start up script is to stop the startup up scripts when an error occurs.
Go into the setclasspath script
comment out exit at the bottom of setclasspath this will keep the dos window open.
use rem exit
and the use echo %JAVA_HOME% to see where its pointing to at the start of the setclasspath file.
This way you can put debug points in.
Hope this helps
Tony
orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
Maybe I dont understand what you mean but there is no exit on my setclasspath.bat file
This file looks like this:

rem
-----------------------------------------------------------------------
----
rem Set CLASSPATH and Java options
rem
rem $Id: setclasspath.bat,v 1.8 2003/01/17 10:07:21 remm Exp $
rem
-----------------------------------------------------------------------
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo The JAVA_HOME environment variable is not defined
echo This environment variable is needed to run this program
goto end
:gotJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
goto okJavaHome
:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kJavaHome
if not "%BASEDIR%" == "" goto gotBasedir
echo The BASEDIR environment variable is not defined
echo This environment variable is needed to run this program
goto end
:gotBasedir
if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir
echo The BASEDIR environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kBasedir
rem Set the default -Djava.endorsed.dirs argument
set JAVA_ENDORSED_DIRS=%BASEDIR%\common\endorsed
rem Set standard CLASSPATH
rem Note that there are no quotes as we do not want to introduce random
rem quotes into the CLASSPATH
set
CLASSPATH=%JAVA_HOME%\lib\tools.jar;.;%JAVA_HOME%\jre\lib\rt.jar;.;%CAT
ALINA_HOME%\common\lib\servlet.jar;
rem Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JAVA_HOME%\bin\java"
set _RUNJAVAW="%JAVA_HOME%\bin\javaw"
set _RUNJDB="%JAVA_HOME%\bin\jdb"
set _RUNJAVAC="%JAVA_HOME%\bin\javac"
REM Set path for Java Development Kit
SET PATH=C:\jdk1.4.2\bin
REM Set Tomcat home directory
SET TOMCAT_HOME=c:\Tomcat\tomcat
REM Set Java home directory
SET JAVA_HOME=c:\jdk1.4.2

:end
And my startup.bat file look like this:
@echo off
if "%OS%" == "Windows_NT" setlocal
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat,v 1.4 2002/01/15 02:55:38 patrickl Exp $
rem ---------------------------------------------------------------------------
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=c:\Tomcat\Tomcat.
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
kHome
set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
set JAVA_HOME=c:\j2sdk_nb\j2sdk1.4.2
rem Check that target executable exists
if exist "%EXECUTABLE%" goto okExec
echo Cannot find %EXECUTABLE%
echo This file is needed to run this program
goto end
kExec
rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
oneSetArgs
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end

[B]I am using the same tomcat on my own machine and it's working fine but on this server pc, it just doesn't take it.Can't start tomcat. I am so fustrated, I only have two weeks left for my contract to end, I have to have this working by then. I can't make the console window not shut itself.I am sure someone else has maybe ecountered this same problem before.
please help me.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
If you have read some of the older posts you will have seen my advice for debugging startup.bat - namely to change the line

to

so that the catalina.bat (which is what %EXECUTABLE% calls) will run in the open window and will not close.
Bill
Joe Nguyen
Ranch Hand

Joined: Apr 20, 2001
Posts: 161
Another way to keep the window open is to open a dos window, cd to the directory where your startup.bat is, and execute the startup script in this directory. You'll see a stack trace.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Ah - but the problem is frequently that unless you change startup.bat like I described, the execution of catalina.bat occurs in a separate window that opens and closes before you can see whats happening.
orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
Hello,
I re-installed my jdk, and also tomcat, restarted the server, same error occured, the tomcat window flashes then close itself. Then I changed the "start" to a "run" as someone suggested. now it starting tomcat on the DOS window but then I am having this:

Mar 23, 2004 9:02:25 AM org.apache.coyote.http11.Http11Protocol init
SEVERE: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:8080
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoi
nt.java:302)
at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:184)
at org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.
java:1229)
at org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:579)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:2246)
at org.apache.catalina.startup.Catalina.start(Catalina.java:511)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Catalina.start: LifecycleException: Protocol handler initialization failed: jav
a.net.BindException: Address already in use: JVM_Bind:8080
LifecycleException: Protocol handler initialization failed: java.net.BindExcept
ion: Address already in use: JVM_Bind:8080
at org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.
java:1231)
at org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:579)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:2246)
at org.apache.catalina.startup.Catalina.start(Catalina.java:511)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Catalina.stop: LifecycleException: This server has not yet been started
LifecycleException: This server has not yet been started
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2213
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:543)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

what this mean?
Help. I've got only until friday to finish this.
Thanks
John Vergis
Ranch Hand

Joined: Feb 24, 2004
Posts: 59
Hi
Try changing the port 8080 in the server.xml file to some other port like 8081, This shud work for you.
The section wher the changes to be made..

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
....
.....
johnny
orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
It works now . The Tomcat default page is showing.
But my own application doesn't . I put my folder under C: and also tried to put it under webapps\root\then my folder. Only the default page is showing but not the other ones. I am having this error now:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat\Tomcat\work\Standalone\localhost\_\CoreData\Project_jsp.java:7: package Helper does not exist
import Helper.*;
^
C:\Tomcat\Tomcat\work\Standalone\localhost\_\CoreData\Project_jsp.java:11: cannot resolve symbol
symbol : class CoreDataDetails
location: class org.apache.jsp.Project_jsp
CoreDataDetails coredataDetails = new CoreDataDetails();
^
C:\Tomcat\Tomcat\work\Standalone\localhost\_\CoreData\Project_jsp.java:11: cannot resolve symbol
symbol : class CoreDataDetails
location: class org.apache.jsp.Project_jsp
CoreDataDetails coredataDetails = new CoreDataDetails();
^
3 errors


I did put the package Helper in my classpath but I am wondering why it's not seeing it.
Please help
Thanks
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

"Putting it on the classpath" is not enough. That will do for when you want to compile java files that use your classes. But Tomcat does not use the system classpath.

Place the classes you are importing (in their proper folder heirarchy) into WEB-INF/classes

This is all covered in the Tomcat docs.
orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
there is something wrong somewhere.
My localhost:9080 is not even working anymore now that I've configured tomcat to work with IIS. When I type localhost:9080/mydirectory/myjsp i am having a The requested resource (/CoreData/) is not available. When I simply type localhost:9080 i am having a directory listing, everything I have under webapps/root.
Anyone can tell me what happened.
I used the tutorial on http://virtualict.net/support/kb/ii6-Tomcat5-JK2.html to configure tomcat with IIS. I have iis5 and tomcat 4.
Anyone help please
here
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

That link doesn't work, but I'm going to take a guess:
ii6 = IIS 6
Tomcat5 (obvious)

If you have IIS5, and Tomcat 4, what made you think those instructions would work?
1) There's been significant changes between Tomcat 4 and 5 for configuration of Contexts.
2) jk connectors typically utilize dll's that have been compiled for certain versions of IIS. Something might have (probably did) change between 5 and 6.

It certainly can't hurt at this point to remove the JK configuration entirely from both IIS and Tomcat, and start over. And the first step, will be to get Tomcat working standalone.
orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
I re-installed tomcat and now the default page on localhost:8089 works. But my own directory doesn't : The requested resource (/CoreData/index.jsp) is not available
And in my tomcat console window I have :
ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009
Does anyone know how to fix this?
I've removed all the configuration I've done on IIS and ininstalled JK2 as well(the connector).
THanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Tomcat won't recognize a directory under webapps as a web application if it does not have a WEB-INF directory and a web.xml file. That might be the reason it is not seeing /CoreData/index.jsp
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: startup.bat stops itself