brandondash
21st May 2010 22:25 UTC
NSIS/Tomcat problems
Hi guys,
First let me say I'm happy to finally be posting here. The websense filters at my place of business had this site blocked for years on account of the mp3 player. In fact I finally broke down and purchased a phone with android just so I could fumble my way here through a phone browser, only to have the site unblocked a week later! :P
I have a problem using NSIS to install Apache Tomcat as a service. It is one of several components I install silently (including java, httpd, postgres, postgis, and jboss) and it's the only one giving me problems.
In a nutshell, running service.bat via ExecWait completes with no error and seemingly no result. If I run it by hand it works. If I edit service.bat to put a pause at the end of the script it works. This problem has me truly baffled.
Does anyone here install Tomcat as a service? Any ideas?
regards,
brandon-
Afrow UK
22nd May 2010 10:00 UTC
What is your ExecWait command line? Have you tried ExecDos or nsExec?
Stu
brandondash
24th May 2010 19:55 UTC
NSIS snippet:
SetOutPath "c:\MYAPP\tomcat\bin"
ExecWait 'install-tomcat.bat'
ExecWait 'net start MYTOMCAT'
Then in install-tomcat.bat I have
cd %~dp0
set CATALINA_BASE=c:\MYAPP\tomcat
service install MYTOMCAT
I have only tried ExecWait because up until this point it has worked in every case (including a very similar install-jboss-as-a-service process).
Afrow UK
24th May 2010 21:00 UTC
Try running the batch with cmd /C:
ReadEnvStr $R0 COMSPEC
ExecWait `"$R0" /C "path\to\install-tomcat.bat"`
Also as you are not giving it the full path to the batch file, it is working on the current directory (SetOutPath). Always use full paths.
Edit: And lastly you should use ExecDos or nsExec for commands like this. Installers that show pop up console windows during installation look unprofessional.
Stu
brandondash
2nd June 2010 17:35 UTC
Thanks for the advice. Will try and post back.
brandondash
3rd June 2010 23:13 UTC
The nsExec::Exec switch did the trick! Don't ask me how or why, but it worked. I went ahead and switched all the bats and msi execs to it also. I agree that it makes a big difference in terms of professional appearance.
Thanks for the help. ^_^
brandon-