jaggernat
asked on
servlet programmer beginner
hi ,
I am new to servlet programming. I have downloaded latest versions of Apache and Tomcat on my Windows NT machine.
I have written my first servlet program. Now i am confused where to save it. Do i compile it using javac "filename" and run it using java "filename" (like we do for usal java programs)
Any advice greatly appreciated.
This is my simple servlet program :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Servlet1 extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponce responce) throws ServletException, IOException
{
PrintWriter out = responce.getWriter();
out.println("Hellooooooooo o World");
}
}
thanks,
J
I am new to servlet programming. I have downloaded latest versions of Apache and Tomcat on my Windows NT machine.
I have written my first servlet program. Now i am confused where to save it. Do i compile it using javac "filename" and run it using java "filename" (like we do for usal java programs)
Any advice greatly appreciated.
This is my simple servlet program :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Servlet1 extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponce responce) throws ServletException, IOException
{
PrintWriter out = responce.getWriter();
out.println("Hellooooooooo
}
}
thanks,
J
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/deployment.html
The above link gives you information on how to deploy your application into Tomcat.
You need to compile above program using javac and put your class file under the folder /WEB-INF/classes/ .
you can use the existing directory $CATALINA_HOME/webapps/ROO T/WEB-INF/ classes to put your servlet classes. In this case you can access your servlet by invoking http://hostname:8080/servlet/Servlet1
Good practise is to make a dirctory under webapps and put all your servlets under WEB-INF/classes underneath that directory
eg : $CATALINA_HOME/webapps/myr oot/WEB-IN F/classes
In this case you can access your classes by : http://hostname:8080/myrrot/servlet/Servlet1
Also read: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
Hope this helps.
The above link gives you information on how to deploy your application into Tomcat.
You need to compile above program using javac and put your class file under the folder /WEB-INF/classes/ .
you can use the existing directory $CATALINA_HOME/webapps/ROO
Good practise is to make a dirctory under webapps and put all your servlets under WEB-INF/classes underneath that directory
eg : $CATALINA_HOME/webapps/myr
In this case you can access your classes by : http://hostname:8080/myrrot/servlet/Servlet1
Also read: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html
Hope this helps.
ASKER
For some reason, i cant start the server .
Detailed Description:
My Tomcat is stored in this following directory:
c:\program files\Apache Group\Tomcat 4.1
Under tomcat 4.1 directory , i made a directory called "ap1"(which i created to store applications) ,under "ap1" directory i created "Web-inf" directory , and under "Web-inf directory" i created the "classes" directory.
I have stored my first java program "servlet1.java" in the "classes" directory .
In the environment variables , i have set some thing like this
set JAVA_HOME=c:\j2sdk1.4.2_06 ; set CATALINA_HOME=c:\Program Files\Apache Group\Tomcat 4.1
when i run the command "startup" from c:\program files\Apache Group\Tomcat 4.1\bin
the server starts , but terminates in between and throws an error message (like file not found).
Also , i cant run the javac command from the command prompt.
...........This is getting real frustrating..
Any advice greatly appreciated.
thanks,
J
Detailed Description:
My Tomcat is stored in this following directory:
c:\program files\Apache Group\Tomcat 4.1
Under tomcat 4.1 directory , i made a directory called "ap1"(which i created to store applications) ,under "ap1" directory i created "Web-inf" directory , and under "Web-inf directory" i created the "classes" directory.
I have stored my first java program "servlet1.java" in the "classes" directory .
In the environment variables , i have set some thing like this
set JAVA_HOME=c:\j2sdk1.4.2_06
when i run the command "startup" from c:\program files\Apache Group\Tomcat 4.1\bin
the server starts , but terminates in between and throws an error message (like file not found).
Also , i cant run the javac command from the command prompt.
...........This is getting real frustrating..
Any advice greatly appreciated.
thanks,
J
you need to create "api" directory under c:\program files\Apache Group\Tomcat 4.1\webapps and not under c:\program files\Apache Group\Tomcat 4.1 and WEB-INF is case sensitive.
You need to solve the problem with tomcat startup. Try to find more details of the error. Since you cannot even compile java program from command prompt, that could be the root of the problem. Try to figure out why you are not able to run javac. Try running "echo %JAVA_HOME%" to see if the env variable is set correctly. You need to set PATH variable as well.
set PATH = %PATH%;%JAVA_HOME%\bin
You need to solve the problem with tomcat startup. Try to find more details of the error. Since you cannot even compile java program from command prompt, that could be the root of the problem. Try to figure out why you are not able to run javac. Try running "echo %JAVA_HOME%" to see if the env variable is set correctly. You need to set PATH variable as well.
set PATH = %PATH%;%JAVA_HOME%\bin
ASKER
ok when i run "startup" it says "Catalina_Home is not defined correctly. This environment variable is needed to run this program .
Do i need to define "CATALINA_HOME" in environment variable??
thanks,
J
Do i need to define "CATALINA_HOME" in environment variable??
thanks,
J
Yes, you need to set CATALINA_HOME, JAVA_HOME and PATH in the environment variable.
ASKER
ok ..JAVA_HOME and PATH environment variables are set.. How do i set CATALINE_HOME variable ?
thanks,
J
thanks,
J
In the same way you can set CATALINE_HOME, give it the value :
Right click "My Computer" icon on the desktop and select "Properties" click "Advanced" tab and select "Environment Variables", click "new" button under user variables,
Give name as: CATALINE_HOME
value as: c:\Program Files\Apache Group\Tomcat 4.1
Don't set environment variable in the command prompt giving the set option, that's only temporary.
Right click "My Computer" icon on the desktop and select "Properties" click "Advanced" tab and select "Environment Variables", click "new" button under user variables,
Give name as: CATALINE_HOME
value as: c:\Program Files\Apache Group\Tomcat 4.1
Don't set environment variable in the command prompt giving the set option, that's only temporary.
ASKER
i dont know....i am still getting the same error.."Catalina_Home is not defined correctly"
couple of hours back i deleted one line of code from startup.bat or catalina.bat (dont remember exactly). I think thats the problem.
will i have to uninstall and reinstall Tomcat.
thanks,
sorry for the trouble.
this question s is definetely worth more than 150 points :)
couple of hours back i deleted one line of code from startup.bat or catalina.bat (dont remember exactly). I think thats the problem.
will i have to uninstall and reinstall Tomcat.
thanks,
sorry for the trouble.
this question s is definetely worth more than 150 points :)
Given below is the contents of startup.bat, may be from that you can figure out which line you deleted.
========================== ========== ========== =========
@echo off
if "%OS%" == "Windows_NT" setlocal
rem -------------------------- ---------- ---------- ---------- ---------- ---------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat,v 1.4 2002/08/04 18:19:43 patrickl Exp $
rem -------------------------- ---------- ---------- ---------- ---------- ---------
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=.
if exist "%CATALINA_HOME%\bin\catal ina.bat" goto okHome
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\catal ina.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
:okHome
set EXECUTABLE=%CATALINA_HOME% \bin\catal ina.bat
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
:okExec
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_AR GS% %1
shift
goto setArgs
:doneSetArgs
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end
========================== ========== ========== ========== =
==========================
@echo off
if "%OS%" == "Windows_NT" setlocal
rem --------------------------
rem Start script for the CATALINA Server
rem
rem $Id: startup.bat,v 1.4 2002/08/04 18:19:43 patrickl Exp $
rem --------------------------
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=.
if exist "%CATALINA_HOME%\bin\catal
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\catal
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
set EXECUTABLE=%CATALINA_HOME%
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
:okExec
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_AR
shift
goto setArgs
:doneSetArgs
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
:end
==========================
ASKER
can you paste catalina.bat too. it may have been from that file.
thanks,
J
thanks,
J
@echo off
if "%OS%" == "Windows_NT" setlocal
rem -------------------------- ---------- ---------- ---------- ---------- ---------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prequisites
rem
rem CATALINA_HOME May point at your Catalina "build" directory.
rem
rem CATALINA_BASE (Optional) Base directory for resolving dynamic portions
rem of a Catalina installation. If not present, resolves to
rem the same directory that CATALINA_HOME points to.
rem
rem CATALINA_OPTS (Optional) Java runtime options used when the "start",
rem "stop", or "run" command is executed.
rem
rem CATALINA_TMPDIR (Optional) Directory path location of temporary directory
rem the JVM should use (java.io.tmpdir). Defaults to
rem %CATALINA_BASE%\temp.
rem
rem JAVA_HOME Must point at your Java Development Kit installation.
rem
rem JAVA_OPTS (Optional) Java runtime options used when the "start",
rem "stop", or "run" command is executed.
rem
rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
rem (JSSE) installation, whose JAR files will be added to the
rem system class path used to start Tomcat.
rem
rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
rem command is executed. The default is "dt_shmem".
rem
rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
rem command is executed. The default is "jdbconn".
rem
rem $Id: catalina.bat,v 1.7 2003/11/05 11:40:18 remm Exp $
rem -------------------------- ---------- ---------- ---------- ---------- ---------
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=.
if exist "%CATALINA_HOME%\bin\catal ina.bat" goto okHome
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\catal ina.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
:okHome
rem Get standard environment variables
if exist "%CATALINA_HOME%\bin\seten v.bat" call "%CATALINA_HOME%\bin\seten v.bat"
rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setcl asspath.ba t" goto okSetclasspath
echo Cannot find %CATALINA_HOME%\bin\setcla sspath.bat
echo This file is needed to run this program
goto end
:okSetclasspath
set BASEDIR=%CATALINA_HOME%
call "%CATALINA_HOME%\bin\setcl asspath.ba t"
rem Add on extra jar files to CLASSPATH
if "%JSSE_HOME%" == "" goto noJsse
set CLASSPATH=%CLASSPATH%;%JSS E_HOME%\li b\jcert.ja r;%JSSE_HO ME%\lib\jn et.jar;%JS SE_HOME%\l ib\jsse.ja r
:noJsse
set CLASSPATH=%CLASSPATH%;%CAT ALINA_HOME %\bin\boot strap.jar
if not "%CATALINA_BASE%" == "" goto gotBase
set CATALINA_BASE=%CATALINA_HO ME%
:gotBase
if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set CATALINA_TMPDIR=%CATALINA_ BASE%\temp
:gotTmpdir
rem ----- Execute The Requested Command -------------------------- ---------- ---
echo Using CATALINA_BASE: %CATALINA_BASE%
echo Using CATALINA_HOME: %CATALINA_HOME%
echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR%
echo Using JAVA_HOME: %JAVA_HOME%
set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catal ina.startu p.Bootstra p
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_shmem
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=jdbconn
:gotJpdaAddress
shift
:noJpda
if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop
echo Usage: catalina ( commands ... )
echo commands:
echo debug Start Catalina in a debugger
echo debug -security Debug Catalina with a security manager
echo jpda start Start Catalina under JPDA debugger
echo run Start Catalina in the current window
echo run -security Start in the current window with security manager
echo start Start Catalina in a separate window
echo start -security Start in a separate window with security manager
echo stop Stop Catalina
goto end
:doDebug
shift
set _EXECJAVA=%_RUNJDB%
set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\jak arta-tomca t-catalina \catalina\ src\share"
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATA LINA_BASE% \conf\cata lina.polic y
goto execCmd
:doRun
shift
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATA LINA_BASE% \conf\cata lina.polic y
goto execCmd
:doStart
shift
if not "%OS%" == "Windows_NT" goto noTitle
set _EXECJAVA=start "Tomcat" %_RUNJAVA%
goto gotTitle
:noTitle
set _EXECJAVA=start %_RUNJAVA%
:gotTitle
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATA LINA_BASE% \conf\cata lina.polic y
goto execCmd
:doStop
shift
set ACTION=stop
goto execCmd
:execCmd
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_AR GS% %1
shift
goto setArgs
:doneSetArgs
rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAV A_ENDORSED _DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA _BASE%" -Dcatalina.home="%CATALINA _HOME%" -Djava.io.tmpdir="%CATALIN A_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAV A_ENDORSED _DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="% SECURITY_P OLICY_FILE %" -Dcatalina.base="%CATALINA _BASE%" -Dcatalina.home="%CATALINA _HOME%" -Djava.io.tmpdir="%CATALIN A_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_ TRANSPORT% ,address=% JPDA_ADDRE SS%,server =y,suspend =n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAV A_ENDORSED _DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA _BASE%" -Dcatalina.home="%CATALINA _HOME%" -Djava.io.tmpdir="%CATALIN A_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xrunjdwp:transport=%JPDA_ TRANSPORT% ,address=% JPDA_ADDRE SS%,server =y,suspend =n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAV A_ENDORSED _DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="% SECURITY_P OLICY_FILE %" -Dcatalina.base="%CATALINA _BASE%" -Dcatalina.home="%CATALINA _HOME%" -Djava.io.tmpdir="%CATALIN A_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:end
if "%OS%" == "Windows_NT" setlocal
rem --------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prequisites
rem
rem CATALINA_HOME May point at your Catalina "build" directory.
rem
rem CATALINA_BASE (Optional) Base directory for resolving dynamic portions
rem of a Catalina installation. If not present, resolves to
rem the same directory that CATALINA_HOME points to.
rem
rem CATALINA_OPTS (Optional) Java runtime options used when the "start",
rem "stop", or "run" command is executed.
rem
rem CATALINA_TMPDIR (Optional) Directory path location of temporary directory
rem the JVM should use (java.io.tmpdir). Defaults to
rem %CATALINA_BASE%\temp.
rem
rem JAVA_HOME Must point at your Java Development Kit installation.
rem
rem JAVA_OPTS (Optional) Java runtime options used when the "start",
rem "stop", or "run" command is executed.
rem
rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
rem (JSSE) installation, whose JAR files will be added to the
rem system class path used to start Tomcat.
rem
rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
rem command is executed. The default is "dt_shmem".
rem
rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
rem command is executed. The default is "jdbconn".
rem
rem $Id: catalina.bat,v 1.7 2003/11/05 11:40:18 remm Exp $
rem --------------------------
rem Guess CATALINA_HOME if not defined
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=.
if exist "%CATALINA_HOME%\bin\catal
set CATALINA_HOME=..
:gotHome
if exist "%CATALINA_HOME%\bin\catal
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
rem Get standard environment variables
if exist "%CATALINA_HOME%\bin\seten
rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setcl
echo Cannot find %CATALINA_HOME%\bin\setcla
echo This file is needed to run this program
goto end
:okSetclasspath
set BASEDIR=%CATALINA_HOME%
call "%CATALINA_HOME%\bin\setcl
rem Add on extra jar files to CLASSPATH
if "%JSSE_HOME%" == "" goto noJsse
set CLASSPATH=%CLASSPATH%;%JSS
:noJsse
set CLASSPATH=%CLASSPATH%;%CAT
if not "%CATALINA_BASE%" == "" goto gotBase
set CATALINA_BASE=%CATALINA_HO
:gotBase
if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set CATALINA_TMPDIR=%CATALINA_
:gotTmpdir
rem ----- Execute The Requested Command --------------------------
echo Using CATALINA_BASE: %CATALINA_BASE%
echo Using CATALINA_HOME: %CATALINA_HOME%
echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR%
echo Using JAVA_HOME: %JAVA_HOME%
set _EXECJAVA=%_RUNJAVA%
set MAINCLASS=org.apache.catal
set ACTION=start
set SECURITY_POLICY_FILE=
set DEBUG_OPTS=
set JPDA=
if not ""%1"" == ""jpda"" goto noJpda
set JPDA=jpda
if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_shmem
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=jdbconn
:gotJpdaAddress
shift
:noJpda
if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop
echo Usage: catalina ( commands ... )
echo commands:
echo debug Start Catalina in a debugger
echo debug -security Debug Catalina with a security manager
echo jpda start Start Catalina under JPDA debugger
echo run Start Catalina in the current window
echo run -security Start in the current window with security manager
echo start Start Catalina in a separate window
echo start -security Start in a separate window with security manager
echo stop Stop Catalina
goto end
:doDebug
shift
set _EXECJAVA=%_RUNJDB%
set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\jak
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATA
goto execCmd
:doRun
shift
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATA
goto execCmd
:doStart
shift
if not "%OS%" == "Windows_NT" goto noTitle
set _EXECJAVA=start "Tomcat" %_RUNJAVA%
goto gotTitle
:noTitle
set _EXECJAVA=start %_RUNJAVA%
:gotTitle
if not ""%1"" == ""-security"" goto execCmd
shift
echo Using Security Manager
set SECURITY_POLICY_FILE=%CATA
goto execCmd
:doStop
shift
set ACTION=stop
goto execCmd
:execCmd
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_AR
shift
goto setArgs
:doneSetArgs
rem Execute Java with the applicable properties
if not "%JPDA%" == "" goto doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAV
goto end
:doSecurity
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAV
goto end
:doJpda
if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xrunjdwp:transport=%JPDA_
goto end
:end
ASKER
ok .. here is the problem.
when the server starts , it pops up the error message ' Windows cannot find : "-Dsun.io.canoncaches=fals e" ' .
i searched for "-Dsun.io.canoncaches=fals e" , and found that it is a line of code in "catalina.bat".
These are all the environment variables i have :
variable value
CATALINA_HOME set CATALINA_HOME=C:\Program Files\Apache Group\Tomcat 4.1\bin
JAVA_HOME set JAVA_HOME=C:\j2sdk1.4.2_06 \bin
PATH PATH=%PATH%c:\j2sdk1.4.2_0 6\bin;%CAT ALINA_HOME %\bin
could you please help me out..
thanks,
J
when the server starts , it pops up the error message ' Windows cannot find : "-Dsun.io.canoncaches=fals
i searched for "-Dsun.io.canoncaches=fals
These are all the environment variables i have :
variable value
CATALINA_HOME set CATALINA_HOME=C:\Program Files\Apache Group\Tomcat 4.1\bin
JAVA_HOME set JAVA_HOME=C:\j2sdk1.4.2_06
PATH PATH=%PATH%c:\j2sdk1.4.2_0
could you please help me out..
thanks,
J
your environment variables should be
CATALINA_HOME set CATALINA_HOME=C:\Program Files\Apache Group\Tomcat 4.1
JAVA_HOME set JAVA_HOME=C:\j2sdk1.4.2_06
dont add the bin directory in your CATALINA_HOME and JAVA_HOME variables
CATALINA_HOME set CATALINA_HOME=C:\Program Files\Apache Group\Tomcat 4.1
JAVA_HOME set JAVA_HOME=C:\j2sdk1.4.2_06
dont add the bin directory in your CATALINA_HOME and JAVA_HOME variables
ASKER
it still says "catalina_home " variable is not defined correctly .
thanks,
J
thanks,
J
try this
set CATALINA_HOME=C:\Progra~1\ Apache Group\Tomcat 4.1
set CATALINA_HOME=C:\Progra~1\
try this
set CATALINA_HOME=C:\Progra~1\ Apache~1\T omcat 4.1
set CATALINA_HOME=C:\Progra~1\
>>it still says "catalina_home " variable is not defined correctly .
It will, as it should not contain spaces. Use
set CATALINA_HOME="C:\Program Files\Apache Group\Tomcat 4.1"
It will, as it should not contain spaces. Use
set CATALINA_HOME="C:\Program Files\Apache Group\Tomcat 4.1"
ASKER
no difference ,,doesnt work
when set to :
set CATALINA_HOME=C:\Progra~1\ Apache~1\T omcat 4.1
it says --.>"catalina_home " variable is not defined correctly
and
when set to:
set CATALINA_HOME="C:\Program Files\Apache Group\Tomcat 4.1"
it says --> File\Apache was unexpected at this time.
thanks,
J
when set to :
set CATALINA_HOME=C:\Progra~1\
it says --.>"catalina_home " variable is not defined correctly
and
when set to:
set CATALINA_HOME="C:\Program Files\Apache Group\Tomcat 4.1"
it says --> File\Apache was unexpected at this time.
thanks,
J
Add these lines in your startup.bat after this line rem Guess CATALINA_HOME if not defined
set JAVA_HOME=C:\j2sdk1.4.2_06
set CATALINA_HOME=C:\Progra~1\ Apache~1\T omcat 4.1
set JAVA_HOME=C:\j2sdk1.4.2_06
set CATALINA_HOME=C:\Progra~1\
Personally i'd set those environment variables through Windows itself. Go
Start|Help
and look up 'environment variable' for your version of Windows
Start|Help
and look up 'environment variable' for your version of Windows
ASKER
ok ..i did the following steps :
<<<<<
Add these lines in your startup.bat after this line rem Guess CATALINA_HOME if not defined
set JAVA_HOME=C:\j2sdk1.4.2_06
set CATALINA_HOME=C:\Progra~1\ Apache~1\T omcat 4.1
>>>>>>
now i dont get any error messages ...Now it opens an other window with the label Tomcat and quickly dissapears...
looks like we are getting close..
thanks,
J
<<<<<
Add these lines in your startup.bat after this line rem Guess CATALINA_HOME if not defined
set JAVA_HOME=C:\j2sdk1.4.2_06
set CATALINA_HOME=C:\Progra~1\
>>>>>>
now i dont get any error messages ...Now it opens an other window with the label Tomcat and quickly dissapears...
looks like we are getting close..
thanks,
J
ok, good.
now go to startup.bat and change this line
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
to
call "%EXECUTABLE%" run %CMD_LINE_ARGS%
then you can post whatever error you r getting here
now go to startup.bat and change this line
call "%EXECUTABLE%" start %CMD_LINE_ARGS%
to
call "%EXECUTABLE%" run %CMD_LINE_ARGS%
then you can post whatever error you r getting here
ASKER
ther are a whole bunch of errors ..it starts with
java.net.bind exception :address already in use JVM_BINDPOINT:80
at org.apache.tomcat.util.net .poolTCPen dpoint.Ini tendPoint( poolTCPend point.java )
and goes on and on
java.net.bind exception :address already in use JVM_BINDPOINT:80
at org.apache.tomcat.util.net
and goes on and on
that means your port 80 is already being used by a different address. you need to change this port number to different one or you need to shutdown the process which is using port 80 and then start your tomcat.
go to tomcat->conf folder and change the port number located in server.xml change the port number to 10110 or any number greater than 5000 and then restart your tomcat. otherwise you can post your server.xml here
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true " />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
go to tomcat->conf folder and change the port number located in server.xml change the port number to 10110 or any number greater than 5000 and then restart your tomcat. otherwise you can post your server.xml here
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
ASKER
ok
Now, which port number should be changed with 10110.
there is
server port = 8005 shutdown=SHUTDOWN debug=0
there is port 8009
there is port 8002 ..
ect..
thanks,
J
Now, which port number should be changed with 10110.
there is
server port = 8005 shutdown=SHUTDOWN debug=0
there is port 8009
there is port 8002 ..
ect..
thanks,
J
i have posted the lines where u need to change. dont change anything other than what i have posted in my previous comment. after you change the port while accessing the server you need to use http://localhost:10110
just go to the line
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080"
in your server.xml and then change the port number as specified
just go to the line
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080"
in your server.xml and then change the port number as specified
ASKER
ok ,,,,in my server.xml ,there is not port with the number "8080".. there is 8081, 8443, 8082,8083,,ect.
The only instance where 8080 is mentioned is this:
by default a non-ssl/1.1 connector is established on port 8080. You can also enable
non-ssl/1.1 connector on port 8443.........
thanks,
J
The only instance where 8080 is mentioned is this:
by default a non-ssl/1.1 connector is established on port 8080. You can also enable
non-ssl/1.1 connector on port 8443.........
thanks,
J
ok, fine. but do u have the lines which i am mentioning. just change whatever port number is there and restart.
just go to the line
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="xxxxx"
in your server.xml and then change the port number as specified
or better still post your full server.xml here
just go to the line
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="xxxxx"
in your server.xml and then change the port number as specified
or better still post your full server.xml here
ASKER
ok ...is it possible for me to copy paste the server.xml code
I am looking at server.xml from the dos prompt->edit mode..
I guess copy -paste doesnt work..is there any other way..
thanks,
J
I am looking at server.xml from the dos prompt->edit mode..
I guess copy -paste doesnt work..is there any other way..
thanks,
J
there is a menu option for copy. first select all the lines or the lines which i have mentioned and then go to Edit->Copy.
ok, atleast can you see and type the lines which i am telling
ASKER
I DO NOT HAVE
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="xxxxx"
THERE IS
<define a non-ssl coyote HTTP/1.1 Connector on port 8081 >
connector class name = "org.apache.coyote.tomcat4 .coyotecon nector" port ="80"
minprocessors=5...ect
and there is
<!-- Define a non-SSL HTTP/1.1 Connector on port 8443 -->
<port="8443"
...everything but 8080 is missing ...
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="xxxxx"
THERE IS
<define a non-ssl coyote HTTP/1.1 Connector on port 8081 >
connector class name = "org.apache.coyote.tomcat4
minprocessors=5...ect
and there is
<!-- Define a non-SSL HTTP/1.1 Connector on port 8443 -->
<port="8443"
...everything but 8080 is missing ...
ok, good. now change the line
connector class name = "org.apache.coyote.tomcat4 .coyotecon nector" port ="80"
to some other port number and start the tomcat. Access your server as i have told before using the port number which u give here
this should work now!!!!!!!!!!!!!!!!!!!!!!! !!
connector class name = "org.apache.coyote.tomcat4
to some other port number and start the tomcat. Access your server as i have told before using the port number which u give here
this should work now!!!!!!!!!!!!!!!!!!!!!!!
ASKER
excellent ..thanks...
ASKER
one last question...
where do i save the java servelt files ....and where should i run javac from....
thanks,
J
where do i save the java servelt files ....and where should i run javac from....
thanks,
J
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks kiranhk.
http://www.javaworld.com/javaworld/jw-02-2001/jw-0223-servletweblogic_p.html