You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Green <ja...@gmail.com> on 2013/04/08 18:42:56 UTC

Inno Setup Script?

I have a need to distribute an application that works inside Tomcat to a
number of customers.

I can build an Inno Setup script to most of the work, but rather than
re-inventing what looks like quite a complex wheel, has anyone build an
installer script for Tomcat already that they could share?

In our case we're bundling our own JRE which needs setting when installing
the service...

Thanks,

James

Re: Inno Setup Script?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/4/10 James Green <ja...@gmail.com>:
> On 10 April 2013 12:47, Konstantin Kolinko <kn...@gmail.com> wrote:
>>>
>> C:\Program Files\Our Local Services\tomcat\bin\tomcat7.
>> exe //IS//Tomcat7
>> --DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
>> Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
>> Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
>> Services\tomcat\..\java-7-32bit\bin\client\jvm.dll" --StartMode=jvm
>> --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap
>> --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap
>> --StopParams=stop
>>
>> That command is not enough. There is no classpath, there is no logging
>> configuration (neither for the service itself nor for
>> java.util.logging). There is no configuration for Tomcat itself
>> (catalina.home, catalina.base).
>>
>
> Hmm I was merely following

http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Installing_services

> to
> the letter. This does not specify a classpath unless you look under the
> section "Updating services". The other matters are also not mentioned.
>
> Where might I find the defaults I need?
>

1. The first sentence in that section:
"The safest way to manually install the service is to use the provided
service.bat script."

That is the recommended way if you are installing the service manually.

2. If you run "exe" installer for Tomcat 7, it will log the commands
that it used to install the service to a file in CATALINA_HOME/logs.


BTW, official docs for the service wrapper itself are here:
http://commons.apache.org/proper/commons-daemon/procrun.html

>>
>> Is path to Jvm a correct one? I think that is OK, but it could be
>> simplified a bit.
>>
>
> The path is dynamic and supplied by the installer. I merely climb up one
> level to locate our dedicated copy of the JRE.
>


> If I subsequently run tomcat7w.exe, the JVM home is not set, nor are lots
> of other matters.

Just quick thoughts.

1. Are you running tomcat7w.exe as administrator?

2. Check list of services in Windows control panel. Is the service
listed there? Check its properties and its command line there.

3. Check settings in the registry (see Commons Daemon procrun docs).

4. If you run tomcat7w.exe (prunmgr) without arguments then the file
name is used as the service name.

You used "Tomcat7" in IS command and the file is tomcat7w.exe.
I think that is OK and that case sensivity does not matter here, as
service.bat uses the same naming.


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Inno Setup Script?

Posted by James Green <ja...@gmail.com>.
A follow-up with the solution.

This works:
C:\Program Files\Our Local Services\tomcat\bin\tomcat7.exe //IS//Tomcat7
--DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit" --Install="C:\Program Files\Our Local
Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\bin\client\jvm.dll"
--JvmOptions="-Djava.io.tmpdir=C:\Program Files\Our Local
Services\tomcat\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=C:\Program
Files\Our Local Services\tomcat\conf\logging.properties;"
--Classpath="C:\Program Files\Our Local
Services\tomcat\bin\bootstrap.jar;C:\Program Files\Our Local
Services\tomcat\bin\tomcat-juli.jar" --StartMode=jvm --StopMode=jvm
--StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start
--StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
--LogPath="C:\Program Files\Our Local Services\tomcat\logs" --LogLevel=DEBUG

This does not:
C:\Program Files\Our Local Services\tomcat\bin\tomcat7.exe //IS//Tomcat7
--DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\bin\client\jvm.dll"
--JvmOptions="-Djava.io.tmpdir=C:\Program Files\Our Local
Services\tomcat\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=C:\Program
Files\Our Local Services\tomcat\conf\logging.properties;"
--Classpath="C:\Program Files\Our Local
Services\tomcat\bin\bootstrap.jar;C:\Program Files\Our Local
Services\tomcat\bin\tomcat-juli.jar" --StartMode=jvm --StopMode=jvm
--StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start
--StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
--LogPath="C:\Program Files\Our Local Services\tomcat\logs" --LogLevel=DEBUG

The difference is that in the working line the value for JavaHome does NOT
end with a backslash. This was finally identified by comparing registry
data between our custom installer and the official one.

Now to build much the same but for HSQL...

James



On 11 April 2013 10:08, James Green <ja...@gmail.com> wrote:

