Known issue with 32-bit processes.

You can track progress here:
https://issues.apache.org/jira/browse/DAEMON-401

Mark


On 30/08/2019 15:57, David Gutknecht wrote:
> Hello everybody,
> 
> I tried to update the prunsrv.exe (1.0.15) installed on my server
> (Windows 2012) to the latest version (1.2.0)
> I simply replaced the exe with the newest version.
> After replacing it I was no more able to start the service.
> Windows deliver the message "1067: the process has unexpectedly been
> stopped"
> The log-file contains only following messages:
> [2019-08-30 14:43:49] [debug] ( prunsrv.c:1754) [20592] Apache Commons
> Daemon procrun log initialized.
> [2019-08-30 14:43:49] [info]  ( prunsrv.c:1758) [20592] Apache Commons
> Daemon procrun (1.2.0.0 32-bit) started.
> [2019-08-30 14:43:49] [info]  ( prunsrv.c:1668) [20592] Running Service
> 'Med2Unify_Swisscom'...
> [2019-08-30 14:43:49] [debug] ( prunsrv.c:1441) [22040] Inside
> ServiceMain...
> [2019-08-30 14:43:49] [debug] ( prunsrv.c:904 ) [22040]
> reportServiceStatusE: dwCurrentState = 2, dwWin32ExitCode = 0,
> dwWaitHint = 3000, dwServiceSpecificExitCode = 0.
> [2019-08-30 14:43:49] [info]  ( prunsrv.c:1196) [22040] Starting service...
> 
> If I replace back the prunsrv.exe with the oldest version (1.0.15). It
> works fine.
> I use AdoptOpenJDK (Hotspot) JRE 11
> 
> This is the command Line I used to install the service:
> prunsrv.exe^
>  //US//ServiceEngine^
>  --Startup=manual^
>  --DisplayName="ServiceEngine"^
>  --Classpath=ServiceEngine.jar^
>  --Jvm="C:\Program Files (x86)\jdk-11.0.4+11-jre\bin\client\jvm.dll"^
>  --StartMode jvm^
>  --StartClass ch.novcom.ServiceEngine^
>  --StartMethod windowsService^
>  --StartParams start^
>  --StopMode jvm^
>  --StopClass ch.novcom.ServiceEngine^
>  --StopMethod windowsService^
>  --StopParams stop^
>  --LogPath "%CD%\log"^
>  --LogPrefix ServiceEngine_
>  --LogLevel Debug
> 
> 
> And below the Java source code of the object that contains the Daemon part:
> public class ServiceEngine implements Daemon {
>     private final static Logger LOGGER =
> Logger.getLogger(ServiceEngine.class.getName());
> 
>     private static TheEngine myEngine = null;
>     private static ServiceEngine m2uInstance = new ServiceEngine();
> 
>     /**
>      * The Java entry point.
>      *
>      * @param args
>      *            Command line arguments, all ignored.
>      */
>     public static void main(String[] args) {
>         LOGGER.entering("ServiceEngine", "main");
>         // the main routine is only here so I can also run the app from the
>         // command line
> 
>         m2uInstance.initialize();
> 
>         Scanner sc = new Scanner(System.in);
>         //wait until receive stop command from keyboard
>         System.out.printf("Enter 'stop' to halt: ");
>         while(!sc.nextLine().toLowerCase().equals("stop") &&
> myEngine!=null && myEngine.isAlive());
> 
>         if (myEngine!=null && myEngine.isAlive()) {
>             m2uInstance.terminate();
>         }
>         sc.close();
>         LOGGER.exiting("ServiceEngine", "main");
>     }
> 
>     /**
>      * Static methods called by prunsrv to start/stop the Windows
> service. Pass
>      * the argument "start" to start the service, and pass "stop" to
> stop the
>      * service.
>      *
>      * Taken lock, stock and barrel from Christopher Pierce's blog at
>      * http://blog.platinumsolutions.com/node/234
>      *
>      * @param args
>      *            Arguments from prunsrv command line
>      **/
>     public static void windowsService(String args[]) {
>         String cmd = "start";
>         if (args.length > 0) {
>             cmd = args[0];
>         }
> 
>         if ("start".equals(cmd)) {
>             m2uInstance.windowsStart();
>         } else {
>             m2uInstance.windowsStop();
>         }
>     }
> 
>     public void windowsStart() {
>         LOGGER.entering(getClass().getName(), "windowsStart");
> 
>         initialize();
>         if (myEngine != null){
>             while (myEngine.isAlive()) {
>                 // don't return until stopped
>                 synchronized (this) {
>                     try {
>                         this.wait(5000); // wait 5s and check if stopped
>                     } catch (InterruptedException ie) {
>                     }
>                 }
>             }
>         }
> 
>         LOGGER.exiting(getClass().getName(), "windowsStart");
>     }
> 
>     public void windowsStop() {
>         LOGGER.entering(getClass().getName(), "windowsStop");
>         terminate();
>         synchronized (this) {
>             // stop the start loop
>             this.notify();
>         }
>         LOGGER.exiting(getClass().getName(), "windowsStop");
>     }
> 
>     // Implementing the Daemon interface is not required for Windows but
> is for
>     // Linux
>     @Override
>     public void init(DaemonContext arg0) throws Exception {
>         LOGGER.entering(getClass().getName(), "init");
> 
>         LOGGER.exiting(getClass().getName(), "init");
>     }
> 
>     @Override
>     public void start() {
>         LOGGER.entering(getClass().getName(), "start");
>         initialize();
>         LOGGER.exiting(getClass().getName(), "start");
>     }
> 
>     @Override
>     public void stop() {
>         LOGGER.entering(getClass().getName(), "stop");
>         terminate();
>         LOGGER.exiting(getClass().getName(), "stop");
>     }
> 
>     @Override
>     public void destroy() {
>         LOGGER.entering(getClass().getName(), "destroy");
>         LOGGER.exiting(getClass().getName(), "destroy");
>     }
> 
>     /**
>      * Do the work of starting the engine
>      */
>     private void initialize() {
>         LOGGER.entering(getClass().getName(), "initialize");
>         if (myEngine == null) {
> LOGGER.logp(Level.INFO,getClass().getName(),"initialize","Starting the
> Engine");
>             myEngine = new TheEngine();
>             if (myEngine.initialize()){
>                 myEngine.start();
>             }
>             else {
> LOGGER.logp(Level.SEVERE,getClass().getName(),"initialize","The Engine
> has not been successfully initialized.");
>                 myEngine = null;
>             }
>         }
>         LOGGER.exiting(getClass().getName(), "initialize");
>     }
> 
>     /**
>      * Cleanly stop the engine.
>      */
>     public void terminate() {
>         LOGGER.entering(getClass().getName(), "terminate");
>         if (myEngine != null) {
> LOGGER.logp(Level.INFO,getClass().getName(),"terminate","Stopping the
> Engine");
>             myEngine.terminate();
> LOGGER.logp(Level.INFO,getClass().getName(),"terminate","Engine stopped");
>         }
>         LOGGER.exiting(getClass().getName(), "terminate");
>     }
> 
> }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to