[wix-users] Another apache tomcat issue...

Lewis Henderson henderso at opentext.com
Thu Mar 31 10:52:35 PDT 2016


Hi again,

It looks like the attachments didn't make it through the list.  I hope I didn't break any list rules...

In any case, I'll try to show what each relevant include has.  First, the registry values.  Note that these are pretty specific to 7.x.x, perhaps even more version specific:

  <Component Id="TomcatRegistry" Guid="{your-guid}" DiskId="1">
    <RegistryKey Root="HKLM"
                 Key="Software\Apache Software Foundation\Procrun 2.0">
      <RegistryKey Key="[TOMCAT_NAME]">
        <RegistryKey Key="Parameters">
          <RegistryKey Key="Java">
            <RegistryValue Name="ClassPath" Type="string"
                           Value="[TOMCAT_DIR]\bin\bootstrap.jar;[TOMCAT_DIR]\bin\tomcat-juli.jar" />
            <RegistryValue Name="Jvm"       Type="string" Value="[JVM_PATH]" />
            <RegistryValue Name="JvmMs"     Type="integer" Value="128" />
            <RegistryValue Name="JvmMx"     Type="integer" Value="256" />
            <RegistryValue Name="Options"   Type="multiString" Action="write">
              <MultiStringValue>-Dcatalina.home=[TOMCAT_DIR]</MultiStringValue>
              <MultiStringValue>-Dcatalina.base=[TOMCAT_DIR]</MultiStringValue>
              <MultiStringValue>-Djava.endorsed.dirs=[TOMCAT_DIR]\endorsed</MultiStringValue>
              <MultiStringValue>-Djava.io.tmpdir=[TOMCAT_DIR]\temp</MultiStringValue>
              <MultiStringValue>-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager</MultiStringValue>
              <MultiStringValue>-Djava.util.logging.config.file=[TOMCAT_DIR]\conf\logging.properties</MultiStringValue>
            </RegistryValue>
          </RegistryKey>
          <RegistryKey Key="Log">
            <RegistryValue Name="Path"      Type="string" Value="[TOMCAT_DIR]\logs" />
            <RegistryValue Name="StdError"  Type="string" Value="auto" />
            <RegistryValue Name="StdOutput" Type="string" Value="auto" />
          </RegistryKey>
          <RegistryKey Key="Start">
            <RegistryValue Name="Class"       Type="string"
                           Value="org.apache.catalina.startup.Bootstrap" />
            <RegistryValue Name="Mode"        Type="string" Value="jvm" />
            <RegistryValue Name="Params"      Type="multiString" Action="write">
              <MultiStringValue>start</MultiStringValue>
            </RegistryValue>
            <RegistryValue Name="WorkingPath" Type="string" Value="[TOMCAT_DIR]" />
          </RegistryKey>
          <RegistryKey Key="Stop">
            <RegistryValue Name="Class"       Type="string"
                           Value="org.apache.catalina.startup.Bootstrap" />
            <RegistryValue Name="Mode"        Type="string" Value="jvm" />
            <RegistryValue Name="Params"      Type="multiString" Action="write">
              <MultiStringValue>stop</MultiStringValue>
            </RegistryValue>
            <RegistryValue Name="WorkingPath" Type="string" Value="[TOMCAT_DIR]" />
          </RegistryKey>
        </RegistryKey>
      </RegistryKey>
    </RegistryKey>
    <RegistryKey Root="HKLM" ForceCreateOnInstall="yes"
                 Key="SYSTEM\CurrentControlSet\Services\[TOMCAT_NAME]\Parameters" />
  </Component>

You'll note that the last one is an empty key under the service.  I don't know why, but the service won't start without it.

