|
From: Leif M. <le...@ta...> - 2008-05-28 15:00:56
|
Bastian, The restarting functionality was designed to work around port locking problems on Solaris and other UNIX platforms. If Tomcat or some similar application crashed, the ports it had locked would stay locked for up to 2 minutes. This would cause an initial restart to sometimes fail. If the restarts continue to fail repeatedly then the Wrapper assumes that the problem is permanent and gives up. Looking at your wrapper.conf, it looks like you discovered both of the required properties: http://wrapper.tanukisoftware.org/doc/english/prop-max-failed-invocations.html http://wrapper.tanukisoftware.org/doc/english/prop-successful-invocation-time.html The first, wrapper.max_failed_invocations, configures how many failed restarts in a row will be allowed before the Wrapper gives up and exits. You can leave this at the default of 5. The second, wrapper.successful_invocation_time, sets the number of seconds that the JVM must be running before it is considered a successful invocation. If the invocation is successful, the above restart count will be reset. You want to choose a wrapper.successful_invocation_time value that is short enough that the count will always be reset if your application starts successfully, but long enough that it won't loop infinitely if you have a configuration error. This is something that you will have to try be seeing how long your program takes to run. Something like this: wrapper.successful_invocation_time=10 If you want to wait a while before launching the next JVM, you can do this as follows: wrapper.restart.delay=60 The above is all supported with the Community Edition. The Professional Edition also makes it possible to schedule cron job like restarts as follows: To restart every 15 seconds: ---- wrapper.timer.1.interval=second=*/15 wrapper.timer.1.action=RESTART ---- To restart every night at 4:30am: ---- wrapper.timer.1.interval=hour=4; minute=30; wrapper.timer.1.action=RESTART ---- To restart every Monday night at 4:30am: ---- wrapper.timer.1.interval=day-of-week=1; hour=4; minute=30; wrapper.timer.1.action=RESTART ---- Hope this helps, Cheers, Leif Bastian Schurr wrote: > Hi, > i have a service which should be restarted after running every time to avoide storage problems in my JVM. So after doing its normal work WrapperManager.restart() is called and JVM should be resetted. > > But after 5 restarts I got the following output in my wrapper logfile > > ... > STATUS | wrapper | 2008/05/27 08:15:33 | JVM requested a restart. > FATAL | wrapper | 2008/05/27 08:15:35 | There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up. > FATAL | wrapper | 2008/05/27 08:15:35 | There may be a configuration problem: please check the logs. > STATUS | wrapper | 2008/05/27 08:15:35 | <-- Wrapper Stopped > > and my wrapper doesn't restart anymore. I have to run the install.bat file to get a new wrapper. > > I know the key "wrapper.max_failed_invocations", but increasing this key will only hide the problem of failed launches. I have also tested setting the key "wrapper.restart.delay" from 5 to 10 seconds but this dosn't change anything. > > --> What can I do to get no failed launches in the wrapper or to restart my JVM as often I want? > > Here is a short view to my application: > > public class RemoteMain implements WrapperListener { > ... > public static void main(String[] args){ > try { > WrapperManager.start(new RemoteEncoMain(), args); > } catch (Exception e){e.printStrackTrace()} > } > > public Integer start(String[] args) { > //create a ServerController > serverController = new ServerController(showTrayIcon); > > //initialize the services for this ServerController > initCajoService(args); > > try { > serverController.startServer(cajoPort, iconString); > } catch (Exception e) {e.printStrackTrace()} > } > ... > } > > > public class ServerController{ > ... > > //this is my service > public AbstractService service; > > //the startServer method called from start > public void startServer(int serverPort, String iconString) throws UnknownHostException, RemoteException { > if (showTrayIcon) { > new TrayIconManager().initTrayIcon(iconString, serverPort); > } > CajoReceiver.initServer(serverPort); > > // bind services as cajo service > CajoReceiver.bindService(service, service.getServiceName()); > } > > ... > } > > This is my configuration file: > #******************************************************************** > # Service Wrapper Properties > # > #******************************************************************** > # Java Application > wrapper.java.command=C:/jre1.5.0_12/bin/java > > # Java Main class. This class must implement the WrapperListener interface > # or guarantee that the WrapperManager class is initialized. Helper > # classes are provided to do this for you. See the Integration section > # of the documentation for details. > wrapper.java.mainclass=de.server.RemoteMain > > > set.MYAPP_HOME=C:/myapp > > # Java Classpath (include wrapper.jar) Add class path elements as > # needed starting from 1 > ... > > > # Java Library Path (location of Wrapper.DLL or libwrapper.so) > wrapper.java.library.path.1=%MYAPP_HOME%/sys/win32/lib > > # Java Additional Parameters > wrapper.java.additional.1=-DPLM++WORKDIR=C:\Temp_Server\ > wrapper.java.additional.2=-DPLM++USE_FS=FALSE > wrapper.java.additional.3=-DPLM++USE_READONLY=true > wrapper.java.additional.4=-Dsystem.start.instdir=C:\myapp > wrapper.java.additional.5=-Dsystem.start.bindir=C:\myapp\sys\win32\bin > wrapper.java.additional.6=-Dsystem.start.datadir=C:\myapp\data > wrapper.java.additional.7=-Dsystem.start.tmpdir=C:\Temp_Server\ > wrapper.java.additional.8=-Dsystem.start.custpref=default.txt > wrapper.java.additional.9=-Djava.library.path=C:\myapp\sys\win32\lib > wrapper.java.additional.10=-DPLM++AUTO_START_OM=false > wrapper.java.additional.11=-Dsystem.log.console=yes > wrapper.java.additional.12=-DPLM++OML=7506 > wrapper.java.additional.13=-DPLM++LANGUAGE=DE > wrapper.java.additional.14=-Xmx512M > wrapper.java.additional.15=-Xms64M > > # Initial Java Heap Size (in MB) > wrapper.java.initmemory=64 > > # Maximum Java Heap Size (in MB) > wrapper.java.maxmemory=512 > > # Application parameters. Add parameters as needed starting from 1 > wrapper.app.parameter.1=TRAYICON > wrapper.app.parameter.2=CAJOSERVER > wrapper.app.parameter.3=1198 > wrapper.app.parameter.4=server.ico > > #******************************************************************** > # Wrapper Logging Properties > #******************************************************************** > # Format of output for the console. (default: PM) > wrapper.console.format=PM > > # Log level for console output. (default: INFO) > wrapper.console.loglevel=INFO > > # Log file to use for wrapper output logging. > wrapper.logfile=../logs/wrapper_server_ROLLNUM.log > > # Format of output for the log file. (default: LPTM) > wrapper.logfile.format=LPDTM > > # Log level for log file output. (default: INFO) > wrapper.logfile.loglevel=INFO > > # Maximum size that the log file will be allowed to grow to before > # the log is rolled. Size is specified in bytes. The default value > # of 0, disables log rolling. May abbreviate with the 'k' (kb) or > # 'm' (mb) suffix. For example: 10m = 10 megabytes. > wrapper.logfile.maxsize=10m > > # Maximum number of rolled log files which will be allowed before old > # files are deleted. The default value of 0 implies no limit. > wrapper.logfile.maxfiles=10 > > # Log level for sys/event log output. (default: NONE) > wrapper.syslog.loglevel=NONE > > > #******************************************************************** > # Wrapper Windows Properties > #******************************************************************** > # Title to use when running as a console > wrapper.console.title=MyAPP Server > > #******************************************************************** > # Wrapper Windows NT/2000/XP Service Properties > #******************************************************************** > # WARNING - Do not modify any of these properties when an application > # using this configuration file has been installed as a service. > # Please uninstall the service before modifying this section. The > # service can then be reinstalled. > > # Name of the service > wrapper.ntservice.name=myapp_server > > # Display name of the service > wrapper.ntservice.displayname=MyApp Server > > # Description of the service > wrapper.ntservice.description=MyApp 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=DEMAND_START > > # Allow the service to interact with the desktop. > wrapper.ntservice.interactive=true > > #******************************************************************** > # Wrapper Restart Properties > #******************************************************************** > > # Controls whether or not the Wrapper configuration file will be > # reloaded in the event of a JVM restart. (default: FALSE) > wrapper.restart.reload_configuration=TRUE > > # Controls the number of seconds to pause between a JVM exiting for > # any reason, and a new JVM being launched. (default: 5) > wrapper.restart.delay=10 > > # Maximum number of times that the Wrapper will attempt to restart > # the JVM if each attempted invocation exits abnormally or is > # restarted shortly after having being launched. (default: 5) > # > # If the JVM was running for a period longer than the value set in > # the wrapper.successful_invocation_time property, then the restart > # count will be reset to 0. So this count only applies to JVM > # invocations which fail on startup. > wrapper.max_failed_invocations=5 > > # Specifies the amount of time that an application must remain > # running before it will be considered to have been a successful > # invocation. (default: 300) > wrapper.successful_invocation_time=300 > > # This property makes it possible to control whether or not multiple > # invocations of a given application can be run at the same time. > # (default: FALSE) > wrapper.single_invocation=FALSE > > > #******************************************************************** > # Wrapper Debug Properties > #******************************************************************** > > # Used to quickly enable debug logging both to the console and log > # file. Disabling this flag does not disable debug logging to the > # console or log file. (default: FALSE) > wrapper.debug=TRUE > #******************************************************************** > |