You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Konstantin Kolinko (Confluence)" <no...@apache.org> on 2019/11/25 02:50:09 UTC

[CONF] Apache Tomcat > Windows

There's **1 new edit** on this page  
---  
|  
---  
|  | [![page icon](cid:page-
icon)](https://cwiki.apache.org/confluence/display/TOMCAT/Windows?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574650208946&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"page icon")  
---  
[Windows](https://cwiki.apache.org/confluence/display/TOMCAT/Windows?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574650208946&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"Windows")  
|  |  |  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited this page  
---  
|  
|  | Here's the version comment  
---  
|  
---  
|  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited at [02:45
AM](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103099101)  
---  
|  |  |  Add a permalink. Fix formatting and links.  
---  
|  
|  | Here's what changed:  
---  
|

_Permalink_ to this page: [
https://cwiki.apache.org/confluence/x/3SolBg](https://cwiki.apache.org/confluence/x/3SolBg)

## Preface

This page addresses various issues related to running Tomcat on a Windows
platform. Please see the
[UsefulLinks](/confluence/pages/viewpage.action?pageId=103100724) for more
links related to Windows.

...

  1. [Why do I get Out of Environment Space?](/confluence/pages/viewpage.action?pageId=103099101)
  2. [When I start up tomcat (or when it is running), I get the error java.lang.IllegalMonitorStateException: current thread not owner](/confluence/pages/viewpage.action?pageId=103099101)
  3. [Can I turn off case sensitivity?](/confluence/pages/viewpage.action?pageId=103099101)
  4. [Can I use NTLM authentication?](/confluence/pages/viewpage.action?pageId=103099101)
  5. [I want to redeploy web applications, how do I prevent resources from getting locked?](/confluence/pages/viewpage.action?pageId=103099101)
  6. [Can I use UNC paths?](/confluence/pages/viewpage.action?pageId=103099101)
  7. [Why can't Tomcat see my mapped drive when running as a service?](/confluence/pages/viewpage.action?pageId=103099101)
  8. [Why aren't access logs showing up in Tomcat on Vista?](/confluence/pages/viewpage.action?pageId=103099101)
  9. [Why do I get a "HTTP/1.x 400 No Host matches server name" error when I change the "webapps" folder in Tomcat on Vista?](/confluence/pages/viewpage.action?pageId=103099101)
  10. [How do I add or customize a Windows Service for Tomcat?](/confluence/pages/viewpage.action?pageId=103099101)
  11. [What are tomcat6wtomcat9w.exe/tomcat6tomcat9.exe (or tomcat7w.exe/tomcat7.exe etc..) ?](/confluence/pages/viewpage.action?pageId=103099101)

## Answers

###  |
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q1  
---|---  
| Q1  
Why do I get Out of Environment Space?

Check the Tomcat README, and [this link](https://marc.info/?l=tomcat-
user&m=103918210305702&w=2)

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q2  
---|---  
| Q2  
When I start up tomcat (or when it is running), I get the error
java.lang.IllegalMonitorStateException: current thread not owner

That weird issue was observed many years ago and now is a history. See the
[Tomcat Bug Report
#13723](https://bz.apache.org/bugzilla/show_bug.cgi?id=13723) and [Sun Bug
Parade report
#4776385](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4776385) for
the answer.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q3  
---|---  
| Q3  
Can I turn off case sensitivity?

It is [possible](https://tomcat.apache.org/tomcat-6.0-doc/config/context.html)
in Tomcat 6 and earlier, but not recommended.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q4  
---|---  
| Q4  
Can I use NTLM authentication?

Yes.

  * [Waffle/JNA](http://waffle.codeplex.com/) (obsolete)
  * [Tomcat SPNEGO](http://tomcatspnego.codeplex.com/) (obsolete)
  * [SPNEGO SF](http://spnego.sourceforge.net/)
  * [Jespa](http://www.ioplex.com/jespa.html) (commercial)
  * [Tomcat IIS Connector](https://tomcat.apache.org/connectors-doc/webserver_howto/iis.html)
  * [Samba JCIFs](http://jcifs.samba.org/src/docs/ntlmhttpauth.html) (obsolete, no NTLMv2)

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q5  
---|---  
| Q5  
I want to redeploy web applications, how do I prevent resources from getting
locked?

Most locking issues will occur with JARs from /WEB-INF/lib, and are usually
caused by access through URLs. Tomcat has mechanisms to allow avoiding
locking.

Since Tomcat 5.0, a mechanism exists to prevent locking when accessing
resources using the getResource method of the URLClassLoader. Many
applications, such as Xerces, do not set the use of caching to false before
opening the URL connection to a JAR file, and that causes locking. In Tomcat
5.5, this mechanism is disabled by default (as it has a non negligible
influence on startup times, and is often useless), and can be enabled using
the `antiJARLocking` attribute of the
[Context](https://tomcat.apache.org/tomcat-9.0-doc/config/context.html)
element. If getResource call occurs, resources inside the JARs will be
extracted to the work directory of the web application. There is an
alternative to this since Tomcat 6.0.24: you can configure a
[JreMemoryLeakPreventionListener](https://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/catalina/core/JreMemoryLeakPreventionListener.html)
in your `server.xml` and it will set the URL connection caching to be off by
default.

There is another lock prevention mechanism in Tomcat 5.5
(`antiResourceLocking` attribute), which will cause the web application files
to be copied to the temp folder and run from this location. This has a larger
impact on web application startup times, but obviously prevents locking on all
resources of the web application. This also allows more flexible management
operations as none of the web application resources will be locked, even while
the web application is running (as a special note, when making changes to JSPs
without reloading the application, the changes have to be duplicated to the
path where the web application resources have been copied in the temp folder).

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q6  
---|---  
| Q6  
Can I use UNC paths?

Yes. Make sure that the user that Tomcat is running as is able to access the
path. This is particularly important when running Tomcat as a service since
the local service account will **not** have the necessary permissions.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q7  
---|---  
| Q7  
Why can't Tomcat see my mapped drive when running as a service?

The mapped drives are part of a user's profile and they are not used when
running as a service. You should be OK with UNC paths.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q8  
---|---  
| Q8  
Why aren't access logs showing up in Tomcat on Vista?

By default, the Tomcat Windows Service installer attempts to place Tomcat
inside the "Program Files" folder. Default Vista folder permissions cause
various logging functions (though mysteriously not every log function) to fail
silently. It is best to change Tomcat's install folder to something like
"C:\Tomcat". This issue can be hard to spot because by default the access logs
are not enabled and the example webapps work just fine.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q9  
---|---  
| Q9  
Why do I get a "HTTP/1.x 400 No Host matches server name" error when I change
the "webapps" folder in Tomcat on Vista?

By default, the Tomcat Windows Service installer attempts to place Tomcat
inside the "Program Files" folder. Default Vista folder permissions conflict
with the contents of the "webapps" folder, can case a blank page to come up
when attempting to access the webapp. By using a HTTP Header inspector like
"[Live HTTP Headers](https://addons.mozilla.org/en-US/firefox/addon/3829)" you
can see a slightly more descriptive error message. It is best to change
Tomcat's install folder to something like "C:\Tomcat". This issue can be hard
to spot because by default the example webapps work just fine.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q10  
---|---  
| Q10  
How do I add or customize a Windows Service for Tomcat?

Tomcat uses the Apache Commons Daemon. You can read its documentation at http
[https://commons.apache.org/proper/commons-
daemon/procrun.html](https://commons.apache.org/proper/commons-
daemon/procrun.html) As a short example, you can create a new Windows Service
with the full version number in its name like this:

...

See also the `service.bat` file that comes in the `*-windows-<arch>`.zip
distributives distributions of Tomcat.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q11  
---|---  
| Q11  
What are

...

###  tomcat9w.exe/

...

###  tomcat9.exe (or tomcat7w.exe/tomcat7.exe etc..)?

Questions on this topic come regularly at various levels. So this is a longish
explanation meant basically for real Tomcat/Windows beginners. Apologies in
advance for any shortcuts and approximations. You can sort this out by
yourself according to your own needs.

...

The Apache "procrun" software project provides such a wrapper program. Its
original documentation can be found here: http
[https://commons.apache.org/proper/commons-
daemon/procrun.html](https://commons.apache.org/proper/commons-
daemon/procrun.html). But this documentation is more of the "reference" type :
good for someone who already knows what they are looking for, but not very
good as an introduction; and it doesn't explain what tomcat7w.exe (or
tomcat6w.exe or tomcat5w.exe) and tomcat7.exe (or tomcat6.exe or tomcat5.exe)
really are. From there this FAQ entry.

...

One more thing: because the tomcat7.exe wrapper program actually "runs" the
JVM, it must match the type of JVM that it runs, in terms of 32bit/64bit
version. If you try to start a 64-bit JVM with a 32-bit tomcat7.exe, it won't
work, and vice-versa. This is why there are several versions of the
tomcat7.exe program: one 32-bit version and two one 64-bit version for two
different 64-bit CPU architectures.

One of the The 64-bit versions version is for the widely used "AMD64"/"x86-64"
architecture (x64). If you have a 64-bit processor it is likely that you want
to use this one. Another one is (Some time ago there was another 64-bit
version provided as well: the one for the "Intel Itanium" architecture "IA-64"
which is more rare (i64). It was discontinued). You must install and use the
correct one matching the JVM that you are using.

The Tomcat Service installer for Windows normally bundles all three versions
of the service wrapper and selects one for you automatically, according to the
JRE instance that you selected during installation. The ZIP distributives
distributions of Tomcat contain only one version of the program, so you have
to select the correct distributive to download (*-windows-x86.zip , or
*-windows-x64.zip or *-windows-i64.zip).

  

  
  
  
|  |  | [Go to page
history](https://cwiki.apache.org/confluence/pages/viewpreviousversions.action?pageId=103099101&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574650208946&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db "Go to page
history")  
---  
---  
| [View
page](https://cwiki.apache.org/confluence/display/TOMCAT/Windows?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574650208946&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view)  
---  
  
|  | [Stop watching
space](https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=TOMCAT&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574650208946&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=stop-
watching&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4c3JmOjhhYTk4MDk1NjlkNDIzY2QwMTZhMDQxMzMwNmYwMGRiIiwicXNoIjoiNWJkZWM1YzBjMjkzY2MxMzk0MGUxMDhjNDZiZjcyM2ZlNjdlNTc2MzIwMDZlMDhkMGUxNjI5YTI2ODFhNjAzOCIsImlzcyI6ImNvbmZsdWVuY2Vfbm90aWZpY2F0aW9uc0FSRUgtWFVEMS1QT1FHLUNTQU8iLCJleHAiOjE1NzUyNTUwMDgsImlhdCI6MTU3NDY1MDIwOH0.t2NSThe8M1xsbdblSXWte8pVaIzNsdOXdZjTpdXdOSs)
| •  
---|---  
[Manage
notifications](https://cwiki.apache.org/confluence/users/editmyemailsettings.action?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574650208946&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=manage)  
---  
| ![Confluence logo big](cid:footer-desktop-logo)  
---  
This message was sent by Atlassian Confluence 6.15.8  
![](cid:footer-mobile-logo)  
---