Next, here's the service configuration:

  <ServiceInstall Name="[TOMCAT_NAME]" Type="ownProcess"
                  DisplayName="!(loc.Tomcat_Disp)" Description="!(loc.Tomcat_Desc)"
                  Arguments="//RS//[TOMCAT_NAME]" Account="LocalSystem"
                  Start="auto" ErrorControl="normal"
                  Interactive="no">
    <ServiceDependency Id="Tcpip" Group="no" />
    <ServiceDependency Id="Afd"   Group="no" />
  </ServiceInstall>
  <ServiceControl Id="TomcatControl" Name="[TOMCAT_NAME]"
                  Start="install" Stop="both"
                  Remove="uninstall" Wait="yes" />

This is in an include file in my case, but could just be in the component list.  Next is the component that does edits to the server.xml file:

  <Component Id="TomcatXmlEdits" Guid="{your-guid}" DiskId="1">
    <util:XmlFile Id="ServerXml1" File="[TOMCAT_DIR]\conf\server.xml"
                  Action="setValue" ElementPath="//Server"
                  Name="port" Value="[TOMCAT_SVR]" Sequence="1" />
    <util:XmlFile Id="ServerXml2" File="[TOMCAT_DIR]\conf\server.xml"
                  Action="setValue"
                  ElementPath="//Server/Service[\[]@name='Catalina'[\]]/Connector[\[]@protocol='HTTP/1.1'[\]]"
                  Name="port" Value="[TOMCAT_PORT]" Sequence="2" />
    <util:XmlFile Id="ServerXml3" File="[TOMCAT_DIR]\conf\server.xml"
                  Action="setValue"
                  ElementPath="//Server/Service[\[]@name='Catalina'[\]]/Connector[\[]@protocol='HTTP/1.1'[\]]"
                  Name="URIEncoding" Value="UTF-8" Sequence="3" />
    <util:XmlFile Id="ServerXml4" File="[TOMCAT_DIR]\conf\server.xml"
                  Action="setValue"
                  ElementPath="//Server/Service[\[]@name='Catalina'[\]]/Connector[\[]@protocol='AJP/1.3'[\]]"
                  Name="port" Value="[TOMCAT_AJP]" Sequence="4" />
    <util:XmlFile Id="ServerXml5" File="[TOMCAT_DIR]\conf\server.xml"
                  Action="setValue"
                  ElementPath="//Server/Service[\[]@name='Catalina'[\]]/Connector[\[]@protocol='AJP/1.3'[\]]"
                  Name="URIEncoding" Value="UTF-8" Sequence="5" />
  </Component>

And finally, here are the CA declarations and InstallExecuteSequence bits:

  <CustomAction Id="EditIsapi1.set"   Return="check"    Property="EditIsapi1"
                Value="[TOMCAT_DIR]\bin\iis\x86\isapi_redirect.properties;log_file =;log_file = [TOMCAT_DIR]\logs\iis_redirect.log" />
  <CustomAction Id="EditIsapi1"       BinaryKey="mydll" DllEntry="DoEdit"
                Execute="deferred"    Return="check"    Impersonate="no" />
  <CustomAction Id="EditIsapi2.set"   Return="check"    Property="EditIsapi2"
                Value="[TOMCAT_DIR]\bin\iis\x86\isapi_redirect.properties;worker_file =;worker_file = [TOMCAT_DIR]\conf\workers.properties" />
  <CustomAction Id="EditIsapi2"       BinaryKey="mydll" DllEntry="DoEdit"
                Execute="deferred"    Return="check"    Impersonate="no" />
  <CustomAction Id="EditIsapi3.set"   Return="check"    Property="EditIsapi3"
                Value="[TOMCAT_DIR]\bin\iis\x86\isapi_redirect.properties;worker_mount_file =;worker_mount_file = [TOMCAT_DIR]\conf\uriworkermap.properties" />
  <CustomAction Id="EditIsapi3"       BinaryKey="mydll" DllEntry="DoEdit"
                Execute="deferred"    Return="check"    Impersonate="no" />
  <CustomAction Id="EditWorkers1.set" Return="check"    Property="EditWorkers1"
                Value="[TOMCAT_DIR]\conf\workers.properties;workers.tomcat_home=;workers.tomcat_home=[TOMCAT_DIR]" />
  <CustomAction Id="EditWorkers1"     BinaryKey="mydll" DllEntry="DoEdit"
                Execute="deferred"    Return="check"    Impersonate="no" />
  <CustomAction Id="EditWorkers2.set" Return="check"    Property="EditWorkers2"
                Value="[TOMCAT_DIR]\conf\workers.properties;workers.java_home=;workers.java_home=[JAVA_HOME]" />
  <CustomAction Id="EditWorkers2"     BinaryKey="mydll" DllEntry="DoEdit"
                Execute="deferred"    Return="check"    Impersonate="no" />
  <CustomAction Id="EditWorkers3.set" Return="check"    Property="EditWorkers3"
                Value="[TOMCAT_DIR]\conf\workers.properties;worker.ajp13.port=;worker.ajp13.port=[TOMCAT_AJP]" />
  <CustomAction Id="EditWorkers3"     BinaryKey="mydll" DllEntry="DoEdit"
                Execute="deferred"    Return="check"    Impersonate="no" />

