Peter Donald wrote:
On Sun, 9 Dec 2001 20:41, Leif Mortenson wrote:
Thanks, I appreciate the kudos.  I have actually already implemented a
class which launches Phoenix using the Wrapper. I was planning to
submit it after I found out you whether you would implement the changes
I suggested and I finished testing it. I'll go over yours and my
implementations on Monday when I have the code in front of me and let
you know if I have any suggested changes.

kool. I copied bits from the ENhydra example so there may be bits that make
no sense - feel free to point them out (specifically thinking about the
timeout stuff around the initialization/start methods).
Ok, here we go. :-)

In the wrapper.conf, file, you have added all of the Phoenix jar files to the classpath. ÂYou don't need this because Phoenix finds and loads all of the classes in the lib directory when it is running. ÂYou only need the following:
ÂÂÂ wrapper.java.classpath.1=phoenix-loader.jar
ÂÂÂ wrapper.java.classpath.2=wrapper.jar


I saw that you had the following line in the wrapper.conf file:
ÂÂÂ #wrapper.java.additional.1=-Dwrapper.debug=true
That will work, but the way we had designed it was to use the wrapper.debug property in wrapper.conf to toggle this. :-)


The run.bat script currently sets the following 4 parameters when it launches Java. ÂCurrently if I set all four then I get security violations. ÂI am not sure if this is because I am doing something wrong. ÂBut if you need to have these set, then that would be done in wrapper.conf as follows.
ÂÂÂ # Java Additional Parameters
ÂÂÂ wrapper.java.additional.1=-Djava.ext.dirs=..\lib
ÂÂÂ wrapper.java.additional.2=-Dphoenix.home=..
ÂÂÂ #wrapper.java.additional.3=-Djava.security.policy=jar:file:../bin/wrapper-loader.jar!/META-INF/java.policy
ÂÂÂ #wrapper.java.additional.4=-Djava.security.manager

I am attaching the new src/conf/wrapper.conf.

For the DaemonLauncher, I am sending you the version that I had written. ÂIt was coded so that it treats class loaders etc exactly like the Main class does. ÂIt also handles error cases while starting much better. ÂThis version does not use an ActionListener. ÂBut it does set the thread's class loader like Main does.
This version also kicks out debug information when wrapper.debug is enabled.

Could you give this version a try and see how you like it.


We were also talking about how to implement the change user feature that you(?) requested. ÂIt should be easy to do, but the user really needs to be set after the application, in this case Phoenix, is completely up and running. ÂThe problem is that because CLIMain.main never returns, there is currently no way to tell whether Phoenix has completed its startup or not.

There are 4 ways we can make this work.
One is for CLIMain.main to return when setup is complete. Â(Hard to do?)

Two is to add a method to CLIMain called isStarted, so that the DaemonLauncher class can loop and wait until a timeout has expired or the server has started.

Three would be for Phoenix to make a callback of some sort when it has started up. Â(Don't really like this)

A fourth way would be to always wait 45 seconds or whatever and then change the user. ÂProblem is that this will cause problems if the server startup takes longer to complete and the user gets changed before it can allocate some port.

I vote for the second one as it seems to fit into the Component model the best.


In the ant.properties.sample file, could you please change the wrapper definitions to the following:

# ----- Java Service Wrapper, version 2.2.3 or later -----
#wrapper.home=${base.path}/wrapper_linux_2.2.3
#wrapper.jar=${wrapper.home}/lib/wrapper.jar
# Linux/Solaris
#wrapper.exe=${wrapper.home}/bin/wrapper
#wrapper.dll=${wrapper.home}/lib/libwrapper.so
# Windows
#wrapper.exe=${wrapper.home}/bin/Wrapper.exe
#wrapper.dll=${wrapper.home}/lib/Wrapper.dll

We cleaned up several things. ÂIncluding the locations of the libraries in 2.2.3. ÂAs well as fixed lots of bugs.


One more thing, is about the scripts used to launch Phoenix using the wrapper. ÂIt doesn't look like they are being included in the wrapper-dist build right now. ÂIt is fairly easy to start and stop the windows version without a batch file, but the scripts for the unix versions provide the ability to start and stop them without having to hit CTRL-C. ÂUseful for when you want to install Phoenix as a daemon on the system.

It doesn't look like there is any plaform specific code in the current build.xml, but it is fairly easy to add checks for the platform so that the correct scripts are copied into the dist/bin directory for each platform.

Let me know what you think, and I can make the changes for you.

Cheers,
Leif

#********************************************************************
# Wrapper parameters
#********************************************************************
# Java Application
wrapper.java.command=java

# Java Main class
wrapper.java.mainclass=org.apache.avalon.phoenix.launcher.DaemonLauncher

# Java Classpath (include wrapper.jar)  Add class path elements as 
wrapper.java.classpath.1=phoenix-loader.jar
wrapper.java.classpath.2=wrapper.jar

# Java Library Path (location of wrapper.lib)
wrapper.java.library.path=./

# Java Additional Parameters
wrapper.java.additional.1=-Djava.ext.dirs=..\lib
wrapper.java.additional.2=-Dphoenix.home=..
wrapper.java.additional.3=-Djava.security.policy=jar:file:../bin/wrapper-loader.jar!/META-INF/java.policy
wrapper.java.additional.4=-Djava.security.manager

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=16

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=64

# Application parameters.  Add parameters as needed starting from 1
#wrapper.app.parameter.1=

# Port which the native wrapper code will attempt to connect to
wrapper.port=15012

# Log file to use for wrapper output logging.
wrapper.logfile=wrapper.log

# Number of seconds to allow for the JVM to be launched and contact the wrapper 
before the
#  wrapper should assume that the JVM is hung and terminate the JVM process.  0 
means never
#  time out.  Defaults to 30 seconds.
wrapper.startup.timeout=30

# Number of seconds to allow between the wrapper pinging the JVM and the 
#  response.  0 means never time out.  Defaults to 30 seconds.
wrapper.ping.timeout=30

# The Wrapper detects when an application calls System.exit() and treats this 
as a request
#  to stop the server by default.
#wrapper.disable_shutdown_hook=TRUE

# Show debug messages
#wrapper.debug=TRUE

#********************************************************************
# Wrapper Unix daemon parameters
#********************************************************************
# File to write process ID to
wrapper.pidfile=var/run/phoenix.pid

#********************************************************************
# Wrapper NT Service parameters
#********************************************************************
# WARNING - Do not modify any of these parameters when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifing this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.ntservice.name=Phoenix

# Display name of the service
wrapper.ntservice.displayname=Phoenix Application Server

# Service dependencies.  Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=

# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to