commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wade Chandler <wchand...@redesetgrow.com>
Subject Re: commons-daemon - JSVC and Kaffe
Date Mon, 03 Jan 2005 16:44:20 GMT
Ryan Harris wrote:
> I'm running tomcat 5.54 on the "free" kaffe vm instead of Sun's JDK.
> When I start tomcat with the startup.sh script as root, everything runs
> perfectly. However I'm having trouble launching the process with JSVC.
> Does anybody know if JSVC can be made to work with java VMs other than
> SUN's?
>    
> Jsvc debug output says it cannot find the file  jvm.cfg, and also the
> actual vm file library names from the sun jdk appear to be hard-coded
> into the jsvc source because they cannot be found in the kaffe vm as
> well.
>   
> If anyone has any helpful information, I would be most grateful.
> It is disappointing that Tomcat 5.5.4 runs perfectly on Kaffe only to be
> stopped by limitations in the commons-daemon...  Perhaps there is
> another way to run tomcat 5.54 on port 80 as an unprivileged user in
> linux?
> 
> thank you, Ryan Harris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

Ok, I'm going to paste some source then talk about it.  First I don't 
know if Kaffe supports JNI or not.  If it does then this should 
work.....not done it, but it should work.

/* The jvm.cfg file defines the VMs available for invocation. So far, on all
    all systems I've seen it's in $JAVA_HOME/lib. If this file is not found,
    then the "default" VMs (from location_jvm_default) is searched, 
otherwise,
    we're going to look thru the "configured" VMs (from lod_cfgvm) lying
    somewhere around JAVA_HOME. (Only two, I'm happy) */
char *location_jvm_cfg[] = {
     "$JAVA_HOME/jre/lib/jvm.cfg", /* JDK */
     "$JAVA_HOME/lib/jvm.cfg",     /* JRE */
     NULL,
};

/* This is the list of "defaults" VM (searched when jvm.cfg is not found, as
    in the case of most JDKs 1.2.2 */
char *location_jvm_default[] = {
#if defined(OS_DARWIN)
     "$JAVA_HOME/../Libraries/libjvm.dylib",
#elif defined(OS_CYGWIN)
     "$JAVA_HOME/jre/bin/classic/jvm.dll",           /* Sun JDK 1.3 */
     "$JAVA_HOME/jre/bin/client/jvm.dll",            /* Sun JDK 1.4 */
#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || 
defined(OS_SYSV) || defined(OS_FREEBSD)
     "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.so", /* Sun JDK 1.2 */
     "$JAVA_HOME/jre/lib/" CPU "/client/libjvm.so",  /* Sun JDK 1.3 */
     "$JAVA_HOME/jre/lib/" CPU "/libjvm.so",         /* Sun JDK */
     "$JAVA_HOME/lib/" CPU "/classic/libjvm.so",     /* Sun JRE 1.2 */
     "$JAVA_HOME/lib/" CPU "/client/libjvm.so",      /* Sun JRE 1.3 */
     "$JAVA_HOME/lib/" CPU "/libjvm.so",             /* Sun JRE */
     "$JAVA_HOME/jre/bin/" CPU "/classic/libjvm.so", /* IBM JDK 1.3 */
     "$JAVA_HOME/jre/bin/" CPU "/libjvm.so",         /* IBM JDK */
     "$JAVA_HOME/bin/" CPU "/classic/libjvm.so",     /* IBM JRE 1.3 */
     "$JAVA_HOME/bin/" CPU "/libjvm.so",             /* IBM JRE */
     /* Those are "weirdos: if we got here, we're probably in troubles and
        we're not going to find anything, but hope never dies... */
     "$JAVA_HOME/jre/lib/" CPU "/classic/green_threads/libjvm.so",
     "$JAVA_HOME/jre/lib/classic/libjvm.so",
     "$JAVA_HOME/jre/lib/client/libjvm.so",
     "$JAVA_HOME/jre/lib/libjvm.so",
     "$JAVA_HOME/lib/classic/libjvm.so",
     "$JAVA_HOME/lib/client/libjvm.so",
     "$JAVA_HOME/lib/libjvm.so",
     "$JAVA_HOME/jre/bin/classic/libjvm.so",
     "$JAVA_HOME/jre/bin/client/libjvm.so",
     "$JAVA_HOME/jre/bin/libjvm.so",
     "$JAVA_HOME/bin/classic/libjvm.so",
     "$JAVA_HOME/bin/client/libjvm.so",
     "$JAVA_HOME/bin/libjvm.so",
#endif
     NULL,
};