<InstallExecuteSequence>
  <Custom Action="EditIsapi1.set"   Before="EditIsapi1">NOT Installed</Custom>
  <Custom Action="EditIsapi1"       Before="EditIsapi2">NOT Installed</Custom>
  <Custom Action="EditIsapi2.set"   Before="EditIsapi2">NOT Installed</Custom>
  <Custom Action="EditIsapi2"       Before="EditIsapi3">NOT Installed</Custom>
  <Custom Action="EditIsapi3.set"   Before="EditIsapi3">NOT Installed</Custom>
  <Custom Action="EditIsapi3"       Before="InstallFinalize">NOT Installed</Custom>
  <Custom Action="EditWorkers1.set" Before="EditWorkers1">NOT Installed</Custom>
  <Custom Action="EditWorkers1"     Before="EditWorkers2">NOT Installed</Custom>
  <Custom Action="EditWorkers2.set" Before="EditWorkers2">NOT Installed</Custom>
  <Custom Action="EditWorkers2"     Before="EditWorkers3">NOT Installed</Custom>
  <Custom Action="EditWorkers3.set" Before="EditWorkers3">NOT Installed</Custom>
  <Custom Action="EditWorkers3"     Before="InstallFinalize">NOT Installed</Custom></InstallExecuteSequence>

There you go.
				Lewis Henderson
				OpenText, inc.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Lewis Henderson
Sent: Thursday, March 31, 2016 1:36 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Another apache tomcat issue...

Hi Keith,

I'm also using some CA's and I'm sure others may have a better approach, but I'll try to outline it here.  First, this is for Apache Tomcat 7.0.54.  It's probably much the same for all 7.x.x versions, but your mileage may vary.  I start with a few properties:

JAVA_HOME is the result of one or more registry searched to find the appropriate Java installation.
JVM_PATH is the result of one or more RegistrySearches to find the jvm.dll for the appropriate Java version.
TOMCAT_DIR is the root directory of where I want to install Tomcat.  This points to [INSTALLDIR]java\apache-tomcat-7.0.54 in my case.
TOMCAT_NAME is the name I want for the tomcat service TOMCAT_PORT is the main connector port, usually 8080 TOMCAT_SVR is the port for the Catalina servlet, usually 8005 TOMCAT_AJP is the ajp13 protocol connector port, usually 8009

I have all of the tomcat Components listed in tomcat_components.wxi (it could probably be a Fragment), but for the tomcat executable component, I also have:

          <File Id="java_tomcat_bin_tomcat7_exe" Name="tomcat7.exe" KeyPath="yes" />
          <?include tomcat7_service.wxi ?>

The include file takes care of all the messy stuff associated with the service.  I also have all of the features in tomcat_features.wxi, the registry values in tomcat_regval.wxi, the CA definitions in tomcat_ca.wxi, and the InstallExecuteSequence changes in tomcat_exseq.wxi, just to keep the associated install cleaner.  Oh, and the XML file edits in tomcat_xml.wxi.  It all lays out in the product install like this:

