Start a Window Service ... - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Start a Window Service ...

Hi!
I'm trying to start the following service (Installed with Advanced Installer 6.1). The Sevices is installed, but when I try to start it, I ontain the following message:

"Could not start the MB3000AcquisitionServer service on local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion."

The "Path to executable" contains:

"C:\Programs Files.... java.exe -Xmx512m -classpath jars\MB3000AcquisitionServer.jar com.bomem.gene.driverServer.AcquisitionDriverServer 1"

Thanks a lot for your help!
:?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Please note that you cannot use java.exe to start your application as a service. We have a tutorial for installing a Java service, please take a look:
http://www.advancedinstaller.com/user-g ... rvice.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Thanks a lot!
I will check it right now!
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

OK, the tutorial and the example are very usefull.
I have been able to build and install my .jar in Windows Service. Thanks a lot!
I'm meeting a problem however: on few PC, I got the following message when The Installer try to execute a Start service:

"Service... could not be installed.
Verify that you have sufficient privileges to install system services"

(I have Administrator priviledge).

If I install the service whitout the Start service at the end of installation and I Start manually the service, I got the following message:

"Error 1053: The service did not respond to the start or control request in a timely fashion."

And I got the following message in the Event Viewer the Windows:

"The MB3000ApplicationServer service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion. "
Following by:
"Timeout (30000 milliseconds) waiting for the MB3000ApplicationServer service to connect."

Do you have any idea?

Also, is it possible to increase this default Timeout of 30 seconds?

Thanks a lot! :?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

I'm not sure about why you are encountering this behavior. Please make sure that you haven't set any restrictions on the machines with the problem. Also, can you reproduce this on a clean machine (perhaps this problem is caused by the software configuration).

If the problem persists please send us a small test case (AIP and the resulted MSI) which shows this behavior (tries to install your service and fails) to support at advancedinstaller dot com so we can investigate this issue.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Thanks for your answer!

I can send you my example (a bit big however...) but I can start to tell you that the "javaserviceexample" included in your tutorial, give the same problem on same PCs (OK on one, as my service, BAD on two as my service). I send you my compilation of this example if you want?


Best!
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

If our Java service example doesn't work on the two machines you tested, then the problem is caused by these machines. Please test your service on a clean machine.

If you can reproduce this behavior on a clean machine (eventually on a virtual machine if you don't have access to a clean machine) please provide us an URL (send us an email to support at avancedinstaller dot com, do not post it on the forum) from which we can download a test case (AIP and the resulted MSI) so we can investigate this problem.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Thanks a lot!

First, I will install my service with another "tool" (Wrapper.exe) on these machines. I will send you the results of this exercice!

Best!
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

I found my problem… No JDK installed “officially” (e.g. visible in Control panel) on the two PCs… My installer has the task to install a JRE and set an environment variable (added to the path)… but, look like insufficient for start my java service.

On a clean PC, do you install manually a JRE before run your javaserviceexample?

Best! :wink:
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

If your application (service) needs Java JRE, you can set is as a prerequisite using the "Add" button in the "Prerequisites" page.

In the "New Prerequisite" dialog you set the "Location" field to URL and the "URL" field to:
http://javadl.sun.com/webapps/download/ ... leId=12798

Also, please note that you can bundle the JRE with your application. For more details please see these pages:
http://www.advancedinstaller.com/user-g ... e-jre.html
http://www.advancedinstaller.com/featur ... aller.html

Note that if you add JRE as bundled, then the bundled JRE will always be installed and it will be used always and only by your application (it is not used by other applications and if a correct JRE version is already present, your application will still use the bundled version).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Thank you very much!
Excellent "service"! :D
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Hi got "a last question"...

I want "force" the installation of two files (.csv) on C: (in another words, at a different place then the Target path). Is it possible?

Best,
cmbourqu
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

Yes, this is possible. If the location you need is not shown in the "Files and Folders" page you can use a property-based folder.

For this you can create a public property in the "Install Parameters" page (for example the property MY_DIR with the value "C:\"). In the "Files and Folders" page you can use this property to create a property-based folder and add the files in it.
http://www.advancedinstaller.com/user-g ... eters.html

Also, you can use the "Windows Volume" predefined folder (in the "Files and Folders" page). This folder will be resolved at runtime to the drive on which Windows is installed (usually "C:\").

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
cmbourqu
Posts: 17
Joined: Tue Dec 18, 2007 9:19 pm

Wow, thanks again!
I'm very satisfied by your product (simple and efficace)!

Best regards,
cmbourqu
sashasch
Posts: 6
Joined: Sun Mar 30, 2008 4:08 pm

Help please. My service started and than stopped ?!

My service must execute some simple function (println ("hello"), for example)
each timeout. It is works as console, but when I tried to make it Win Service,it stops immediately (after few iterations).
The message, I received from OS:

The ... Service started and than stopped, Some service stop automatically if they have nothing to do ...

The tutorial works fine, but I can't understand what wrong in my example:

Code: Select all

public class SimplyServiceMain {
  static boolean running = true;
  /*
   * Prints Hello  
   */
  private static class ReaderThread extends Thread {
   
    
    public ReaderThread() {
    }
    
    public void run() {
      while(running){
    	  System.out.println("hello \n");
			try 
			{
				sleep(1000);
			} catch (InterruptedException e1) 
			{
				e1.printStackTrace();
			}
			
      }
    }
  }
  
  public static void main(String[] argv) {
    try {
         System.out.println("Started\n");
         ReaderThread t = new ReaderThread();
            t.start();      
    }catch(Throwable ex) {
      ex.printStackTrace();
    }
  }
  
  public static void stop() {
    running = false;
  }
}
P.S. I have searched in this forum and tried the tutorial, but without any result.

Return to “Common Problems”