FS#24126 - Tomcat Don't start using Oracle JRE

Attached to Project: Arch Linux
Opened by Leandro Costa (lokidarkeden) - Friday, 06 May 2011, 12:49 GMT
Last edited by Andrea Scarpino (BaSh) - Tuesday, 24 May 2011, 06:00 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Guillaume ALAUX (galaux)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: The package tomcat don't start using the oracle jre/jdk saying "Cannot locate Java Home".


Additional info:
tomcat 5.5.33-1


Steps to reproduce:
Install oracle jre and tomcat: pacman -S jre tomcat
Start the tomcat: /etc/rc.d/tomcat start

Proposed Solution:
Change the /etc/conf.d/tomcat to point to the right java_home place:
# The JAVA_HOME of the JVM for Tomcat to use

if [ -x /usr/lib/jvm/java-6-openjdk ]; then
TOMCAT_JAVA_HOME=/usr/lib/jvm/java-6-openjdk
elif [ -x /opt/java/ ]; then
TOMCAT_JAVA_HOME=/opt/java/
fi

# Tomcat additional commandline options
CATALINA_OPTS=



This task depends upon

Closed by  Andrea Scarpino (BaSh)
Tuesday, 24 May 2011, 06:00 GMT
Reason for closing:  Not a bug
Additional comments about closing:  By default it works with OpenJDK, you have to edit the config file to let it work with Oracle Java
Comment by Ionut Biru (wonder) - Friday, 06 May 2011, 13:10 GMT
you probable didn't relogin after installing jre?
Comment by Leandro Costa (lokidarkeden) - Friday, 06 May 2011, 13:18 GMT
Yeap, I did relogin. Actually I did restar the computer.

something like:

pacman -S jre
pacman -S tomcat
reboot

after the reboot
su

/etc/rc.d/tomcat start
:: Starting Tomcat [BUSY] Cannot locate Java Home
[FAIL]

Same Error.

It works after the alterations I proposed.
Comment by Guillaume ALAUX (galaux) - Friday, 06 May 2011, 13:33 GMT
The general idea is that /etc/conf.d/tomcat is the conf file where YOU need to setup the JVM YOU want to use. By default it is setup to use the openJDK because this is the official JVM that is supported in Arch. So if you want to use an other one like Arch's jre/jdk you need to modify this file.

The solution you propose would not be great if both openjdk6 and jre were installed! Then it would use the first case of your "if" and would ALWAYS go for openjdk.
Comment by Leandro Costa (lokidarkeden) - Friday, 06 May 2011, 13:43 GMT
My is, jre is in the official repo :)
Só I thaught tomcat should be able to start with it.

In any case, the point about to choose a jvm would envolve to create a file to set the variables JVM and JVM_CUSTOM_FOLDER, for example:

. /etc/conf.d/jvm
case "$JVM" in
OPENJDK)
TOMCAT_JAVA_HOME=/usr/lib/jvm/java-6-openjdk
;;
JRE)
TOMCAT_JAVA_HOME=/opt/java
;;
CUSTOM)
TOMCAT_JAVA_HOME=$JVM_CUSTOM_FOLDER
;;

# CHECKING_JAVA_HOME
if [ ! -x $TOMCAT_JAVA_HOME ]; then
echo "FAILED TO LOOKUP THE JAVA HOME";
return 1;
fi


IMHO, this is too much complicate and it's out of the arch way, but it should work with jre since it's in the official repo. :)

Thanks for your attention
Comment by kkl2401 (kkl2401) - Friday, 06 May 2011, 13:54 GMT
As far as I know, openjdk6 and jre conflict with each other, so they can't be by default installed together. I even asked about plans supporting multiple Java environments but they were none at the time. On the other hand both could be considered as "supported" (one being in extra and the other one in community), so to me that proposed it/elif/fi block sounds more or less reasonable.
Comment by Guillaume ALAUX (galaux) - Friday, 06 May 2011, 14:15 GMT
> My is, jre is in the official repo :)
I am not saying jre is not "official"

> Só I thaught tomcat should be able to start with it.
It is! You just need to change the path in /etc/conf.d/tomcat. It is just not automatically done just like in a config file.

> In any case, the point about to choose a jvm would envolve to create a file to set the variables JVM [...] for example /etc/conf.d/jvm
Good idea but I would do it differently: each "java-runtime"-able package (jre, openjdk6) could have a /etc/conf.d/${pkgname} but NO /etc/profile.d and the user could specify what he/she wants through /etc/profile.d/jvm which would point to the conf.d he/she likes.

But that is not a tomcat bug/improvement ;). You might want to change your bug report to target openjdk6.
Comment by Leandro Costa (lokidarkeden) - Friday, 20 May 2011, 18:25 GMT
Hi, I'm here again. I don't wanna to bother you but, when I try to install the tomcat, withot having a java-runtime installed, I get:

pacman -S tomcat
resolving dependencies...
:: There are 2 providers available for java-environment:
:: Repository extra
1) openjdk6
:: Repository community
2) jdk

Enter a number (default=1): 2
looking for inter-conflicts..


So, as I said before, everybody hopes it work with jdk :)

thanks for your attention.
Comment by Guillaume ALAUX (galaux) - Monday, 23 May 2011, 07:45 GMT
> So, as I said before, everybody hopes it work with jdk :)
It does.

What you are asking me to do is to add *code* in a *config* file: /etc/conf.d/tomcat. This is a config file as you can see on the dir name "conf.d". That would be like adding code to the rc.conf. There is no code in these files, just variables set to *default* values. You - the power user - are able and expected to tune these values to fit your needs and desires. The value TOMCAT_JAVA_HOME in /etc/conf.d/tomcat is set to /usr/lib/jvm/java-6-openjdk because the *default* JVM in Arch Linux is the OpenJDK (because this is the most widely used open JDK out there). But once again this is just a default.

Now I understand your last point "when I try to install the tomcat, withot having a java-runtime installed, I get [to choose a JDK but it does not work out of the box]". As I have said before this could be fixed using a conf file for java-runtimes. It just so happens I am working on something related to openjdk so I will try to implement this.
Comment by Leandro Costa (lokidarkeden) - Monday, 23 May 2011, 11:25 GMT
Hi, I', giving up hehehe.
I understand your point, but I was trying to say just: it's pretty when you say pacman -S somestuff and it works at all.
I know I can just change that line, but, I was cool if it just works with the lot of java runtime we have ( two :).

So I'm leaving this post.

Any way, thank you for your attention and time for aswering me.

Loading...