> Getting quite frustrated now.
>
> Here's the line the installer is now running:
>
> C:\Program Files\Our Local Services\tomcat\bin\tomcat7.exe //IS//Tomcat7
> --DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
> Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
> Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
> Services\tomcat\..\java-7-32bit\bin\client\jvm.dll"
> --JvmOptions="-Djava.io.tmpdir=C:\Program Files\Our Local
> Services\tomcat\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=C:\Program
> Files\Our Local Services\tomcat\conf\logging.properties;"
> --Classpath="C:\Program Files\Our Local
> Services\tomcat\bin\bootstrap.jar;C:\Program Files\Our Local
> Services\tomcat\bin\tomcat-juli.jar" --StartMode=jvm --StopMode=jvm
> --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start
> --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
> --LogPath="C:\Program Files\Our Local Services\tomcat\logs" --LogLevel=DEBUG
>
> If I subsequently run tomcat7w.exe, the JVM home is not set, nor are lots
> of other matters. Again, we're seeing error code 1 from Tomcat.
>
> EIther I'm doing something dumb or this just doesn't work as described.
>
> James
>

Re: Inno Setup Script?

Posted by James Green <ja...@gmail.com>.
Getting quite frustrated now.

Here's the line the installer is now running:

C:\Program Files\Our Local Services\tomcat\bin\tomcat7.exe //IS//Tomcat7
--DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\bin\client\jvm.dll"
--JvmOptions="-Djava.io.tmpdir=C:\Program Files\Our Local
Services\tomcat\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=C:\Program
Files\Our Local Services\tomcat\conf\logging.properties;"
--Classpath="C:\Program Files\Our Local
Services\tomcat\bin\bootstrap.jar;C:\Program Files\Our Local
Services\tomcat\bin\tomcat-juli.jar" --StartMode=jvm --StopMode=jvm
--StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start
--StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
--LogPath="C:\Program Files\Our Local Services\tomcat\logs" --LogLevel=DEBUG

If I subsequently run tomcat7w.exe, the JVM home is not set, nor are lots
of other matters. Again, we're seeing error code 1 from Tomcat.

EIther I'm doing something dumb or this just doesn't work as described.

James

Re: Inno Setup Script?

Posted by James Green <ja...@gmail.com>.
On 10 April 2013 12:47, Konstantin Kolinko <kn...@gmail.com> wrote:

> 2013/4/10 James Green <ja...@gmail.com>:
> > On 10 April 2013 11:55, Konstantin Kolinko <kn...@gmail.com>
> wrote:
> >
> >> 2013/4/10 James Green <ja...@gmail.com>:
> >> > I was hoping I could avoid that.
> >> >
> >> >(...)
> >> >
> >> > While this installs a service, as soon as I attempt to start it I get
> a
> >> > failure. Nothing is logged by Tomcat, but in the event service I get
> the
> >> > following recorded:
> >> >
> >> > The Apache Tomcat 7 service terminated with service-specific error
> >> > Incorrect function..
> >>
> >>
> >> 1. Top-posting is bad.
> >>
> >> 2. Tomcat version = ?
> >>
> >
> > 7.0.39
> >
> >
> >>
> >> 3. Some versions of commons-daemon are broken. Try the latest one.
> >>
> >
> > Am trying. I can locate all files apart from
> commons-daemon-native.tar.gz -
> > where does this originate from?
>
> You need
>
> http://commons.apache.org/proper/commons-daemon/download_daemon.cgi
> -> browse download area -> binaries -> windows
>

So that tar.gz file is merely the sources? Am not going to worry too much
about that at this stage then!


>
> C:\Program Files\Our Local Services\tomcat\bin\tomcat7.
> exe //IS//Tomcat7
> --DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
> Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
> Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
> Services\tomcat\..\java-7-32bit\bin\client\jvm.dll" --StartMode=jvm
> --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap
> --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap
> --StopParams=stop
>
> That command is not enough. There is no classpath, there is no logging
> configuration (neither for the service itself nor for
> java.util.logging). There is no configuration for Tomcat itself
> (catalina.home, catalina.base).
>

Hmm I was merely following
http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Installing_services
to
the letter. This does not specify a classpath unless you look under the
section "Updating services". The other matters are also not mentioned.

Where might I find the defaults I need?


>
> Is path to Jvm a correct one? I think that is OK, but it could be
> simplified a bit.
>

The path is dynamic and supplied by the installer. I merely climb up one
level to locate our dedicated copy of the JRE.


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Inno Setup Script?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/4/10 James Green <ja...@gmail.com>:
> On 10 April 2013 11:55, Konstantin Kolinko <kn...@gmail.com> wrote:
>
>> 2013/4/10 James Green <ja...@gmail.com>:
>> > I was hoping I could avoid that.
>> >
>> >(...)
>> >
>> > While this installs a service, as soon as I attempt to start it I get a
>> > failure. Nothing is logged by Tomcat, but in the event service I get the
>> > following recorded:
>> >
>> > The Apache Tomcat 7 service terminated with service-specific error
>> > Incorrect function..
>>
>>
>> 1. Top-posting is bad.
>>
>> 2. Tomcat version = ?
>>
>
> 7.0.39
>
>
>>
>> 3. Some versions of commons-daemon are broken. Try the latest one.
>>
>
> Am trying. I can locate all files apart from commons-daemon-native.tar.gz -
> where does this originate from?

