Bug 32081 - Wrapper scripts require a JDK to be present.
Summary: Wrapper scripts require a JDK to be present.
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Native:Integration (show other bugs)
Version: 5.5.14
Hardware: All Windows XP
: P5 trivial with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 32669 32793 36663 38967 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-05 13:02 UTC by Alexis O'Connor
Modified: 2006-10-07 14:13 UTC (History)
4 users (show)



Attachments
update setclasspath.sh to run with JRE (2.47 KB, patch)
2005-01-10 02:48 UTC, Ben Souther
Details | Diff
update catalina.sh to run with JRE (2.47 KB, patch)
2005-01-10 02:49 UTC, Ben Souther
Details | Diff
Patches for catalina.sh and setclasspath.sh (5.25 KB, patch)
2005-01-10 18:51 UTC, Ben Souther
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis O'Connor 2004-11-05 13:02:43 UTC
A distribution as-is will not run with a JRE. This is because wrapper scripts
look  for executables associated with a JDK such as jdb etc, as well as java.
These occur in the files $CATALINA_HOME/bin/setclasspath.bat and
$CATALINA_HOME/bin/setclasspath.sh. The following patches alter these scripts in
the following way:

1) they only look for the required files associated with a JRE, e.g. java.
2) if not found, the message has been changed to say that JAVA_HOME should point
to a JDK or a JRE.

Here is a patch for $CATALINA_HOME/bin/setclasspath.bat:

--- setclasspath.bat	Fri Oct 29 20:13:00 2004
+++ setclasspath2.bat	Fri Nov  5 10:57:56 2004
@@ -12,13 +12,11 @@
 :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
-echo NB: JAVA_HOME should point to a JDK not a JRE
+echo NB: JAVA_HOME should point to a JDK or a JRE
 goto exit
 :okJavaHome
 
@@ -55,3 +53,4 @@
 exit /b 1
 
 :end
+

Here is a patch for $CATALINA_HOME/bin/setclasspath.sh

--- setclasspath.sh	Fri Oct 29 20:13:00 2004
+++ setclasspath2.sh	Fri Nov  5 12:22:55 2004
@@ -18,10 +18,10 @@
     exit 1
   fi
 else
-  if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x
"$JAVA_HOME"/bin/javac ]; then
+  if [ ! -x "$JAVA_HOME"/bin/java ]; then
     echo "The JAVA_HOME environment variable is not defined correctly"
     echo "This environment variable is needed to run this program"
-    echo "NB: JAVA_HOME should point to a JDK not a JRE"
+    echo "NB: JAVA_HOME should point to a JDK or a JRE"
     exit 1
   fi
 fi
@@ -59,3 +59,4 @@
   _RUNJDB="$JAVA_HOME"/bin/jdb
 fi
 _RUNJAVAC="$JAVA_HOME"/bin/javac
+
Comment 1 Remy Maucherat 2004-11-05 13:19:56 UTC
I sort of agree with the bug report, but not really with the solution.
AFAIK, most other programs which use JAVA_HOME expect a JDK, and some of the
features of the scripts also use the JDK (ex: jdb).
The fact that Tomcat fully works with the JRE is used for the Windows installer,
and stuff like that, but in the scripts it is a problem IMO.
Comment 2 Yoav Shapira 2004-12-13 17:36:34 UTC
*** Bug 32669 has been marked as a duplicate of this bug. ***
Comment 3 Ben Souther 2004-12-15 23:29:39 UTC
>I sort of agree with the bug report, but not really with the solution.
>AFAIK, most other programs which use JAVA_HOME expect a JDK,

What about looking for JRE_HOME if JAVA_HOME is not found?
Comment 4 Ben Souther 2004-12-28 03:32:48 UTC
*** Bug 32793 has been marked as a duplicate of this bug. ***
Comment 5 Remy Maucherat 2005-01-03 17:51:10 UTC
Using a second JRE_HOME (initialized to JAVA_HOME if blank) for the "base"
features of the scripts is indeed a possibility.
Comment 6 Ben Souther 2005-01-05 03:38:49 UTC
> Using a second JRE_HOME (initialized to JAVA_HOME if blank) for the 
> "base" features of the scripts is indeed a possibility.

In the event that both are set, which should it prefer?
If JRE_HOME, should it fail when the 'debug' arg is present, even if JAVA_HOME set?

I've got rough drafts of the bash scripts running with the JRE on FC2 now.
Comment 7 Ben Souther 2005-01-10 02:48:33 UTC
Created attachment 13961 [details]
update setclasspath.sh to run with JRE

Tested on FC3
Comment 8 Ben Souther 2005-01-10 02:49:18 UTC
Created attachment 13962 [details]
update catalina.sh to run with JRE

Tested on FC3
Comment 9 Remy Maucherat 2005-01-10 17:55:10 UTC
I would like to resolve this issue in the next build (5.5.7).

I have some questions:
- [ -n "$JRE_HOME" ] && JAVA_HOME=`cygpath --unix "$JRE_HOME"` doesn't seem
right to me; shouldn't it be [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix
"$JRE_HOME"` ?
- you attached the wrong diff for setclasspath.sh, can you fix it ?
- can you remove the debug stuff from your catalina.sh patch ? ;)
Comment 10 Ben Souther 2005-01-10 18:51:54 UTC
Created attachment 13967 [details]
Patches for catalina.sh and setclasspath.sh

Yes to all questions and sorry about the sloppiness.
Comment 11 Remy Maucherat 2005-01-10 19:22:02 UTC
That looks good. Thanks.

I'm adding back the #!/bin/sh at the beginning of catalina.sh, though. Any
reason why it's removed ?

I'm leaving the bug open for Windows, but I really don't care about the problem
(most users of the batch scripts on Windows will be developers, which means they
have the JDK).
Comment 12 Ben Souther 2005-01-10 19:30:10 UTC
> I'm adding back the #!/bin/sh at the beginning of catalina.sh, though. Any
> reason why it's removed ?
No, it should be there.

> I'm leaving the bug open for Windows, but I really don't care about the problem
> (most users of the batch scripts on Windows will be developers, which means they
> have the JDK).
I'll do the same for the batch scripts to keep them consistent with the shell
scripts.

Thank you
-Ben
Comment 13 Las 2005-10-25 11:56:58 UTC
On starting the tomcat server the following error message is displayed
"The system cannot find the file 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager."
Comment 14 Yoav Shapira 2005-11-18 16:46:23 UTC
Ben, any luck putting together the same type of patch for the Windows batch
scripts?  If you have it, I'll gladly look at / apply it.

Las, besides not being able to reproduce what you're claiming, I'm not sure it's
related to this specific Bugzilla issue.  I'd try asking on the
users@tomcat.apache.org list if I were you.
Comment 15 Keith Wannamaker 2005-12-08 22:45:06 UTC
ported the patch to the win32 scripts
Comment 16 Christian Rueedi 2006-01-04 23:57:28 UTC
Just faced this problem today in the 5.5.14 release. When will this patch be added? 
Comment 17 Yoav Shapira 2006-01-10 17:03:41 UTC
Look at the very first item on the 5.5.15 (not 5.5.14 ;)) change log.
Comment 18 Keith Wannamaker 2006-03-14 21:22:41 UTC
*** Bug 38967 has been marked as a duplicate of this bug. ***
Comment 19 Mark Thomas 2006-10-07 14:13:59 UTC
*** Bug 36663 has been marked as a duplicate of this bug. ***