...
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="INSTALLDIR" Name="Webadmin"
                 FileSource="$(var.SourceBase)">
        <Directory Id="java" Name="java">
          <?include tomcat_components.wxi ?>
          ...
        </Directory>
        ...
      </Directory>
      <?include tomcat_regval.wxi ?>
      <?include tomcat_xml.wxi ?>
      <?include web_regval.wxi ?>
    </Directory>

    <Feature Id=...>
      ...
      <?include tomcat_features.wxi ?>
    </Feature>

    ...

    <?include tomcat_ca.wxi ?>

    <InstallExecuteSequence>
      ....
      <?include tomcat_exseq.wxi ?>
    </InstallExecuteSequence>

Now for the CA's: I have one that does TCP/IP port number validation during the UI sequence.  I'll leave that to your imagination.  The other does some edits to non-xml files, in the ca and exseq includes.  That CA, DoEdit, takes a string with three arguments, delimited by semicolons: first is the full path to the file to be edited, the second is the start of a line to find, and the last is the line to write in place of the located line.  I'm doing edits to the isapi_redirect.properties and workers.properties files.  You may have other needs.  One other thing to note is the ordering of the edit CA's in the InstallExecuteSequence.  Each pair of CA calls performs one edit.  The first sets it up and the second does the actual edit.  For multiple edits to the same file, they have to be ordered properly, as shown in my example which does three edits to each of two files.

Anyway, I'll attach the .wxi files and hope they make it through the list.  If not, let me know and I'll try to post them individually.  That should be enough to get you started.

				Lewis Henderson
				OpenText, Inc.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Douglas, Keith (STATCAN)
Sent: Thursday, March 31, 2016 10:07 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Another apache tomcat issue...

Hi Lewis,

Would you be willing to share what you've done to handle the configuration for Tomcat? I'm going to be attempting to do that too at some point for some of my developers and am finding some matters a little challenging. (I had looked at using custom actions, and have most things worked out, but another approach might be useful to see.)

Thanks for the consideration,


Keith Douglas

Programmer Analyst, Collection Systems Division Statistics Canada / Government of Canada Keith.Douglas at canada.ca / Tel : 613-854-5589

Programmeur analyste, Division des systèmes de collecte Statistique Canada / Gouvernenment du Canada Keith.Douglas at canada.ca / Tél :613-854-5589

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Lewis Henderson
Sent: March-31-16 10:00 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Another apache tomcat issue...

Hi Phill,

Thanks for the reply.  I suspected something like this might be necessary.

				Lewis Henderson
				OpenText, Inc.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Phill Hogland
Sent: Wednesday, March 30, 2016 5:38 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Another apache tomcat issue...

I do this:
      <Component Transitive="yes">
        <RegistryValue Root="HKMU" Key="SYSTEM\CurrentControlSet\Services\serviceShortName\subfolder if needed" Name="parameter" Value="[MSI_PUBLIC_PROPERTY]" Type="string" KeyPath="yes" />
      </Component>

I use transitive='yes' because my mba may change the value on repair, but you may not want to do that.

________________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Lewis Henderson <henderso at opentext.com>
Sent: Wednesday, March 30, 2016 2:18 PM
To: WiX Toolset Users Mailing List
Subject: [wix-users]  Another apache tomcat issue...

Hi again Folks,

I'm trying to install the apache tomcat servlet using the "proper" Wix/MSI syntax, and things are going well up to a point.  I've got everything in place, except a registry key "Parameters" under the service's key.  There's nothing (but the empty default value) in this key, but the service won't start without it.

I used tomcat's service.bat file to install a mirror service to see what was wrong, and that subkey is the only difference.  I manually added the key, and my service starts.

I'd like to avoid using tomcat's service.bat file, but none of the service related elements appear to allow a subkey to be created.  Can I just hack in a RegistryKey element, or is there a better way?

Thanks again for the help.

                                                                Lewis Henderson
                                                                OpenText, inc.


____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list