Cannot create 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!

markphip
Posts: 20
Joined: Fri Apr 16, 2010 9:03 pm

Cannot create service

I have a java app that runs as a Windows service via the "Yet Another Java Service Wrapper" (YAJSW) product. I cannot create this service using the Services feature because the program that is defined to the service is "java", and this is not a file from my app. The UI does not seem to allow you to specify any arbitrary command line.

Fortunately, yajsw comes with batch scripts to install and I can successfully launch those to install the service. It is just a little uglier. Unfortunately I have run into this problem when running those scripts:

http://www.advancedinstaller.com/forums ... =2&t=11082

BTW - this is what the "ImagePath" registry entry for the service looks like when installed by the batch file

"java" "-classpath" "C:\APPNAME\svcwrapper\wrapper.jar" "-Xrs" "-Dwrapper.service=true" "-Dwrapper.working.dir=C:APPNAME\svcwrapper\..\appserver" "-Dwrapper.config=C:\APPNAME\svcwrapper\conf\wrapper.conf" "-Dwrapper.additional.1x=-Xrs" "org.rzo.yajsw.boot.WrapperServiceBooter"

Mark
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Cannot create service

Hello Mark,

You can do the following:
- create a new java product from Advanced Installer for your jar
- set the application type to "Console" or "Win32 Service", try them both to see which one works
- on the Virtual Machine tab, click the "..." button to the right of the JVM Parameters field and tick the "Reduced operating system signals" checkbox (generates the -Xrs) option.
- add the parameters (the one starting with -D from the command line you posted) in the System Properties list. Something like

Code: Select all

wrapper.service = true
wrapper.working.dir = C:\APPNAME\svcwrapper\..\appserver
etc...
Also note you might have missed a backslash in the wrapper.working.dir property which I added in the above example.
- from the Services page add the .exe created for your jar as a service.
- test and see if it works.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
markphip
Posts: 20
Joined: Fri Apr 16, 2010 9:03 pm

Re: Cannot create service

GabrielBarbu wrote: You can do the following:
- create a new java product from Advanced Installer for your jar
- set the application type to "Console" or "Win32 Service", try them both to see which one works
- on the Virtual Machine tab, click the "..." button to the right of the JVM Parameters field and tick the "Reduced operating system signals" checkbox (generates the -Xrs) option.
- add the parameters (the one starting with -D from the command line you posted) in the System Properties list. Something like

Code: Select all

wrapper.service = true
wrapper.working.dir = C:\APPNAME\svcwrapper\..\appserver
etc...
Also note you might have missed a backslash in the wrapper.working.dir property which I added in the above example.
- from the Services page add the .exe created for your jar as a service.
- test and see if it works.
Well I have not done that because it sounds like you provide some kind of service wrapper of your own, and we are already using something for that - yajsw. The latter has been QA'ed etc. and I do not want to introduce another EXE into the picture without knowing what exactly it does. The wrapper we are using has some fairly sophisticated features such as being able to run Groovy scripts in response to certain events and we have code our application to these features. So we cannot replace it with a different wrapper.

Is there any reason the service UI cannot allow us more control over the service definition? Why does it needs to be limited to files from my install?

Mark
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Cannot create service

Hi Mark,

If selected as "Console", the generated .exe is a simple launcher for java apps (not a wrapper), starting java with the specified parameters for your application. The settings I suggested replicate the command line you posted in your first post so that in the end your service gets launched the same way, thus functioning properly.

I hope this helps.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
markphip
Posts: 20
Joined: Fri Apr 16, 2010 9:03 pm

Re: Cannot create service

Thanks for the suggestion, but I do not want to introduce the risk of having another piece to test and maintain. Ideally, I would like to see a future release that opened up the ability to create services so that the main program did not have to be a file that was installed.

Mark

Return to “Common Problems”