windows sevice cannot start - 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!

ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

windows sevice cannot start

Hi,

I came up against a problem with Windows services.
I tried to install an Apache Tomcat as an automatic Windows service. The installation was successful but the startup was not. I followed the way which is described in the Advanced Installer help. (How do I install a service for a custom user?)
When I created a batch file for the same service installation it can work excellent.
I compared the both of keys in the registry (HKLM\System/Services\...), and they seem to be same.

Thanks, Edvard
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

I have got the following error: Error 1053: The service did not respond to the start or control request in a timely fashion
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: windows sevice cannot start

Hi,

Please note that the Tomcat service is installed in a custom way by using "service.bat". Perhaps this article will help you. Also, the service needs the CATALINA_HOME environment variable set on the target machine. Is this variable set when the installation runs?

Note that you can launch a BAT by using a Launch file or open URL custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Hi Cosmin,

thank you for the answer.

>Please note that the Tomcat service is installed in a custom way by using "service.bat". Perhaps this article will help you. Also, the service needs the >CATALINA_HOME environment variable set on the target machine. Is this variable set when the installation runs?
The way when I use a batch file from command line can work excellent. The paths and variables are set.
I don't use this batch file from my installer, because I would like to achieve a more sophisticated behavior. (I would like to change the service user)
If I could do this with batch fie, I would use it.
Is it a right way if I use my batch file for service creation, and after I change the service user somehow? Could I do this?

Thanks, Edvard
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: windows sevice cannot start

Hi,

From my knowledge the Tomcat service cannot be installed by using the Windows Installer service support. However, it seems that it has some command line parameters which may help you accomplish what you need.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Hi,

I'm using that parameters. If Tomcat service cannot be installed with Windows installer, could I change the service user from Advanced installer? (e.g. in the registry)

Regards, Edvard
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: windows sevice cannot start

Hi,

I'm afraid that Advanced Installer doesn't support this directly. However, you can try using a custom action. Perhaps this will help you.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Thank you very much, it is working well.
My last problem in this topic: how can I use my Advanced Installer properties in he attached custom vb script? e.g. predefined user name.
Best Regards, Edvard
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: windows sevice cannot start

Hi Edward,

You can access the public properties of the installer in a VBScript like this:

Code: Select all

Dim Property_Value
Property_Value = Session.Property("MY_PROPERTY")
The user name is kept in an environment variable. This can be accessed like this:

Code: Select all

Dim UserName
UserName = Session.Property("%USERNAME")
Please note that environment variables must be preceded by the '%' character.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Thank you for answer.

Code: Select all

Dim Property_Value
Property_Value = Session.Property("MY_PROPERTY")
It means, one of my Installer property (for example [USERNAME] ) should be specified as

Code: Select all

Property_Value = Session.Property("USERNAME")
?

I tried this way and the script did not work.
Can I debug somehow that script during the installstion?

Regards, Edvard
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: windows sevice cannot start

Hi Edward,
Dim Property_Value
Property_Value = Session.Property("MY_PROPERTY")
Yes, this is the correct way to get the value of a public property using a VBScript.
Property_Value = Session.Property("USERNAME")
I tried this way and the script did not work.
Please note that "USERNAME" is not a public property of the installer, it is an environment variable. To reference an environment variable you should also use '%' before its name as in my example.

Code: Select all

Dim UserName
UserName = Session.Property("%USERNAME")
Can I debug somehow that script during the installstion?
You can try using messageboxes inside the script before and after the events that interest you.

Code: Select all

MsgBox "This is the text displayed"
Please let me know if you have other questions.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Hi,

thank you for the tip, the msgBox is working well.
Please note that "USERNAME" is not a public property of the installer, it is an environment variable. To reference an environment variable you should also use '%' before its name as in my example.
I specified this property in the Advance Installer (User specified property) and I can access this as [USERNAME] in the AI. Will it be an environment variable in this case?

Unfortunately either does not work with '%' and without '%'
I'm not a VB expert, I copy my code. I see during the installation the sUsername and sPassword are empty strings. If I specify a constant string as sUserName the script is working well.

Code: Select all

public Sub changeUser()

Dim sUserName
Dim sPassword
sUserName = Session.Property("%SERVICE_USER")
sPassword = Session.Property("%SERVICE_PASSWORD")

MsgBox "UserName: " & sUserName

Set oWMIService = GetObject("winmgmts:")

'Retrieve all services
Set cServices = oWMIService.ExecQuery _
  ("Select * from Win32_Service")

'Examine each service one at a time
For Each oService in cServices
  If oService.Name = "JChemWebServices" Then
     errServiceChange = oService.Change( , , , , , , sUserName , sPassword)
  End If
Next
End Sub
Thank you. Edvard
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Sorry, I might be ambiguous. My properties in the Advanced Installer are: SERVICE_USER and SERVICE_PASSWORD.
I can use them as [SERVICE_USER] and [SERVICE_PASSWORD] in the A. I.
I would like to use them in my VB script

Regards, Edvard
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: windows sevice cannot start

Hi Edward,

Please note that for using user defined public properties in a VBScript you don't need to use the character '%' before the name of the property.
Here is the correct way to access the properties values:

Code: Select all

sUserName = Session.Property("SERVICE_USER")
sPassword = Session.Property("SERVICE_PASSWORD")
The '%' character is used only when accessing the value of an Environment Variable, not of a user-defined property.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ebuki
Posts: 13
Joined: Wed Aug 26, 2009 10:26 pm

Re: windows sevice cannot start

Hi Bogdan,

yes, I tried to use this solution, but is does not work. :(
I Attached my VB script above in a post. Could you give a look for that? The Session.Property("SERVICE_USER") gives back with an empty string or null.

Should I set something in AI for take public an AI "user defined property"?

Thanks, Edvard

Return to “Common Problems”