/* This is the list of "configured" VM (searched when jvm.cfg is found, as
    in the case of most JDKs 1.3 (not IBM, for example), way easier than
    before, and lovely, indeed... */
char *location_jvm_configured[] = {
#if defined(OS_DARWIN)
     "$JAVA_HOME/../Libraries/lib$VM_NAME.dylib",
#elif defined(OS_CYGWIN)
     "$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll",          /* Sun JDK 1.3 */
#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || 
defined(OS_FREEBSD)
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.so",/* Sun JDK 1.3 */
     "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.so",    /* Sun JRE 1.3 */
#elif defined(OS_SYSV)
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/dce_threads/libjvm.so",
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/green_threads/libjvm.so",
     "$JAVA_HOME/lib/" CPU "/$VM_NAME/dce_threads/libjvm.so",
     "$JAVA_HOME/lib/" CPU "/$VM_NAME/green_threads/libjvm.so",
#endif
     NULL,
};


1)
The file you will need to edit if you go this way will be 
<project>/src/native/unix/native/location.c

2-4 are one option and 5 is another option in itself.

2)
The location_jvm_cfg variable tells where the jvm.cfg file is.  I don't 
know much about Kaffe, but if it doesn't have a server and client then 
jvm.cfg really means nothing and you need only a default jvm.  If it 
does have different vms (i.e. Sun and IBM both have server and client in 
their latest releases) and you want to be able to use one then you need 
to also have a configured vm and you also need to have a line for the 
jvm.cfg file location or you need to make a symlink to the file to match 
the lines.....see man ln.

3) If you only want to use a default vm then add a line to the 
location_jvm_default variable like:
"$JAVA_HOME/kaffe_lib/jvm.so", /* I don't know the dir setup */

4) If you want to use a jvm.cfg file then make one....get a sun jre and 
examine that then look at it real good then examine the variable 
location_jvm_configured to understand how it works...it's pretty simple. 
  After you see the .cfg file and you know whether Kaffe supports 
different vm configurations and has different .so's or symlinks for them 
add your lines to the location_jvm_configured to match any paths or file 
names you might have.  Then remember that you'll need a $VM_NAME 
replacement in the jvm.cfg file that will work with the added line.

****5 is it's own option
5) You should be able to examine location.c and create symlinks to 
accomplish what you are wanting to do provided that Kaffe supports JNI, 
will follow the sym link correctly, and some how the symlinks file path 
won't screw up the way Kaffe is going to locate relative resources from 
it's files.

Something here should work for you.  Editing the one .c file is really 
easy if you know c at all or just enough to be dangerous ..either 
way...as you already had to build the jsvc yourself I would imagine.

The other option using symlinks would be very fast to test out and see 
if it works.  The logging that the jvm.cfg file doesn't exist will get 
dumped into the log file regardless...I think....even when it isn't an 
error.  It's just some logging...though you should be able to run the 
application.  But, like I said I don't know much about Kaffe, don't know 
if it supports JNI, and if it does I don't know how stable or buggy it's 
JNI code may or may not be.

If you don't know much about symlinks...they are simple. Again....
man ln

May not be the exact answer you are looking for, but if Kaffe supports 
what it needs to to be able to use jsvc the way it is coded then you 
should be able to get it working that way.

I'm not looking at the latest CVS code right now, but I'm sure there is 
a way to make it use java.exe as a child process also and not have to 
only go through JNI.  Someone else might be able to help you there.  I 
might get the code out of CVS later and have a peek, but what I've 
written should work by looking at the code.

Wade


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message