You need

http://commons.apache.org/proper/commons-daemon/download_daemon.cgi
-> browse download area -> binaries -> windows



C:\Program Files\Our Local Services\tomcat\bin\tomcat7.
exe //IS//Tomcat7
--DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\bin\client\jvm.dll" --StartMode=jvm
--StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap
--StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap
--StopParams=stop

That command is not enough. There is no classpath, there is no logging
configuration (neither for the service itself nor for
java.util.logging). There is no configuration for Tomcat itself
(catalina.home, catalina.base).

Is path to Jvm a correct one? I think that is OK, but it could be
simplified a bit.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Inno Setup Script?

Posted by James Green <ja...@gmail.com>.
On 10 April 2013 11:55, Konstantin Kolinko <kn...@gmail.com> wrote:

> 2013/4/10 James Green <ja...@gmail.com>:
> > I was hoping I could avoid that.
> >
> >(...)
> >
> > While this installs a service, as soon as I attempt to start it I get a
> > failure. Nothing is logged by Tomcat, but in the event service I get the
> > following recorded:
> >
> > The Apache Tomcat 7 service terminated with service-specific error
> > Incorrect function..
>
>
> 1. Top-posting is bad.
>
> 2. Tomcat version = ?
>

7.0.39


>
> 3. Some versions of commons-daemon are broken. Try the latest one.
>

Am trying. I can locate all files apart from commons-daemon-native.tar.gz -
where does this originate from?


>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Inno Setup Script?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/4/10 James Green <ja...@gmail.com>:
> I was hoping I could avoid that.
>
>(...)
>
> While this installs a service, as soon as I attempt to start it I get a
> failure. Nothing is logged by Tomcat, but in the event service I get the
> following recorded:
>
> The Apache Tomcat 7 service terminated with service-specific error
> Incorrect function..


1. Top-posting is bad.

2. Tomcat version = ?

3. Some versions of commons-daemon are broken. Try the latest one.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Inno Setup Script?

Posted by James Green <ja...@gmail.com>.
I was hoping I could avoid that.

Currently the thinking is to unpack the tomcat distribution, re-package
inside a custom installer, and call bin\tomcat7.exe as per the windows
service document.

And indeed this works - to a point. The installer logs says:

C:\Program Files\Our Local Services\tomcat\bin\tomcat7.exe //IS//Tomcat7
--DisplayName="Apache Tomcat 7" --JavaHome="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\" --Install="C:\Program Files\Our Local
Services\tomcat\bin\tomcat7.exe" --Jvm="C:\Program Files\Our Local
Services\tomcat\..\java-7-32bit\bin\client\jvm.dll" --StartMode=jvm
--StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap
--StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap
--StopParams=stop

While this installs a service, as soon as I attempt to start it I get a
failure. Nothing is logged by Tomcat, but in the event service I get the
following recorded:

The Apache Tomcat 7 service terminated with service-specific error
Incorrect function..

If I take the full command as executed by the installer, there is no
feedback at the command prompt and the service is shown as installed.

I am therefore lost as to what I'm looking at as a problem. Any ideas where
to go?

Thanks,

James



On 8 April 2013 18:38, Konstantin Kolinko <kn...@gmail.com> wrote:

> 2013/4/8 James Green <ja...@gmail.com>:
> > I have a need to distribute an application that works inside Tomcat to a
> > number of customers.
> >
> > I can build an Inno Setup script to most of the work, but rather than
> > re-inventing what looks like quite a complex wheel, has anyone build an
> > installer script for Tomcat already that they could share?
> >
> > In our case we're bundling our own JRE which needs setting when
> installing
> > the service...
> >
>
>
> Tomcat installer is built using NSIS (Nullsoft Scriptable Install System)
> .
> The script is res/tomcat.nsi
>
> BTW,
>  if you are using a custom value for HTTP port,  do not forget to also
> change the shutdown port number (8005).  I have seen a number of
> software that forgets to change that.  You can set it to "-1" when
> external shutdown is not needed,  e.g. when you run as a service.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Inno Setup Script?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/4/8 James Green <ja...@gmail.com>:
> I have a need to distribute an application that works inside Tomcat to a
> number of customers.
>
> I can build an Inno Setup script to most of the work, but rather than
> re-inventing what looks like quite a complex wheel, has anyone build an
> installer script for Tomcat already that they could share?
>
> In our case we're bundling our own JRE which needs setting when installing
> the service...
>


Tomcat installer is built using NSIS (Nullsoft Scriptable Install System)
.
The script is res/tomcat.nsi

BTW,
 if you are using a custom value for HTTP port,  do not forget to also
change the shutdown port number (8005).  I have seen a number of
software that forgets to change that.  You can set it to "-1" when
external shutdown is not needed,  e.g. when you run as a service.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org