Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 171487
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: William L. Thomson Jr. (RETIRED) <wltjr@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Paul Austin <paul@austin.name>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 171487 depends on: Show dependency tree
Bug 171487 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-03-19 21:48 0000
The init script for tomcat-5.5 is run as root, so running java-config will
return the root user's JAVA_HOME variable. When ideally you should be able to
get it to use the VM defined for the tomcat user instead.

The real issue is that root can only have a 1.4.x as it's java VM and some web
apps need 1.5.

Manually setting the VM is an option but it defeats the purpose of the
java-config approach and will need changing on each VM upgrade.

Paul

------- Comment #1 From Paul Austin 2007-03-19 21:53:12 0000 -------
using the following in /etc/conf.d/tomcat-55 will do the trick

JAVA_HOME=`su -c "java-config --jre-home" tomcat`

------- Comment #2 From Petteri Räty 2007-03-19 22:27:19 0000 -------
(In reply to comment #1)
> using the following in /etc/conf.d/tomcat-55 will do the trick
> 
> JAVA_HOME=`su -c "java-config --jre-home" tomcat`
> 

Or just use GENTOO_VM in conf.d. Like export GENTOO_VM="sun-jdk-1.6"

betelgeuse@pena ~ $ java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Server VM (build 1.5.0_11-b03, mixed mode)
betelgeuse@pena ~ $ GENTOO_VM="sun-jdk-1.6" java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)

I have been saying that we should provide a documented way in the conf.d file
to use the vmhandle to specific a VM different from the root vm. Of course we
should still keep the option of giving it by path as it's quite easy to do.

> 
> The real issue is that root can only have a 1.4.x as it's java VM and some web
> apps need 1.5.
> 

I haven't heard of any such restrictions. Care to elaborate?

------- Comment #3 From Josh Nichols (RETIRED) 2007-03-19 22:31:55 0000 -------
As for needing 1.4 as the system vm, this hasn't been true for some time, like
8 months or so. root VM can be whatever you want with the new Java system.

One problem with using tomcat's user vm, is that by default, tomcat's home is
/dev/null, and the setting for the user vm gets saved in the home directory...

The typical way to configure the vm used is documented at
http://www.gentoo.org/proj/en/java/tomcat-guide.xml under 'Using a Specific VM'

------- Comment #4 From Petteri Räty 2007-03-19 22:42:07 0000 -------
Just came to think that it wouldn't be a bad idea to support for example:
java-config --jdk-home <vmhandle>
Now this just prints the in use one.

------- Comment #5 From Paul Austin 2007-03-19 22:48:32 0000 -------
The GENTOO_VM approach will work, thanks.

When you try to set the user VM to anything other than the system VM it gives
an error and Gentoo recommends to use a 1.4 vm as the system VM.

root# java-config -L
The following VMs are available for generation-2:
*)      Sun JDK 1.4.2.13 [sun-jdk-1.4]
2)      Sun JDK 1.5.0.11 [sun-jdk-1.5]
3)      Sun JDK 1.6.0 [sun-jdk-1.6]

root# java-config -s 2
!!! ERROR: The user 'root' should always use the System VM

------- Comment #6 From Krzysiek Pawlik 2007-03-19 22:55:32 0000 -------
(In reply to comment #2)
> (In reply to comment #1)
> > using the following in /etc/conf.d/tomcat-55 will do the trick
> > 
> > JAVA_HOME=`su -c "java-config --jre-home" tomcat`
> > 
> 
> Or just use GENTOO_VM in conf.d. Like export GENTOO_VM="sun-jdk-1.6"

This aproach works, and I'm using it in resin init.d/conf.d scrips.

------- Comment #7 From Josh Nichols (RETIRED) 2007-03-20 00:06:45 0000 -------
(In reply to comment #5)
> When you try to set the user VM to anything other than the system VM it gives
> an error and Gentoo recommends to use a 1.4 vm as the system VM.

That is no longer true, and hasn't, as I mentioned, for several months now.

I think you are thinking about the 'generation-1' system vm, which is only
allowed to be a 1.4 jdk, because this is used for building old generation-1
packages which expect to be built with 1.4.

For 'generation-2', that is no longer a limitation, as there is a difference
between system vm and the vm used for building.

------- Comment #8 From William L. Thomson Jr. (RETIRED) 2007-04-19 16:35:57 0000 -------
Fixed in -r3, JAVA_HOME has been moved to init script, and GENTOO_VM can now be
set in conf.d file.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug