User Tools

Site Tools


software:opensourcesoftware:opensourcesoftware:tomcat

My Configuration

Tomcat Specific

Out Of Memory Error

When you later run XWiki in Tomcat you may get an Out Of Memory error, especially if you're trying to import large files into your wiki. To solve this allocate more memory to the JVM. For Tomcat this can be done by setting the JAVA_OPTS environment property (on Windows to allocate 300MB you would set JAVA_OPTS to -Xmx300m). If you are running Tomcat as service then defining JAVA_OPTS will not help. There is a utility provided in the bin folder of your Tomcat installation (for example for Tomcat 5.x on Windows it's called tomcat5w.exe). It's a GUI tool which can be used to set various options including the heap size.

http://bugs.sakaiproject.org/confluence/display/DOC/Section+-+Tomcat+Installation+(2.5)

<html> <pre>

  1. Xmx768m
  2. Xms768m
  3. XX:PermSize=128m
  4. XX:MaxPermSize=256m

c:\Program Files\Java\jre6\bin\client\Xusage.txt Server Info

  1. Xmixed mixed mode execution (default)
  2. Xint interpreted mode execution only
  3. Xbootclasspath:<directories and zip/jar files separated by ;>

set search path for bootstrap classes and resources

  1. Xbootclasspath/a:<directories and zip/jar files separated by ;>

append to end of bootstrap class path

  1. Xbootclasspath/p:<directories and zip/jar files separated by ;>

prepend in front of bootstrap class path

  1. Xnoclassgc disable class garbage collection
  2. Xincgc enable incremental garbage collection
  3. Xloggc:<file> log GC status to a file with time stamps
  4. Xbatch disable background compilation
  5. Xms<size> set initial Java heap size
  6. Xmx<size> set maximum Java heap size
  7. Xss<size> set java thread stack size
  8. Xprof output cpu profiling data
  9. Xfuture enable strictest checks, anticipating future default
  10. Xrs reduce use of OS signals by Java/VM (see documentation)
  11. Xcheck:jni perform additional checks for JNI functions
  12. Xshare:off do not attempt to use shared class data
  13. Xshare:auto use shared class data if possible (default)
  14. Xshare:on require using shared class data, otherwise fail.
The -X options are non-standard and subject to change without notice.

</pre> </html>

IIS connector to Tomcat

<html> <p>Most of this information came from these very helpful and better written links: </p> <ul><li> <a href=“http://tomcat.apache.org/connectors-doc/reference/iis.html” class=“external text” title=“http://tomcat.apache.org/connectors-doc/reference/iis.html” rel=“nofollow”>The Apache Tomcat Connector - Reference Guide - Configuring IIS</a> </li><li> <a href=“http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html” class=“external text” title=“http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html” rel=“nofollow”>The Apache Tomcat Connector - Webserver HowTo - IIS Setup</a> </li><li> <a href=“http://tomcat.apache.org/connectors-doc/generic_howto/workers.html” class=“external text” title=“http://tomcat.apache.org/connectors-doc/generic_howto/workers.html” rel=“nofollow”>The Apache Tomcat Connector - Generic HowTo - Workers Howto</a> </li><li> <a href=“http://wiki.apache.org/tomcat/Tomcat_and_IIS_Howto” class=“external text” title=“http://wiki.apache.org/tomcat/Tomcat_and_IIS_Howto” rel=“nofollow”>Tomcat Wiki - Tomcat and IIS Howto</a>

</li></ul> <p>This link may also be helpful: </p> <ul><li> <a href=“http://confluence.atlassian.com/display/DOC/Setting+up+Confluence+with+IIS” class=“external text” title=“http://confluence.atlassian.com/display/DOC/Setting+up+Confluence+with+IIS” rel=“nofollow”>Setting up Confluence with IIS - a similar article to this one that contains screenshots</a> </li></ul> </html>

http://www.atlassian.com/software/jira/docs/v3.11/iisintegration.html

Steps

my specifics

Java JDK path : C:\Program Files\Java\jre1.6.0_07 
Tomcat path : E:\Xwiki\Tomcat 6.0
JSP/Servlet webroot (via IIS/mod_jk) : E:\Xwiki\Tomcat 6.0\webapps 
JSP/Servlet webroot (via native Tomcat server, port 8080) : E:\Xwiki\Tomcat 6.0\webapps
Access JSP/Servlet pages via IIS/mod_jk : http://localhost/[jkmount-mapped url of your webapp] 
Access native Tomcat server : http://localhost:8080/ 

1. isapi_redirect.dll

isapi_redirect.dll is placed in E:\Xwiki\Tomcat 6.0\bin\win32\i386\isapi_redirect.dll

2. New Registry Keys

When IIS calls isapi_redirect.dll, it checks for a local config file in the same directory as the dll. If the config file isn't there, it checks the registry (the registry is the normal way to configure it).

If you wish to increase the logging in the isapi.log file, set it to 'debug' instead of 'info'.

Under "HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0" create the following:
Add Name Value
string value extension_uri /jakarta/isapi_redirect.dll
string value log_file E:\Xwiki\Tomcat 6.0\logs\isapi.log
string value log_level info (can be debug, info, error or emerg)
string value worker_file E:\Xwiki\Tomcat 6.0\conf\workers.properties
string value worker_mount_file E:\Xwiki\Tomcat 6.0\conf\uriworkermap.properties

3. New IIS virtual directory

A virtual directory is needed within IIS to the isapi_redirect.dll file. The based on the registry entry “extension_uri” the dll will be accessed by Tomcat or IIS as “http:/jakarta/isapi_redirect.dll”; therefore, the virtual directory references “E:\Xwiki\Tomcat 6.0\bin\win32\i386”. (iis log file SYSTEM32/LogFiles/W3SVC1 )

  • Using the IIS management console, add a new virtual directory to your IIS web site.
  • The name of the virtual directory must be jakarta (see: entension_uri).
  • Its physical path should be the directory where you placed isapi_redirect.dll (E:\Xwiki\Tomcat 6.0\bin\win32\i386).
  • Give this new virtual directory “execute” access.

4. New IIS ISAPI filter

  • Using the IIS management console, add isapi_redirect.dll as a filter in your IIS web site.
    • To create the website“

<html> <pre> 1. Right-Click on the Web Sites Folder and Select New → Web Site 2. Click Next and enter “Academus” for a Description. 3. For the IP and Port settings, the default port 80 should be used. If you would like IIS to listen on a specific interface you may select it here. 4. Click Next and select the path to the root of the web server: INSTALL_ROOT\unicon\Academus\portal-tomcat-a\webapps 5. Click Next and select only the Read option. 6. Click Finish. 7. Right Click on the Academus Web Site and select properties. 8. On the Web Site Tab, change the Active Log Format to NCSA Common Log Format 9. On the Homepage Tab, select “A redirection to a URL” and Type in “http://SERVERNAME/portal” in the “Redirect to:” entry box 10. Place a check mark next to the “A Directory below URL entered” 11. On the Documents Tab, remove all of the content page types and add index.html 12. Click apply, but do not close this dialog as we will need it in the next section </pre> </html>

  • Under the website properties, go to the ISAPI Filters tab and add a new filter called 'Jakarta-Tomcat' (I don not think the name references anything).
  • The name of the filter should reflect its task (I use the name tomcat), its executable must be E:\Xwiki\Tomcat 6.0\bin\win32\i386\isapi_redirect.dll.
  • The filter should go to:
    • E:\Xwiki\Tomcat 6.0\bin\win32\i386\isapi_redirect.dll

<html> <pre> 4.8 Add .properties mime type 3. In the IIS Manager, right-click on the local computer and select properties 4. Click the MIME Types… button 5. Click New and enter .properties in the Extension field and text/plain in the MIME type field 6. Click OK until you are back to the IIS Manager </pre> </html>

5. Jakarta Isapi Redirector to the Web Service Extensions

If you're using IIS 6.0 you must also do the following:

Using the IIS management console, add the Jakarta Isapi Redirector to the Web Service Extensions.

  • Right-click on Web Service Extensions and choose Add a new Web Service Extension.
  • Enter tomcat for the Extension Name.
  • Add the E:\Xwiki\Tomcat 6.0\bin\win32\i386\isapi_redirect.dll to the required files.
  • Check the Set extension status to Allowed.
  • Click on OK.

6. Restart IIS

  • Restart IIS (stop + start the IIS service)
  • make sure that the tomcat filter is marked with a green up-pointing arrow.

7. Tomcat configuration

I changed or created three configuration files. All of them were in E:\Xwiki\Tomcat 6.0\conf.

server.xml

Unchanged

Example: server.xml is the main setup file for Tomcat that specifies virtual hosts, connectors and the like. I added a line to the standard Laszlo setup for the connector on port 8009. Please see the example file below. The original connector for port 8080 I left intact.

<Server port="8005" shutdown="SHUTDOWN">
  <Service name="LPS">
    <Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
  <Connector port="8080" />
    <Engine name="LPS" defaultHost="localhost">
      <Logger className="org.apache.catalina.logger.FileLogger" />
      <Host name="localhost" appBase="webapps" />
    </Engine>
  </Service>
</Server>

An example

/etc/tomcat/server.xml
This is the main configuration file for Tomcat.
Most of it should be set correctly and can be left alone. Please note the section:
  <Connector className="org.apache.tomcat.service.PoolTcpConnector"> 
     <Parameter name="handler" 
       value="org.apache.tomcat.service.http.HttpConnectionHandler"/> 
     <Parameter name="port" 
      value="8081"/> 
  </Connector> 
This configures Tomcat to be an HTTP server on port 8081.
You probably do not want this in a production environment,
it is a security risk, so comment it out once you have set everything up. Comments are done like in HTML, with <!- ... ->.
Near the bottom of the file is the Context section. Here is where you add new web applications.
  <Context path="/examples" 
     docBase="webapps/examples" 
     crossContext="false" 
     debug="0" 
     reloadable="true" > 
  </Context> 
The path defines the URL path that this context is for.
In this example, that would be http://localhost/examples/. docBase specifies where the web application is to be found. You may specify absolute paths,
but if you put a relative path it will be relative to TOMCAT_HOME which is /usr/share/tomcat in Debian, by default. crossContext allows the web app to access other contexts, default is true.
Default for debug is 0. reloadable=''true'' will cause the web application to be recompiled each time it is accessed, which may be bad for a production environment; default is ``true'' however.
When you add a Context to this file, you must update the tomcat.conf that you copied from tomcat-auto, if you decided to copy it.
When you do Virtual Hosts (see Section [*]), you must add the information that would normally go in tomcat-auto to the correct <VirtualHost> section instead.

workers.properties file

http://www.ccl.net/cca/software/UNIX/apache/solaris-t3.2b5/files/workers.properties.txt.shtml

http://www.ccl.net/cca/software/UNIX/apache/solaris-t3.2b5/files/workers.properties-12.shtml

The workers.properties file I created in E:\Xwiki\Tomcat 6.0\conf The workers file tells Tomcat about connectors or 'workers', which port, host and protocol they are using.

This is my configuration.

workers.tomcat_home=E:\Xwiki\Tomcat 6.0
workers.java_home=C:\Program Files\Java\jre1.6.0_07
# You should configure your environment slash... ps=\ on NT and / on UNIX
ps=\
# Define worker
worker.list=wikiWorker
# Set properties for worker 'wikiWorker' (ajp13)
worker.wikiWorker.port=8009
worker.wikiWorker.host=localhost
worker.wikiWorker.type=ajp13
worker.wikiWorker.cachesize=10
worker.wikiWorker.cache_timeout=600
worker.wikiWorker.socket_keepalive=1
worker.wikiWorker.recycle_timeout=300

This is an example.

# Define worker 'example'
worker.list=example
 
# Set properties for worker 'example' (ajp13)
worker.example.type=ajp13
worker.example.host=localhost
worker.example.port=8009
 
worker.example.cachesize=10
worker.example.cache_timeout=600
worker.example.socket_keepalive=1
worker.example.recycle_timeout=300

Another example

/etc/apache/mod_jk/workers.properties
A worker is basically a Tomcat listener, it waits for information from Apache and gives it to Tomcat.
This file comes with all the ``inprocess'' workers uncommented, 
the ``inprocess'' standing for ``in the Apache process'' which is not what we want to do.
Here is my workers.properties (note that the file comes with extensive comments):
  workers.tomcat_home=/usr/share/tomcat 
  workers.java_home=/usr/lib/jdk1.1/ 
  ps=/ 
  worker.list=ajp12,ajp13 
  worker.ajp12.port=8007 
  worker.ajp12.host=localhost 
  worker.ajp12.type=ajp12 
  worker.ajp12.lbfactor=1 
  worker.ajp13.port=8009 
  worker.ajp13.host=localhost 
  worker.ajp13.type=ajp13 
  worker.ajp13.lbfactor=1 
  worker.loadbalancer.type=lb 
  worker.loadbalancer.balanced_workers=ajp12,ajp13 
  worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes 

Correlation between uriworkermap and worker

Example uriworkermap.properties:

/examples/*=worker1
/axis/*=axis

Example workers.properties:

worker.list=worker1,axis

worker.worker1.host=192.168.1.23
worker.worker1.port=8009
worker.worker1.type=ajp13
worker.axis.host=192.168.1.11
worker.axis.port=8009
worker.axis.type=ajp13 

uriworkermap.properties file

http://tomcat.apache.org/connectors-doc/reference/uriworkermap.html

The uriworkermap.properties is a simple text file that determines the kind of requests that get passed on to Tomcat rather than being handled by IIS.

I created the uriworkermap.properties file in E:\Xwiki\Tomcat 6.0\conf

/xwiki/*=wikiWorker

This is Laszlo's example setup of the uriworkermap.properties file. I set it to handle everything with the url /lps-4.0.2, specifying * rather than *.lzx because I didn't want to have to add a line for every single file extension in Laszlo's directory.

/lps-4.0.2/*=defWorker
/lps-4.0.2/servlet/*=defWorker

If you wanted just .lzx files handled for instance you could just specify:

/lps-4.0.2/*.lzx=defWorker
/lps-4.0.2/servlet/*=defWorker

In summary:

From OpenLaszlo

<html>

    <h3 id="siteSub">From OpenLaszlo</h3>
    <div id="contentSub"/>
    	    	    <!-- start content -->
    <table summary="Contents" class="toc" id="toc"><tbody><tr><td><div id="toctitle"><h2>Contents</h2> <span class="toctoggle">[<a id="togglelink" class="internal" href="javascript:toggleToc()">hide</a>]</span></div>

<ul> <li class=“toclevel-1”><a href=”#Configuring_Laszlo_to_run_through_IIS_using_mod_jk.2Fisapi_redirect.dll“>1 Configuring Laszlo to run through IIS using mod_jk/isapi_redirect.dll</a> <ul> <li class=“toclevel-2”><a href=”#Summary_for_techies“>1.1 Summary for techies</a></li> <li class=“toclevel-2”><a href=”#Introduction“>1.2 Introduction</a></li> <li class=“toclevel-2”><a href=”#What_you_need“>1.3 What you need</a></li> <li class=“toclevel-2”><a href=”#Tested_Environments“>1.4 Tested Environments</a></li> <li class=“toclevel-2”><a href=”#New_Registry_Keys“>1.5 New Registry Keys</a></li> <li class=“toclevel-2”><a href=”#New_IIS_virtual_directory“>1.6 New IIS virtual directory</a></li> <li class=“toclevel-2”><a href=”#New_IIS_ISAPI_filter“>1.7 New IIS ISAPI filter</a></li> <li class=“toclevel-2”><a href=”#Tomcat_configuration“>1.8 Tomcat configuration</a> <ul> <li class=“toclevel-3”><a href=”#server.xml“>1.8.1 server.xml</a></li> <li class=“toclevel-3”><a href=”#workers.properties_file“>1.8.2 workers.properties file</a></li> <li class=“toclevel-3”><a href=”#uriworkermap.properties_file“>1.8.3 uriworkermap.properties file</a></li> </ul> </li> <li class=“toclevel-2”><a href=”#Where_you_put_your_Laszlo_code“>1.9 Where you put your Laszlo code</a></li> <li class=“toclevel-2”><a href=”#Upgrading_versions“>1.10 Upgrading versions</a> <ul> <li class=“toclevel-3”><a href=”#Whilst_the_existing_Laszlo_is_still_running“>1.10.1 Whilst the existing Laszlo is still running</a></li> <li class=“toclevel-3”><a href=”#Whilst_the_existing_Laszlo_is_stopped“>1.10.2 Whilst the existing Laszlo is stopped</a></li> </ul> </li> <li class=“toclevel-2”><a href=”#Troubleshooting_and_Ongoing_Debugging“>1.11 Troubleshooting and Ongoing Debugging</a> <ul> <li class=“toclevel-3”><a href=”#Increasing_IIS_logging“>1.11.1 Increasing IIS logging</a></li> <li class=“toclevel-3”><a href=”#Checklist“>1.11.2 Checklist</a></li> </ul> </li> </ul> </li> </ul> </td></tr></tbody></table><script type=“text/javascript”> if (window.showTocToggle) { var tocShowText = “show”; var tocHideText = “hide”; showTocToggle(); } </script>

[<a title=“Edit section: Configuring Laszlo to run through IIS using mod_jk/isapi_redirect.dll” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=1“>edit</a>]

<a name=“Configuring_Laszlo_to_run_through_IIS_using_mod_jk.2Fisapi_redirect.dll”/><h2> Configuring Laszlo to run through IIS using mod_jk/isapi_redirect.dll </h2>

[<a title=“Edit section: Summary for techies” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=2“>edit</a>]

<a name=“Summary_for_techies”/><h3>Summary for techies</h3> <p>This article describes how to setup Laszlo on Apache Tomcat to work through IIS, using mod_jk to talk between them. It involves downloading the isapi_redirect.dll from Apache's site, configuring IIS to use the .dll and creating or editing some Tomcat configuration files. It may or may not involve a restart of the IIS service depending on your environment. </p><p>Other than the normal setup of mod_jk/isapi_redirect.dll described in the below Apache links, you need to add a connector to your server.xml file for AJP, on the same port as the worker you describe in your workers.properties file. </p>

[<a title=“Edit section: Introduction” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=3“>edit</a>]

<a name=“Introduction”/><h3>Introduction</h3> <p>Many Windows-based organisations will have IIS running their ASP/PHP website beautifully, but would also like to incorporate Laszlo technology into their website. The easiest solution is to compile a Laszlo application into a Flash file or DHTML package, then place it in your IIS web tree. That's called 'solo' mode and whilst being the easiest to deploy has some limitations compared with 'proxied' mode where you run the scripts directly from the Laszlo server. </p><p>The issue with proxied mode is that IIS can't process Laszlo scripts directly, Laszlo is Java based and needs to run in a Java server such as Tomcat or JBoss. However there is a connector 'mod_jk' from the Apache Foundation, which can bridge the gap between Tomcat and IIS. This article is about setting up that bridge, so that when IIS sees a request for an .lzx file, it passes the request to Tomcat and returns the result to the browser. </p><p>An advantage of going through IIS or Apache is that if you have a scripting language such as PHP that uses sessions authentication, your Laszlo scripts can use the same session. This means you know who the person is using the Laszlo script and can customise it to them. For example it has been used to limit options available depending on the user's security level.<br/> </p><p>To start off with, Tomcat is a Java server called a servlet container. It takes http requests just like IIS and the Apache HTTPD server, does some processing and gives a response. It can be a webserver on its own for Java Server Pages (JSP) or coupled with another webserver like IIS or Apache. </p><p>Though not addressed in this article it is possible to configure Tomcat for load balancing on various machines. Laszlo doesn't necessarily have to be installed on the same machine as IIS for this concept to work, as long as your isapi_redirect.dll is available to the IIS machine. If you were going to attempt that setup, at a guess you would change the host from 'localhost' to something else in your worker.properties file and update the registry settings. </p><p>Most of this information came from these very helpful and better written links: </p> <ul><li> <a rel=“nofollow” title=“http://tomcat.apache.org/connectors-doc/reference/iis.html” class=“external text” href=“http://tomcat.apache.org/connectors-doc/reference/iis.html”>The Apache Tomcat Connector - Reference Guide - Configuring IIS</a> </li><li> <a rel=“nofollow” title=“http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html” class=“external text” href=“http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html”>The Apache Tomcat Connector - Webserver HowTo - IIS Setup</a> </li><li> <a rel=“nofollow” title=“http://tomcat.apache.org/connectors-doc/generic_howto/workers.html” class=“external text” href=“http://tomcat.apache.org/connectors-doc/generic_howto/workers.html”>The Apache Tomcat Connector - Generic HowTo - Workers Howto</a> </li><li> <a rel=“nofollow” title=“http://wiki.apache.org/tomcat/Tomcat_and_IIS_Howto” class=“external text” href=“http://wiki.apache.org/tomcat/Tomcat_and_IIS_Howto”>Tomcat Wiki - Tomcat and IIS Howto</a> </li></ul> <p>This link may also be helpful: </p> <ul><li> <a rel=“nofollow” title=“http://confluence.atlassian.com/display/DOC/Setting+up+Confluence+with+IIS” class=“external text” href=“http://confluence.atlassian.com/display/DOC/Setting+up+Confluence+with+IIS”>Setting up Confluence with IIS - a similar article to this one that contains screenshots</a> </li></ul>

[<a title=“Edit section: What you need” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=4“>edit</a>]

<a name=“What_you_need”/><h3>What you need</h3> <ul><li> administrator privileges on the machine </li><li> IIS installed </li><li> Laszlo installed within Tomcat (check that it works on its own first by going to port 8080 on your local machine!) </li><li> <a rel=“nofollow” title=“http://tomcat.apache.org/connectors-doc/” class=“external text” href=“http://tomcat.apache.org/connectors-doc/”>isapi_redirect.dll/mod_jk</a> from the Apache Tomcat website </li></ul> <p>The isapi_redirect.dll connector allows a request from a webserver like IIS or Apache to be made to Tomcat, then the response returned to the browser. Processing of the entire file is passed to Tomcat and the result sent straight to the browser, so this isn't really for processing part of a PHP script, then processing a bit of Laszlo then going back again to PHP. <br/> </p>

[<a title=“Edit section: Tested Environments” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=5“>edit</a>]

<a name=“Tested_Environments”/><h3>Tested Environments</h3> <p>The system tested was running Windows XP Professional SP2 with IIS 5.1, OpenLaszlo 3.3.3 / 4.0.0 / 4.0.2 / 4.0.12 bundled with Tomcat 5.0.24. The basic principles should apply to IIS6 on Windows Server 2003 and also using the .war version of Laszlo. </p>

[<a title=“Edit section: New Registry Keys” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=6“>edit</a>]

<a name=“New_Registry_Keys”/><h3>New Registry Keys</h3> <p>When IIS calls isapi_redirect.dll, it checks for a local config file in the same directory as the dll. If the config file isn't there, it checks the registry (the registry is the normal way to configure it). </p><p>Please see <a rel=“nofollow” title=“http://tomcat.apache.org/connectors-doc/reference/iis.html” class=“external text” href=“http://tomcat.apache.org/connectors-doc/reference/iis.html”>Apache's mod_jk-IIS setup page</a> for an explanation of the registry settings.<br/> If you wish to increase the logging in the jk_iis.log file, set it to 'debug' instead of 'info'. </p><p>Under “HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\1.0” create the following keys:<br/> </p> <table style=”“> <tbody><tr> <td><b>Name</b> </td><td><b>Value</b> </td></tr> <tr> <td>extension_uri </td><td>/tomcat/isapi_redirect.dll </td></tr> <tr> <td>log_file </td><td>C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf\jk_iis.log </td></tr> <tr> <td>log_level </td><td>info </td></tr> <tr> <td>worker_file </td><td>C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf\workers.properties </td></tr> <tr> <td>worker_mount_file </td><td>C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf\uriworkermap.properties </td></tr></tbody></table>

[<a title=“Edit section: New IIS virtual directory” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=7“>edit</a>]

<a name=“New_IIS_virtual_directory”/><h3>New IIS virtual directory</h3> <p>A virtual directory is needed within IIS to the isapi_redirect.dll file. Although it can probably be called something else, I called it 'tomcat' and had it referring to C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf </p>

[<a title=“Edit section: New IIS ISAPI filter” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=8“>edit</a>]

<a name=“New_IIS_ISAPI_filter”/><h3>New IIS ISAPI filter</h3> <p>Under the website properties, go to the ISAPI Filters tab and add a new filter called 'tomcat'. <br/> The filter should go to:<br/> C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf\isapi_redirect.dll </p>

[<a title=“Edit section: Tomcat configuration” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=9“>edit</a>]

<a name=“Tomcat_configuration”/><h3>Tomcat configuration</h3> <p>I changed or created three configuration files. All of them were in C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf. Please see below for the changes to each file. </p>

[<a title=“Edit section: server.xml” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=10“>edit</a>]

<a name=“server.xml”/><h4>server.xml</h4> <p>server.xml is the main setup file for Tomcat that specifies virtual hosts, connectors and the like. I added a line to the standard Laszlo setup for the connector on port 8009. Please see the example file below. The original connector for port 8080 I left intact.<br/> </p> <pre><Server port=“8005” shutdown=“SHUTDOWN”>

<Service name="LPS">
  <Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<Connector port="8080" />
  <Engine name="LPS" defaultHost="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" />
    <Host name="localhost" appBase="webapps" />
  </Engine>
</Service>

</Server> </pre> <p>In summary: </p> <ul><li> if the user goes to <a rel=“nofollow” title=“http://hostname:8080/lps-4.0.2/my-apps/sample_app/src/sample.lzx” class=“external free” href=“http://hostname:8080/lps-4.0.2/my-apps/sample_app/src/sample.lzx”>http://hostname:8080/lps-4.0.2/my-apps/sample_app/src/sample.lzx</a> they will only be conversing with Tomcat on port 8080 without involving IIS </li><li> if the user goes to <a rel=“nofollow” title=“http://hostname/lps-4.0.2/my-apps/sample_app/src/sample.lzx” class=“external free” href=“http://hostname/lps-4.0.2/my-apps/sample_app/src/sample.lzx”>http://hostname/lps-4.0.2/my-apps/sample_app/src/sample.lzx</a> IIS will see the request and pass it on to Tomcat using isapi_redirect.dll talking on port 8009 </li></ul>

[<a title=“Edit section: workers.properties file” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=11“>edit</a>]

<a name=“workers.properties_file”/><h4>workers.properties file</h4> <p>The workers.properties file I created in C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf<br/> The workers file tells Tomcat about connectors or 'workers', which port, host and protocol they are working on (not sure how to explain this, maybe a Tomcat expert could explain better). <br/>

worker.list=defWorker<br/>
worker.defWorker.port=8009<br/>
worker.defWorker.host=localhost<br/>
worker.defWorker.type=ajp13<br/>

</p>

[<a title=“Edit section: uriworkermap.properties file” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=12“>edit</a>]

<a name=“uriworkermap.properties_file”/><h4>uriworkermap.properties file</h4> <p>I created the uriworkermap.properties file in C:\Program Files\OpenLaszlo Server 4.0.2\Server\tomcat-5.0.24\conf </p><p>The uriworkermap.properties is a simple text file that determines the kind of requests that get passed on to Tomcat rather than being handled by IIS. This is my example setup of the uriworkermap.properties file. I set it to handle everything with the url /lps-4.0.2, specifying * rather than *.lzx because I didn't want to have to add a line for every single file extension in Laszlo's directory. </p><p>

/lps-4.0.2/*=defWorker<br/>
/lps-4.0.2/servlet/*=defWorker

</p><p>If you wanted just .lzx files handled for instance you could just specify:<br/>

/lps-4.0.2/*.lzx=defWorker<br/>
/lps-4.0.2/servlet/*=defWorker

</p>

[<a title=“Edit section: Where you put your Laszlo code” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=13“>edit</a>]

<a name=“Where_you_put_your_Laszlo_code”/><h3>Where you put your Laszlo code</h3> <p>Laszlo code should stay in the normal Laszlo area, for me it is C:\Program Files\OpenLaszlo Server 4.0.2\Server\lps-4.0.2 </p><p>So a call to a sample page might be <a rel=“nofollow” title=“http://localhost/lps-4.0.2/my-apps/test_app/bin/testapp.lzx” class=“external free” href=“http://localhost/lps-4.0.2/my-apps/test_app/bin/testapp.lzx”>http://localhost/lps-4.0.2/my-apps/test_app/bin/testapp.lzx</a><br/> But it could also be simply <a rel=“nofollow” title=“http://localhost/lps-4.0.2/test.lzx” class=“external free” href=“http://localhost/lps-4.0.2/test.lzx”>http://localhost/lps-4.0.2/test.lzx</a> if you have a single file in the root directory. </p><p>It might be possible to store Laszlo files within the main webroot, modifying the uri properties file. That isn't tested though. </p>

[<a title=“Edit section: Upgrading versions” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=14“>edit</a>]

<a name=“Upgrading_versions”/><h3>Upgrading versions</h3> <p>If you wish to upgrade your version of Laszlo and have already done the above described setup, it is still fairly easy.<br/> </p>

[<a title=“Edit section: Whilst the existing Laszlo is still running” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=15“>edit</a>]

<a name=“Whilst_the_existing_Laszlo_is_still_running”/><h4>Whilst the existing Laszlo is still running</h4> <ul><li> install the new version of Laszlo alongside </li><li> copy the configuration files in the tomcat conf directory, except for server.xml - I'd recommend manually changing it again as it may have a different format. <ul><li> you can test the new setup on a different port by changing server.xml </li></ul> </li><li> update the new configuration files to the new paths </li></ul>

[<a title=“Edit section: Whilst the existing Laszlo is stopped” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=16“>edit</a>]

<a name=“Whilst_the_existing_Laszlo_is_stopped”/><h4>Whilst the existing Laszlo is stopped</h4> <ul><li> update your virtual directory in IIS </li><li> update your registry settings </li><li> restart the IIS service if necessary </li></ul>

[<a title=“Edit section: Troubleshooting and Ongoing Debugging” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=17“>edit</a>]

<a name=“Troubleshooting_and_Ongoing_Debugging”/><h3>Troubleshooting and Ongoing Debugging</h3> <p>For development and troubleshooting I run Tomcat off the commandline in a window, rather than as a service. The jk_iis.log log file still tells you more than the window though. IIS by default won't give you enough information in its logs so you'll need to ramp up what it tells you. </p><p>You can increase the logging in the jk_iis.log file by changing 'info' to 'debug' for the log level. You will need to restart the service to enact the change. </p>

[<a title=“Edit section: Increasing IIS logging” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=18“>edit</a>]

<a name=“Increasing_IIS_logging”/><h4>Increasing IIS logging</h4> <p>These steps are for increasing the level of IIS logging so that you can see GET/POST request details coming from Laszlo. Obviously this is for a development machine rather than a live server and a normal ISP won't be making these changes for you. </p> <ol><li> as an admin open the IIS console </li><li> open the properties of the website where Laszlo runs </li><li> enable logging if not already enabled </li><li> set it to use W3C Extended Log File Format </li><li> click on the 'Properties' button in the logging area <ol><li> note where it saves the log file for your reference </li><li> go to the extended properties tab </li><li> enable extended properties and consider enabling Client IP address, URI stem, URI query, Method (this is POST or GET), bytes sent, bytes received, time taken etc. </li></ol> </li></ol>

[<a title=“Edit section: Checklist” href=”/index.php?title=LaszloWithIIS&amp;action=edit&amp;section=19“>edit</a>]

<a name=“Checklist”/><h4>Checklist</h4> <ul><li> Make sure the user IIS runs as has permission to see the Laszlo web tree and to write to the log file (you specify the path in the registry settings mentioned above) </li><li> Make sure the port for the worker in your properties file and the connector in the server.xml are the same. If they are different or the connector isn't in place in server.xml, you'll see Tomcat make the request but time out with no response </li><li> Make sure that if you're using sessions authentication, a session is actually active in your browser. Laszlo might be expecting an xml response from the server but instead is actually getting an HTML login page (HTML 4 isn't well-formed so it will generate errors) </li><li> Paste links or requests in the browser manually to check that you have the right url/uri. Laszlo might be getting a 404 'page not found' or being redirected to a default page (the IIS log will show that too). </li><li> Make sure the uriworker.properties file is setup to handle the requests - it has to be clear which requests will be handled by IIS and which will be handled by Tomcat. <ul><li> if something is wrong here, you will see IIS display the contents of the .lzx file instead of executing it </li></ul> </li><li> if your Laszlo page doesn't appear or appears broken in development mode (where it displays compile buttons and the like), remember that the uriworker.properties file either has to have * for all extensions or a line for each extension Tomcat handles eg. *.js *.lzx *.swf *.htm, not just *.lzx, because it uses a page that embeds the Flash. Look in the /lps directory in the Laszlo web tree and see which file extensions are used. </li><li> Restarting IIS or even the whole machine might help after you set it up for the first time </li><li> If Tomcat says that it's discarding an unexpected response '100 continue', that message can usually be ignored and the show can go on </li></ul>

    	    <!-- end content -->
    <div class="visualClear"/>
  </div>

</html>

software/opensourcesoftware/opensourcesoftware/tomcat.txt · Last modified: 2022/07/17 21:08 by superwizard