Tomcat Connectors

2014-11-19 Thread Balandras, Philippe
Hi,

I'm currently using Tomcat 7.0 with  JDK 1.7 7u17 64bits  on IIS 8.1 in Windows 
server 2012 R2.
On earlier versions of Windows server (2012 standard edition, 2008...) the isap 
redirect dll work perfectly (32 or 64). How ever the isapi_redirect dll jk 
1.2.40 on 64bits version doesn't run on W2012R2.

I launched the dll into the depends software on W2012 R2 and it appears that 
some depends use the following dll in a newer version than on W2012 standard 
edition or earlier into W2008.

W2012 SE or earlier
--
api-ms-win-service-private-l1-1-0.dll
api-ms-win-core-privateprofile-l1-1-0.dll 
API-MS-Win-Core-Kernel32-Private-L1-1-0.dll

W2012R2
-
api-ms-win-service-private-l1-1-1.dll
api-ms-win-core-privateprofile-l1-1-1.dll
API-MS-Win-Core-Kernel32-Private-L1-1-1.dll

The following functions are missing in the last version :
For the api-ms-win-service-private-l1-1-1.dll:
I_ScRegisterPreshutdownRestart
I_ScRpcBindA
I_ScRpcBindW
I_ScSetServiceBitsA
I_ScSetServiceBitsW
WaitServiceState
I_ScRegisterDeviceNotification
I_ScUnregisterDeviceNotification


For the api-ms-win-core-privateprofile-l1-1-0.dll
GetPrivateProfileStringW
GetProfileIntW
WritePrivateProfileStringW

For the API-MS-Win-Core-Kernel32-Private-L1-1-0.dll
RegisterWaitForInputIdle

Do you expect soon to have a new version of the ISAPI dll compiled into a 
version running on W2012R2 ? I guess it is a problem of using the last version 
of Visual Studio or something like that.

Regards

Philippe Balandras | 


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



mod_jk failed to map shared memory with errno=5

2014-11-19 Thread Nan Ge
I'm using Apache-httpd-2.4.10(Win64) and apache-tomcat-8.0.12-windows-x64
with tomcat-connectors-1.2.40-windows-x86_64-httpd-2.4.x (mod_jk) on
windows8.1x64 for load balancing, my configuration about mod_jk in
httpd.conf:

LoadModulejk_module  modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogLevelinfo
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
JkLogFile logs/httpd/mod_jk.log
JkShmFile logs/mod_jk.shm
JkMount  /myapp/* lb
 Location /jkmanager/
JkMount jkstatus
Order deny,allow
Deny from all
Allow from 127.0.0.1
 /Location

and here is my workers.properties:
worker.list= lb,jkstatus
worker.jkstatus.type=status
worker.lb.type=lb
worker.lb.balance_workers=tm1,tm2
worker.tm.type=ajp13
worker.tm.host=127.0.0.1
worker.tm.lbfactor=1
worker.tm1.reference=worker.tm
worker.tm2.reference=worker.tm
worker.tm1.port=8009
worker.tm2.port=8010

After apache was started, I cannot open the /jkmanager page, I checked the
logs/ directory and no mod_jk.shm file was found, and I checked
mod_jk.log with following error :

[Wed Nov 19 15:40:20 2014] [4296:8648] [info] init_jk::mod_jk.c (3383):
mod_jk/1.2.40 initialized
[Wed Nov 19 15:40:20 2014] [4296:8648] [error] jk_shm_open::jk_shm.c (240):
Failed to map shared memory
F:/server/httpd-2.4.10-x64-vc11/Apache24/logs/mod_jk.shm with errno=5
[Wed Nov 19 15:40:20 2014] [4296:8648] [error] init_jk::mod_jk.c (3366):
Initializing shm:(null) errno=5. Load balancing workers will not function
properly.
...

It seems that mod_jk could not create mod_jk.shm file


Re: How to run CGI script using Apache tomcat server?

2014-11-19 Thread Sumankumar Panchal
Hi,

I have resolved the issue.

On Tue, Nov 18, 2014 at 1:21 PM, André Warnier a...@ice-sa.com wrote:

 Sumankumar Panchal wrote:

 Hello All,

 I would like to run CGI script using Apache tomcat server on Linux. I have
 added following lines in apache/conf/web.xml file.and create directory
 cgi inside WEB-INF with all necessary file/dir permission. Still I am
 unable to run CGI script.


 When you say this, what do you mean ? In terms of being a helpful problem
 description, I am unable to run CGI script ranks close to it does not
 work..

 What happens when you try to send a request to Tomcat which should run the
 cgi script ?
 Can you show the URL used ?
 What kind of response do you get in the browser ? Do you you see the
 source code of the cgi script ? do you get some error, and if yes which one
 ?

 Did you look at the Tomcat logfiles to see if there are any interesting
 messages showing why it does not do what you expect ?
 If you do not understand the log messages, copy/paste them here, for
 someone to have a look.

 Since you apparently did not define an executable to run your cgi-bin
 script, Tomcat assumes that it is perl. Is perl installed on your system ?
 Is your cgi-bin script a perl script ?

 Also, by the way, please indicate what version of Tomcat you are running,
 under which JVM version, and on which platform OS (*).
 It all saves time in the end, specially for you : the better the
 information you provide, the sooner you will get a helpful response.

 Note: a bonus point for having copied your configuration below, but you
 did not mention where you got these instructions from, or which web.xml
 file you are talking about.
 (There is a general/default web.xml in (tomcat-dir)/conf, and another one
 under each of your webbapps WEB-INF sub-directory.)


 (*) Ooops, sorry, you did say that.  But if it is Linux, then an
 additional question : did you install Tomcat from the official version on
 the tomcat website, or did you install a pre-packaged version from the
 Linux distribution ?

  can someone suggest me how to configure CGI environment in Apache Tomcat
 Server?

 web.xml
 ---
   servlet
 servlet-namecgi/servlet-name

 servlet-classorg.apache.catalina.servlets.CGIServlet/servlet-class
 init-param
   param-namedebug/param-name
   param-value0/param-value
 /init-param
 init-param
   param-namecgiPathPrefix/param-name
   param-valueWEB-INF/cgi/param-value
 /init-param
  load-on-startup5/load-on-startup
 /servlet

 servlet-mapping
 servlet-namecgi/servlet-name
 url-pattern/cgi-bin/*/url-pattern
 /servlet-mapping

 Regards,
 Suman



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




Re: How to run CGI script using Apache tomcat server?

2014-11-19 Thread Sumankumar Panchal
Hi,

Problem is resolved after replace context to context privileged=true
in apache/conf/context.xml file apart from other changes mentioned in my
earlier mail.

Regards,
Suman



On Tue, Nov 18, 2014 at 1:21 PM, André Warnier a...@ice-sa.com wrote:

 Sumankumar Panchal wrote:

 Hello All,

 I would like to run CGI script using Apache tomcat server on Linux. I have
 added following lines in apache/conf/web.xml file.and create directory
 cgi inside WEB-INF with all necessary file/dir permission. Still I am
 unable to run CGI script.


 When you say this, what do you mean ? In terms of being a helpful problem
 description, I am unable to run CGI script ranks close to it does not
 work..

 What happens when you try to send a request to Tomcat which should run the
 cgi script ?
 Can you show the URL used ?
 What kind of response do you get in the browser ? Do you you see the
 source code of the cgi script ? do you get some error, and if yes which one
 ?

 Did you look at the Tomcat logfiles to see if there are any interesting
 messages showing why it does not do what you expect ?
 If you do not understand the log messages, copy/paste them here, for
 someone to have a look.

 Since you apparently did not define an executable to run your cgi-bin
 script, Tomcat assumes that it is perl. Is perl installed on your system ?
 Is your cgi-bin script a perl script ?

 Also, by the way, please indicate what version of Tomcat you are running,
 under which JVM version, and on which platform OS (*).
 It all saves time in the end, specially for you : the better the
 information you provide, the sooner you will get a helpful response.

 Note: a bonus point for having copied your configuration below, but you
 did not mention where you got these instructions from, or which web.xml
 file you are talking about.
 (There is a general/default web.xml in (tomcat-dir)/conf, and another one
 under each of your webbapps WEB-INF sub-directory.)


 (*) Ooops, sorry, you did say that.  But if it is Linux, then an
 additional question : did you install Tomcat from the official version on
 the tomcat website, or did you install a pre-packaged version from the
 Linux distribution ?

  can someone suggest me how to configure CGI environment in Apache Tomcat
 Server?

 web.xml
 ---
   servlet
 servlet-namecgi/servlet-name

 servlet-classorg.apache.catalina.servlets.CGIServlet/servlet-class
 init-param
   param-namedebug/param-name
   param-value0/param-value
 /init-param
 init-param
   param-namecgiPathPrefix/param-name
   param-valueWEB-INF/cgi/param-value
 /init-param
  load-on-startup5/load-on-startup
 /servlet

 servlet-mapping
 servlet-namecgi/servlet-name
 url-pattern/cgi-bin/*/url-pattern
 /servlet-mapping

 Regards,
 Suman



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




HTTP session change is not been replicated when changing it in event processing

2014-11-19 Thread João Sávio
Hi guys

I have a Tomcat cluster with 4 nodes that is set to replicate HTTP session
across all nodes. Common session operations work fine (e.g., user perform a
request, and something is saved on the session). However, I have a
situation where the session is not replicated.

My application works with ActiveMQ events, and depending on the event,
something should be saved in the HTTP session. In these cases, the session
only changes in that node which receives the event (at the beginning only
one node receives events).

Is there a way to solve this issue without workarounds in my application?

My server.xml if you'd like to see: http://pastebin.com/FNgeemwH

Thanks
João
-- 
http://joaosavio.wordpress.com


un-sexy farm deployment

2014-11-19 Thread Chris Gamache
Here's my problem:

A tomcat server participating in a farm-deploy scheme goes off-line...

For this particular sticky situation we'll say the connection to the rest
of the cluster was interrupted when a network cable was knocked loose.
While the tomcat server is off-line a parallel deployment takes place. The
off-line server doesn't get the new artifact. When the off-line server
comes back on-line the front-end load-balancer (in my case, haproxy)
doesn't know it's running an older webapp and happily begins to pass
traffic to it.

In a farm deployment scenario, the master node will announce to the cluster
a new artifact is available and then the clustered tomcats will retrieve
and deploy the new artifact. The problem is that the tomcat server that
went off-line never heard the announcement.

There doesn't seem to exist a mechanism to re-announce, or announce at
regular intervals. This seems like a real weakness in the scheme. That
makes me think I'm missing something obvious. Apache's docs on the subject
amount to barely a paragraph. The other howtos out there don't address the
problem of when a server goes off-line temporarily.

My question is directed to other tomcat admins out there who are handling
this scenario gracefully. What are you doing to handle this problem?


Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

2014-11-19 Thread Léa Massiot
Hello and thank you for reading my post.

My problem is about debugging a Webapp in Eclipse running Tomcat as a
stand-alone JVM process.

-- In more details --
Below is what I would like to do:
- Start Tomcat:
  - on Windows: via startup.bat in a cmd.exe ;
  - on Unix (Debian Squeeze): via JSVC in a /etc/init.d/tomcat7 script.
- Run Eclipse (Juno):
  as a non-root user (say U).
- Debug a Webapp in Eclipse running Tomcat as a stand-alone JVM process
  (NOT running Tomcat from within the Eclipse JVM).

This article states that it is possible to do this:
http://blogs.mulesoft.org/debugging-your-tomcat-webapp-with-eclipse/
Excerpt:
Once you have Tomcat running successfully as a separate process,
and your webapp happily running on it,
you can begin configuring remote debugging.

A) First of all, I do not manage to: 
have Tomcat run successfully as a separate process,
and your webapp happily running on it
[in Eclipse (personal addition)].
Can you tell me what I have to do?
(I hope it doesn't mean putting a .war file in the Tomcat webapps
directory because I know how to do that already).

B) Second of all.
As for the debugging part, below is what I did so far:
1) In startup.bat, I added the two lines:
   set JPDA_ADDRESS=8000
   set JPDA_TRANSPORT=dt_socket
   I modified the line:
   call %EXECUTABLE% jpda start %CMD_LINE_ARGS%
   Below is the startup.bat that I have presently:

-- 
@echo off
rem
---
rem Start script for the CATALINA Server
rem
---

setlocal

rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
if not %CATALINA_HOME% ==  goto gotHome
set CATALINA_HOME=%CURRENT_DIR%
if exist %CATALINA_HOME%\bin\catalina.bat goto okHome
cd ..
set CATALINA_HOME=%cd%
cd %CURRENT_DIR%
:gotHome
if exist %CATALINA_HOME%\bin\catalina.bat goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome

set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket

set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat

rem Check that target executable exists
if exist %EXECUTABLE% goto okExec
echo Cannot find %EXECUTABLE%
echo This file is needed to run this program
goto end
:okExec

rem Get remaining unshifted command line arguments and save them in the
set CMD_LINE_ARGS=
:setArgs
if %1== goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs
:doneSetArgs

call %EXECUTABLE% jpda start %CMD_LINE_ARGS%

:end

-- 
2) In Eclipse, I went to the menu Run - Debug Configurations... - Remote
Java Application
I entered the following values:

-- 
 Name: ExternalTomcat
 Project: webapp_pjt1
 Connection type: Standard (Socket Attach)
 Host: localhost
 Port: 8000

-- 
I clicked the buttons Apply and then Debug.
3) I set a breakpoint somewhere relevant in the Webapp code.
4) I tried to send an HTTP request to the Tomcat server:
I entered https://localhost/webapp_pjt1/welcome.jsp in a browser (NOT
the Eclipse internal browser).
I got a HTTP 404 error.

Can you see what I'm doing wrong?
Best regards.



--
View this message in context: 
http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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



Re: HTTP session change is not been replicated when changing it in event processing

2014-11-19 Thread João Sávio
I found the solution:

I was updating an attribute in a session object. In that case, I need to
explicitly call session.setAttribute() with the updated object

Thanks


Re: HTTP session change is not been replicated when changing it in event processing

2014-11-19 Thread Mark Thomas
On 19/11/2014 16:32, João Sávio wrote:
 I found the solution:
 
 I was updating an attribute in a session object. In that case, I need to
 explicitly call session.setAttribute() with the updated object

https://issues.apache.org/bugzilla/show_bug.cgi?id=43866

Mark

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



Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

2014-11-19 Thread Mark Thomas
On 19/11/2014 16:23, Léa Massiot wrote:
 Can you see what I'm doing wrong?

http://wiki.apache.org/tomcat/FAQ/Developing#Q1

Mark


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



Re: HTTP session change is not been replicated when changing it in event processing

2014-11-19 Thread João Sávio
Thanks!

2014-11-19 13:48 GMT-02:00 Mark Thomas ma...@apache.org:

 On 19/11/2014 16:32, João Sávio wrote:
  I found the solution:
 
  I was updating an attribute in a session object. In that case, I need to
  explicitly call session.setAttribute() with the updated object

 https://issues.apache.org/bugzilla/show_bug.cgi?id=43866

 Mark

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




-- 
http://joaosavio.wordpress.com


RE: JDBCRealm - Works OK but logs errors

2014-11-19 Thread vince.webb
I ignored the errors logged by JDBCRealm 
and proceeded to create my custom Realm. 
I extended JDBCRealm overriding the authenticate method and 
using inherited JDBCRealm methods for authorization.

This new Realm works OK but JDBCRealm code was logging errors that 
look related to the ones logged by vanilla JDBCRealm.

16-Nov-2014 14:51:34.251 SEVERE [http-nio-8080-exec-15] 
org.apache.catalina.realm.JDBCRealm.getRoles Exception performing authentication
java.sql.SQLException: Closed Statement
at 
oracle.jdbc.driver.OracleClosedStatement.setString(OracleClosedStatement.java:731)
at 
oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(OraclePreparedStatementWrapper.java:289)
at org.apache.catalina.realm.JDBCRealm.roles(JDBCRealm.java:691)
at org.apache.catalina.realm.JDBCRealm.getRoles(JDBCRealm.java:594)
at com.vincewebb.tomcat.realm.SafeRealm.authenticate(SafeRealm.java:141)

The production servers that will eventually run this 
are using Tomcat 7.0.54. With that in mind 
I switched to a different DEV server and 
downgraded it to Tomcat 7.0.54, 
the errors stopped happening.

All these instances are using the same 
Oracle 12.1 JDBC driver (ojdbc7.jar)

They are using different versions of Java, 
this is an additional variable for which I apologise.

The one that runs WITHOUT ERRORS is:

Tomcat 7.0.54
Linux
java version 1.7.0_67
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

The ones that work OK but WITH ERRORS are:

Tomcat 8.0.14
Linux
java version 1.7.0_65
OpenJDK Runtime Environment (rhel-2.5.1.2.0.1.el6_5-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Tomcat 8.0.14
Windows
java version 1.7.0_65
Java(TM) SE Runtime Environment (build 1.7.0_65-b20)
Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode, sharing)

Regards, Vince


 -Original Message-
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Sent: 14 November 2014 02:35
 To: Tomcat Users List
 Subject: Re: JDBCRealm - Works OK but logs errors
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256
 
 Vince,
 
 On 11/10/14 11:02 AM, vince.w...@thomsonreuters.com wrote:
  I have Tomcat 8.0.9 running under NetBeans. An application using
  JDBCRealm is authenticating and authorising users OK but Tomcat is
  logging errors.
 
 I don't believe much has changed in the JDBCRealm area since 8.0.9, but
 could you try with 8.0.15 just to be sure?
 
  Errors get logged on Tomcat startup and another each time a user logs
  in.
 
  Numerous occurrences of this Exception:
 
  10-Nov-2014 15:18:48.108 SEVERE [http-nio-8080-exec-3]
  org.apache.catalina.realm.JDBCRealm.getPassword Exception performing
  authentication java.sql.SQLException: Closed Statement at
  oracle.jdbc.driver.OracleClosedStatement.setString(OracleClosedStatement.java:731)
  at 
  oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(OraclePreparedStatementWrapper.java:289)
  at org.apache.catalina.realm.JDBCRealm.credentials(JDBCRealm.java:484)
  at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:525)
  at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:387)
  at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:334)
  at 
  org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:111)
  at 
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:578)
  at 
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
  at 
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
  at 
  org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
  at 
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
  at 
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526)
  at 
  org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
  at 
  org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655)
  at 
  org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
  at 
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
  at 
  org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
  at 
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at 
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at 
  org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  at java.lang.Thread.run(Thread.java:745)
 
  And just one of this:
 
  10-Nov-2014 15:18:49.249 FINE [http-nio-8080-exec-7]
  org.apache.catalina.util.LifecycleBase.start The start() method was
  called on component
 
 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/di]
  ] after start() had already been 

catalina.properties and system properties

2014-11-19 Thread Igal @ getRailo.org
hi,

I don't have use for scanning the jars for tld files etc., so usually,
in catalina.properties, I skip all jars by setting

tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar

I just noticed that I can set it via a system property, i.e.

-Dtomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar

1) does the system property override catalina.properties?

2) can I use just * instead of *.jar?

3) is it possible to set the common.loader from catalina.properties via
a system property?

thanks,


Igal

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



Tomcat 6.0.43

2014-11-19 Thread Jason Schwanz
Is this going to be an official release linked from the download page? I
found it on the github mirror, but would prefer to work with something from
the official homepage.
-
Jason Schwanz


Re: High thread count load on Tomcat8 when accessing AJP port with no request

2014-11-19 Thread Lisa Woodring
On Tue, Nov 18, 2014 at 2:26 PM, André Warnier a...@ice-sa.com wrote:
 Lisa Woodring wrote:
 ...
 In order to monitor
 the availability of the HTTPS/AJP port (Apache--Tomcat), our
 monitoring software opens a port to verify that this works -- but then
 does not follow that up with an actual request.  This happens every 2
 minutes.
 ...

 This sounds like the perfect recipe for simulating a DOS attack.  Your
 monitoring system is forcing Tomcat to allocate a thread to process the
 request which should subsequently arrive on that connection, yet that
 request never comes; so basically this thread is wasted, until the
 ConnectionTimeout triggers (after 20 seconds, according to your HTTP
 connector settings).

 ...

 The thread count grows over time (goes up to 130-150 threads after 2
 hours).  Setting 'connectionTimeout' (as opposed to the default of
 never timing out) does seems to help some


 Have you tried setting it shorter ? 2 = 2 ms = 20 seconds. That is
 still quite long if you think about a legitimate browser/application making
 a connection, and then sending a request on that connection.  Why would it
 wait so long ? A browser would never do that : it would open a connection to
 the server when it needs to send a request, and then send the request
 immediately, as soon as the connection is established.

 In other words : anything which opens a HTTP connection to your server, and
 then waits more than 1 or 2 seconds before sending a request on that
 connection, is certainly not a browser.
 And it probably is either a program designed to test or attack your server,
 or else a badly-designed monitoring system.. ;-)



The monitoring software is going thru Apache to AJP connector in
Tomcat.  As I described, with the default of no timeout, the # of
threads were much higher.  I currently have the AJP connectionTimeout
set to 3 seconds.




 -- the # of threads isn't

 quite as bad (only 60-80 threads after 2 hours).  However, the CPU
 Idle % is still not good -- was only 10% idle with default tomcat
 settings, is something like 40% idle with current settings.  Also
 tried setting Apache's 'KeepAliveTimeout = 5' (currently set to 15)
 but this did not make any difference.


 Note : this value is in milliseconds. setting it to 5 or 15 is almost
 equivalent to disabling keep-alive altogether. 3000 may be a reasonable
 value.


No, Apache's configuration is in seconds.



 KeepAlive only happens after at least one request has been received and
 processed, waiting for another (possible) request on the same connection.
 If there is never any request sent on that connection, then it would not
 apply here, and only the connectionTimeout would apply.

 Note that my comments above are relative to your HTTP Connector.
 For the AJP Connector, other circumstances apply.

 If you are using AJP, it implies that there is a front-end server, using a
 module such as mod_jk or mod_proxy_ajp to connect to Tomcat's AJP Connector.
 In that case, you should probably leave Tomcat's connectionTimeout to its
 default value, and let the front-end server handle such things as the
 connection timeout and the keep-alive timeout.  The connector module on the
 front-end server will manage these connections to Tomcat, and it may
 pre-allocate some connections, to constitute a pool of available connections
 for when it actually does need to send a request to Tomcat over one such
 connection.  Timing out these connections at the Tomcat level may thus be
 contra-productive, forcing the front-end to re-create them constantly.




Yes, as I stated, Apache is running in front of Tomcat using mod_jk.
My big question is why is this now an issue?  This monitoring software
has been running for years now.  It has only been an issue since we
upgraded to Tomcat 8.

I also forgot to mention that we are using APR.




 Is there some configuration we can set to make Tomcat tolerant of this
 monitoring?  (We have tried setting connectionTimeout 
 keepAliveTimeout on the Connector.  And we have tried putting the
 Connector behind an Executor with maxIdleTime.)
 OR, should we modify our monitoring somehow?  And if so, suggestions?


 I would think so.  Have your monitoring send an actual request to Tomcat
 (and read the response); even a request that results in an error would
 probably be better than no request at all.  But better would be to request
 something real but small, which at the Tomcat level would be efficient to
 respond to (e.g. not a 5 MB image file).
 Create a little webapp which just responds I'm fine (*), and check that
 response in your monitor.  It will tell you not only that Tomcat has opened
 the port, but also that Tomcat webapps are actually working (and how quickly
 it answers).
 And do not try to monitor the AJP port directly. Monitor a request to the
 front-end, which should arrive to Tomcat via the AJP port.  The AJP
 connector module on the front-end will respond with its own error, if it
 cannot talk to Tomcat.

 (*) 

Re: High thread count load on Tomcat8 when accessing AJP port with no request

2014-11-19 Thread Lisa Woodring
On Tue, Nov 18, 2014 at 2:43 PM, Christopher Schultz
ch...@christopherschultz.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Lisa,

 On 11/18/14 11:52 AM, Lisa Woodring wrote:
 We recently upgraded from Tomcat 6.0.29 to Tomcat 8.0.14.
 Everything appears to be working fine, except that Tomcat is
 keeping a high # of threads (in TIMED_WAITING state) -- and the CPU
 has a high load  low idle time.  We are currently running Tomcat8
 on 2 internal test machines, where we also monitor their
 statistics.  In order to monitor the availability of the HTTPS/AJP
 port (Apache--Tomcat), our monitoring software opens a port to
 verify that this works -- but then does not follow that up with an
 actual request.  This happens every 2 minutes.  We have noticed
 that the high thread/load activity on Tomcat coincides with this
 monitoring.  If we disable our monitoring, the issue does not
 happen.  We have enabled/disabled the monitoring on both machines
 over several days (and there is only very minimal, sometimes
 non-existent) internal traffic otherwise) -- in order to verify
 that the monitoring is really the issue.  Once these threads ramp
 up, they stay there or keep increasing.  We had no issues running
 on Tomcat 6 (the thread count stayed low, low load, high idle
 time).

 The thread backtraces for these threads look like this:
 -


 Thread[catalina-exec-24,5,main]
 at sun.misc.Unsafe.park(Native Method) at
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)


 at
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 at
 java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)


 at org.apache.tomcat.util.threads.TaskQueue.poll(TaskQueue.java:85)
 at
 org.apache.tomcat.util.threads.TaskQueue.poll(TaskQueue.java:31) at
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)


 at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)


 at
 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Thread.java:745)
 -


 The thread count grows over time (goes up to 130-150 threads after 2
 hours).  Setting 'connectionTimeout' (as opposed to the default of
 never timing out) does seems to help some -- the # of threads
 isn't quite as bad (only 60-80 threads after 2 hours).  However,
 the CPU Idle % is still not good -- was only 10% idle with default
 tomcat settings, is something like 40% idle with current settings.
 Also tried setting Apache's 'KeepAliveTimeout = 5' (currently set
 to 15) but this did not make any difference.


 Is there some configuration we can set to make Tomcat tolerant of
 this monitoring?  (We have tried setting connectionTimeout 
 keepAliveTimeout on the Connector.  And we have tried putting the
 Connector behind an Executor with maxIdleTime.) OR, should we
 modify our monitoring somehow?  And if so, suggestions?


 * Running on Linux CentOS release 5.9 * running Apache in front of
 Tomcat for authentication, using mod_jk * Tomcat 8.0.14

 relevant sections of tomcat/conf/server.xml:
 


 Executor name=tomcatThreadPool namePrefix=catalina-exec-
 maxThreads=250 minSpareThreads=20 maxIdleTime=6 /

 Connector executor=tomcatThreadPool port=8080
 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8443
 /

 Connector executor=tomcatThreadPool port=8009
 protocol=AJP/1.3 redirectPort=8443 maxThreads=256
 connectionTimeout=3000 keepAliveTimeout=6 /

 Both of these connectors should be NIO connectors, so they should not
 block while waiting for more input. That means that you should not run
 out of threads (which is good), but those connections will sit in the
 poller queue for a long time (20 seconds for HTTP, 3 seconds for AJP)
 and then sit in the acceptor queue for the same amount of time (to
 check for a next keepAlive request). Are you properly shutting-down
 the connection on the client end every 2 minutes?




The monitoring software is trying to test is that the AJP port itself
is actually accepting connections.  With Apache in front in a
production system, it could forward the actual request to one of
several Tomcat boxes -- but we don't know which one from the outside.
The monitoring software is trying to test -- for each Tomcat instance
-- if it is accepting connections.  It used to send an nmap request,
but now sends essentially a tcp ping -- to port 8009, gets a
response  moves on.  So, no, it does not shutdown the connection --
it's pretty simple/dumb.

My main questions are:
1) Why was this ok on Tomcat 6?  but now an issue with Tomcat 8?
2) 

Re: High thread count load on Tomcat8 when accessing AJP port with no request

2014-11-19 Thread Frederik Nosi

Hi Lisa,
On 11/19/2014 07:28 PM, Lisa Woodring wrote:

On Wed, Nov 19, 2014 at 1:20 PM, Lisa Woodring lisa.woodr...@iglass.net wrote:

On Tue, Nov 18, 2014 at 2:26 PM, André Warnier a...@ice-sa.com wrote:

Lisa Woodring wrote:
...

In order to monitor
the availability of the HTTPS/AJP port (Apache--Tomcat), our
monitoring software opens a port to verify that this works -- but then
does not follow that up with an actual request.  This happens every 2
minutes.

...

This sounds like the perfect recipe for simulating a DOS attack.  Your
monitoring system is forcing Tomcat to allocate a thread to process the
request which should subsequently arrive on that connection, yet that
request never comes; so basically this thread is wasted, until the
ConnectionTimeout triggers (after 20 seconds, according to your HTTP
connector settings).

...

The thread count grows over time (goes up to 130-150 threads after 2
hours).  Setting 'connectionTimeout' (as opposed to the default of
never timing out) does seems to help some


Have you tried setting it shorter ? 2 = 2 ms = 20 seconds. That is
still quite long if you think about a legitimate browser/application making
a connection, and then sending a request on that connection.  Why would it
wait so long ? A browser would never do that : it would open a connection to
the server when it needs to send a request, and then send the request
immediately, as soon as the connection is established.

In other words : anything which opens a HTTP connection to your server, and
then waits more than 1 or 2 seconds before sending a request on that
connection, is certainly not a browser.
And it probably is either a program designed to test or attack your server,
or else a badly-designed monitoring system.. ;-)



The monitoring software is going thru Apache to AJP connector in
Tomcat.  As I described, with the default of no timeout, the # of
threads were much higher.  I currently have the AJP connectionTimeout
set to 3 seconds.


Actually, I received a little clarification on the monitoring software
(I didn't write it).  What it's trying to test is that the AJP port
itself is actually accepting connections.  With Apache in front in a
production system, it could forward the actual request to one of
several Tomcat boxes -- but we don't know which one from the outside.
The monitoring software is trying to test -- for each Tomcat instance
-- if it is accepting connections.  It used to send an nmap request,
but now sends essentially a tcp ping -- gets a response  moves on.


In my case (homemade monitoring) i choosed to check mod_jk's log, after 
all mod_jk does indeed check the state of the ajp connector in tomcat.


Hope this helps.
[... ]


Bye,
Frederik

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



Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

2014-11-19 Thread Léa Massiot
Thank you for your answer.
Your link helped.

What was missing from the scenario I described previously was:
exporting the .war of the webapps into the Tomcat webapps directory.

Actually, I was hoping it would be done automatically somehow... :'/
Is there - by any chance - an option somewhere that I have been missing
which would automatically export the webapps .war archives to the Tomcat
webapps directory... at build time for instance?
Hope my question is clear enough.

Best regards.



--
View this message in context: 
http://tomcat.10.x6.nabble.com/Debugging-a-Webapp-in-Eclipse-running-Tomcat-as-a-stand-alone-JVM-process-tp5025598p5025614.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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



strangeness with MemoryUserDatabase

2014-11-19 Thread Robert J. Carr
Yesterday I asked a question about using tomcat authorization with httpd
authentication.  Here's the subject: httpd authentication with tomcat
authorization. I'm still awaiting a response, but I thought I'd come up
with a solution anyway.  I've got something working, but wanted to dig a
bit deeper.  Again, this is in Tomcat 6.0.41.

I overrode the UserDatabaseRealm to take advantage of its creation of the
MemoryUserDatabase and all I needed to do was override the hasRole().  When
asking it to print the database, I get a reasonable result:


MemoryUserDatabase[id=UserDatabase,pathname=conf/tomcat-users.xml,groupCount=0,roleCount=11,userCount=9]

And when asking it to give me users and roles with findUser() and
findRole() it works fine.

However, when I try to iterate over all the users and roles the iterator is
always empty.  This is true for the groups as well.  Looking at the code
from MemoryUserDatabase seems straight forward enough:

public Iterator getUsers() {
synchronized (users) {
return (users.values().iterator());
}
}

But as I said, this iterator is always empty. I'm not sure how this is
possible given the findUser(), that works, is equally simple:

public User findUser(String username) {
synchronized (users) {
return ((User) users.get(username));
}
}

And the iterators seem to be empty either when first loaded from the
UserDatabaseRealm in start() or when in the hasRole().

I'm not reporting a problem of my own, since I'm not using the iterators,
but just wanted to report the strangeness that I'm seeing.


Re: High thread count load on Tomcat8 when accessing AJP port with no request

2014-11-19 Thread Lisa Woodring
 Actually, I received a little clarification on the monitoring software
 (I didn't write it).  What it's trying to test is that the AJP port
 itself is actually accepting connections.  With Apache in front in a
 production system, it could forward the actual request to one of
 several Tomcat boxes -- but we don't know which one from the outside.
 The monitoring software is trying to test -- for each Tomcat instance
 -- if it is accepting connections.  It used to send an nmap request,
 but now sends essentially a tcp ping -- gets a response  moves on.


 In my case (homemade monitoring) i choosed to check mod_jk's log, after all
 mod_jk does indeed check the state of the ajp connector in tomcat.

 Hope this helps.
 [... ]


Thanks for the idea.  Can you tell me what you specifically look for
in the mod_jk_log file?  Do you look for the presence of something?
or the absence of something?
I only see 'negative' events in the logfile.  For example,
all endpoints are disconnected, detected by connect check(1),
cping(0), send(0)
which evidently, is when Tomcat releases a connection on its end.
(I set JkLogLevel = DEBUG, but still don't see any messages that look
like what I would want...)

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



Re: mod_jk failed to map shared memory with errno=5

2014-11-19 Thread Konstantin Kolinko
2014-11-19 12:47 GMT+03:00 Nan Ge genan...@gmail.com:
 I'm using Apache-httpd-2.4.10(Win64) and apache-tomcat-8.0.12-windows-x64
 with tomcat-connectors-1.2.40-windows-x86_64-httpd-2.4.x (mod_jk) on
 windows8.1x64 for load balancing, my configuration about mod_jk in
 httpd.conf:

 LoadModulejk_module  modules/mod_jk.so
 JkWorkersFile conf/workers.properties
 JkLogLevelinfo
 JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
 JkLogFile logs/httpd/mod_jk.log
 JkShmFile logs/mod_jk.shm
 JkMount  /myapp/* lb
  Location /jkmanager/
 JkMount jkstatus
 Order deny,allow
 Deny from all
 Allow from 127.0.0.1
  /Location

 and here is my workers.properties:
 worker.list= lb,jkstatus
 worker.jkstatus.type=status
 worker.lb.type=lb
 worker.lb.balance_workers=tm1,tm2
 worker.tm.type=ajp13
 worker.tm.host=127.0.0.1
 worker.tm.lbfactor=1
 worker.tm1.reference=worker.tm
 worker.tm2.reference=worker.tm
 worker.tm1.port=8009
 worker.tm2.port=8010

 After apache was started, I cannot open the /jkmanager page, I checked the
 logs/ directory and no mod_jk.shm file was found, and I checked
 mod_jk.log with following error :

 [Wed Nov 19 15:40:20 2014] [4296:8648] [info] init_jk::mod_jk.c (3383):
 mod_jk/1.2.40 initialized
 [Wed Nov 19 15:40:20 2014] [4296:8648] [error] jk_shm_open::jk_shm.c (240):
 Failed to map shared memory
 F:/server/httpd-2.4.10-x64-vc11/Apache24/logs/mod_jk.shm with errno=5
 [Wed Nov 19 15:40:20 2014] [4296:8648] [error] init_jk::mod_jk.c (3366):
 Initializing shm:(null) errno=5. Load balancing workers will not function
 properly.
 ...

 It seems that mod_jk could not create mod_jk.shm file

Looking at the source code:

1) The doc [1] say that JkShmFile option is Used only on unix platforms.

The actual code is that
a) On unix platforms it is used always, as documented.

If no JkShmFile is specified then a warning is printed and the default
name logs/jk-runtime-status is used.

b) On Windows this feature can be used.
It is disabled by default and used only if JkShmFile is set explicitly.

Question 1: Do you need JkShmFile at all.

Fixme: If you (or anyone else) succeed in using JkShmFile on Windows
then I think the doc shall be updated to mention the use on Windows.

On Windows:
If JkShmFile is not set then it results in allocating some block of
memory without any special properties.

If JkShmFile is set then it does the work with mapped files
(CreateFileMapping and other Win API methods)


2) The CreateFileMapping method that is used to initialize memory
mapping is called in jk_shm.c as

jk_shm_map = CreateFileMapping(INVALID_HANDLE_VALUE,
   jk_get_sa_with_null_dacl(),
   PAGE_READWRITE,
   0,
   (DWORD)shmsz,
   shname);

See [2] for documentation. Note that
- hFile is INVALID_HANDLE_VALUE
- shname is Global/ + some string created from filename.
- shmsz is the size that you specified in configuration as JkShmSize.
By default it is calculated automatically, it is usually recommended
to allow it to be calculated automatically.

It means that:
a) That value of hFile means that there is no mod_jk.shm file here.
The mapping is allocated from the system page file.

Question 2: Do you have system page file enabled? (I think that some
systems may have it disabled).


It it is not a file, then you can simplify your configuration: Remove
the logs/ prefix from the name.

3) There may also be some Windows-specific issues, like security
restrictions etc. Some are mentioned in [2].

Is jk_get_sa_with_null_dacl() used in CreateFileMapping() call a
correct value?

GetLastError() returning 5 means ERROR_ACCESS_DENIED - from [3].



Fixme: Can the error message be improved? There is no actual file
here, but it mentions a file name. It is a bit misleading (as one
thinks that it tires to access a file), but it is good as it mentions
the value that actually exists in configuration.
It also does not mention how many bytes it tried to allocate.
It can be something like Failed to allocate xxx bytes for shared
memory named yyy.  GetLastError returned zzz.

[1] http://tomcat.apache.org/connectors-doc/reference/apache.html

[2] MSDN - CreateFileMapping function
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366537%28v=vs.85%29.aspx

[3] MSDN - System Error Codes
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381%28v=vs.85%29.aspx


Best regards,
Konstantin Kolinko

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



Re: Debugging a Webapp in Eclipse running Tomcat as a stand-alone JVM process

2014-11-19 Thread Konstantin Kolinko
2014-11-19 22:06 GMT+03:00 Léa Massiot lmhe...@orange.fr:
 Thank you for your answer.
 Your link helped.

 What was missing from the scenario I described previously was:
 exporting the .war of the webapps into the Tomcat webapps directory.

 Actually, I was hoping it would be done automatically somehow... :'/
 Is there - by any chance - an option somewhere that I have been missing
 which would automatically export the webapps .war archives to the Tomcat
 webapps directory... at build time for instance?
 Hope my question is clear enough.


The proper temp is not exporting, but deployment.

Deployment can be done from Ant or from Maven. There exists tools for that.

If you are developing your web application, is there a reason why you
run Tomcat standalone and not from within Eclipse IDE?

https://wiki.apache.org/tomcat/FAQ/Developing#Q6

Best regards,
Konstantin Kolinko

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



Re: Tomcat 8.0.14 - Host appBase not defaulting to webapps in $CATALINA_HOME ???

2014-11-19 Thread Konstantin Kolinko
2014-11-20 3:49 GMT+03:00 Barnes, Mark (CORP) mark.bar...@adp.com:
 Hi, everyone -

 Could someone please help me to get Tomcat 8.0.14 to find my web apps???

 I am trying to upgrade a server from Tomcat 6.x to Tomcat 8.0.14 on Linux.  
 Tomcat does not seem to build the path to the directory containing my web app 
 correctly.

 The server.xml I have been using for Tomcat 6.x is NOT working with Tomcat 
 8.0.14.

As expected.  You must start with Tomcat 8 server.xml and modify
things as necessary.
http://tomcat.apache.org/migration.html


 I believe I am using appBase and docBase correctly, but when I start Tomcat I 
 get a series of exceptions that indicate that the directory cannot be found.  
 (Did things change between Tomcat 6 and Tomcat 8?)

 My $CATALINA_HOME is set to /usr/local/tomcat
 /usr/local/tomcat is a symbolic link to /usr/local/tomcat8
 /user/local/tomcat8 is a symbolic link to /usr/local/apache-tomcat-8.0.14

 In my Host element in my server.xml, I have appBase=

Why do you think that having an empty appBase is valid?  It is a wrong value.

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



Tomcat 8.0.14 - Host appBase not defaulting to webapps in $CATALINA_HOME ???

2014-11-19 Thread Barnes, Mark (CORP)
Hi, everyone -

Could someone please help me to get Tomcat 8.0.14 to find my web apps???

I am trying to upgrade a server from Tomcat 6.x to Tomcat 8.0.14 on Linux.  
Tomcat does not seem to build the path to the directory containing my web app 
correctly.

The server.xml I have been using for Tomcat 6.x is NOT working with Tomcat 
8.0.14.  (Yes, I know that it is not recommended to put Contexts in server.xml, 
but I have no choice about that.)

I believe I am using appBase and docBase correctly, but when I start Tomcat I 
get a series of exceptions that indicate that the directory cannot be found.  
(Did things change between Tomcat 6 and Tomcat 8?)

My $CATALINA_HOME is set to /usr/local/tomcat
/usr/local/tomcat is a symbolic link to /usr/local/tomcat8
/user/local/tomcat8 is a symbolic link to /usr/local/apache-tomcat-8.0.14

In my Host element in my server.xml, I have appBase=

In my Context element in my Host element, I have docBase=ip

My webapps directory is in $CATALINA_HOME: 
/usr/local/apache-tomcat-8.0.14/webapps

The directory ip containing the web app is in $CATALINA_HOME/webapps: 
/usr/local/apache-tomcat-8.0.14/webapps/ip

If appBase= then it's supposed to default to $CATALINA_BASE/webapps, correct? 
 And if CATALINA_BASE is not set, CATALINA_HOME is supposed to be used, no?  (I 
tried setting CATALINA_BASE to the same value but that did not help.)

From the 8.0.14 docs:

appBase
===
The Application Base directory for this virtual host. This is the 
pathname of a directory that may contain
web applications to be deployed on this virtual host. You may specify 
an absolute pathname, or a pathname
that is relative to the $CATALINA_BASE directory. See Automatic 
Application Deployment for more information
on automatic recognition and deployment of web applications. If not 
specified, the default of webapps will
be used.

For a given Context, if the docBase does not begin with /, then the given 
value is supposed to be relative to the appBase of the Host.  Am I right?

From the 8.0.14 docs:

docBase
===
The Document Base (also known as the Context Root) directory for this 
web application, or the pathname to
the web application archive file (if this web application is being 
executed directly from the WAR file).
You may specify an absolute pathname for this directory or WAR file, or 
a pathname that is relative to the
appBase directory of the owning Host.

The value of this field must not be set unless the Context element is 
defined in server.xml or the docBase
is not located under the Host's appBase.

If a symbolic link is used for docBase then changes to the symbolic 
link will only be effective after a
Tomcat restart or by undeploying and redeploying the context. A context 
reload is not sufficient.



Would someone please help me to understand what is going wrong?




Here is the stack trace from catalina.out:
=

(NOTICE that is lists /usr/local/tomcat8/ip as the main resource set!!!  
Why isn't webapps in there???)

Nov 19, 2014 5:31:24 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: 
org.apache.catalina.LifecycleException: Failed to start component 
[StandardEngine[Tomcat-Standalone].StandardHost[localhost].StandardContext[/ip]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at 
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at 
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:868)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component 
[StandardEngine[Tomcat-Standalone].StandardHost[localhost].StandardContext[/ip]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component 
[org.apache.catalina.webresources.StandardRoot@7e40b4e2]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at 
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4900)
at 

Re: mod_jk failed to map shared memory with errno=5

2014-11-19 Thread Nan Ge
On Thu, Nov 20, 2014 at 8:54 AM, Konstantin Kolinko knst.koli...@gmail.com
wrote:

 2014-11-19 12:47 GMT+03:00 Nan Ge genan...@gmail.com:
  I'm using Apache-httpd-2.4.10(Win64) and apache-tomcat-8.0.12-windows-x64
  with tomcat-connectors-1.2.40-windows-x86_64-httpd-2.4.x (mod_jk) on
  windows8.1x64 for load balancing, my configuration about mod_jk in
  httpd.conf:
 
  LoadModulejk_module  modules/mod_jk.so
  JkWorkersFile conf/workers.properties
  JkLogLevelinfo
  JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
  JkLogFile logs/httpd/mod_jk.log
  JkShmFile logs/mod_jk.shm
  JkMount  /myapp/* lb
   Location /jkmanager/
  JkMount jkstatus
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
   /Location
 
  and here is my workers.properties:
  worker.list= lb,jkstatus
  worker.jkstatus.type=status
  worker.lb.type=lb
  worker.lb.balance_workers=tm1,tm2
  worker.tm.type=ajp13
  worker.tm.host=127.0.0.1
  worker.tm.lbfactor=1
  worker.tm1.reference=worker.tm
  worker.tm2.reference=worker.tm
  worker.tm1.port=8009
  worker.tm2.port=8010
 
  After apache was started, I cannot open the /jkmanager page, I checked
 the
  logs/ directory and no mod_jk.shm file was found, and I checked
  mod_jk.log with following error :
 
  [Wed Nov 19 15:40:20 2014] [4296:8648] [info] init_jk::mod_jk.c (3383):
  mod_jk/1.2.40 initialized
  [Wed Nov 19 15:40:20 2014] [4296:8648] [error] jk_shm_open::jk_shm.c
 (240):
  Failed to map shared memory
  F:/server/httpd-2.4.10-x64-vc11/Apache24/logs/mod_jk.shm with errno=5
  [Wed Nov 19 15:40:20 2014] [4296:8648] [error] init_jk::mod_jk.c (3366):
  Initializing shm:(null) errno=5. Load balancing workers will not function
  properly.
  ...
 
  It seems that mod_jk could not create mod_jk.shm file

 Looking at the source code:

 1) The doc [1] say that JkShmFile option is Used only on unix platforms.

 The actual code is that
 a) On unix platforms it is used always, as documented.

 If no JkShmFile is specified then a warning is printed and the default
 name logs/jk-runtime-status is used.

 b) On Windows this feature can be used.
 It is disabled by default and used only if JkShmFile is set explicitly.

 Question 1: Do you need JkShmFile at all.

 Fixme: If you (or anyone else) succeed in using JkShmFile on Windows
 then I think the doc shall be updated to mention the use on Windows.

 On Windows:
 If JkShmFile is not set then it results in allocating some block of
 memory without any special properties.

 If JkShmFile is set then it does the work with mapped files
 (CreateFileMapping and other Win API methods)


 2) The CreateFileMapping method that is used to initialize memory
 mapping is called in jk_shm.c as

 jk_shm_map = CreateFileMapping(INVALID_HANDLE_VALUE,
jk_get_sa_with_null_dacl(),
PAGE_READWRITE,
0,
(DWORD)shmsz,
shname);

 See [2] for documentation. Note that
 - hFile is INVALID_HANDLE_VALUE
 - shname is Global/ + some string created from filename.
 - shmsz is the size that you specified in configuration as JkShmSize.
 By default it is calculated automatically, it is usually recommended
 to allow it to be calculated automatically.

 It means that:
 a) That value of hFile means that there is no mod_jk.shm file here.
 The mapping is allocated from the system page file.

 Question 2: Do you have system page file enabled? (I think that some
 systems may have it disabled).


 It it is not a file, then you can simplify your configuration: Remove
 the logs/ prefix from the name.

 3) There may also be some Windows-specific issues, like security
 restrictions etc. Some are mentioned in [2].

 Is jk_get_sa_with_null_dacl() used in CreateFileMapping() call a
 correct value?

 GetLastError() returning 5 means ERROR_ACCESS_DENIED - from [3].



 Fixme: Can the error message be improved? There is no actual file
 here, but it mentions a file name. It is a bit misleading (as one
 thinks that it tires to access a file), but it is good as it mentions
 the value that actually exists in configuration.
 It also does not mention how many bytes it tried to allocate.
 It can be something like Failed to allocate xxx bytes for shared
 memory named yyy.  GetLastError returned zzz.

 [1] http://tomcat.apache.org/connectors-doc/reference/apache.html

 [2] MSDN - CreateFileMapping function

 http://msdn.microsoft.com/en-us/library/windows/desktop/aa366537%28v=vs.85%29.aspx

 [3] MSDN - System Error Codes

 http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381%28v=vs.85%29.aspx


 Best regards,
 Konstantin Kolinko

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


Thanks Kolinko!

It has been 

Re: java.protocol.handler.pkgs does not work with Tomcat 7

2014-11-19 Thread Mark Thomas
On 18/11/2014 20:35, Konstantin Kolinko wrote:
 2014-11-18 11:29 GMT+03:00 Mark Thomas ma...@apache.org:

snip/

 Yes, this is a problem that isn't addressed in Tomcat 7.

 It is addressed in Tomcat 8 (and 9) where we add a Tomcat specific
 factory. This factory avoids the problem of only being able to call
 setURLStreamHandlerFactory() once by adding the Tomcat specific factory
 which allows additional handler factories to be added.
 
 
 1. It is possible to inject user's URL factories into
 DirContextURLStreamHandlerFactory of Tomcat 7. See static method added
 in
 http://svn.apache.org/r1078601
 https://issues.apache.org/bugzilla/show_bug.cgi?id=26701

Thanks for the correction. I thought it was in Tomcat 7 but couldn't
find it when I went looking for it.

Mark

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



Re: Tomcat 6.0.43

2014-11-19 Thread Mark Thomas
On 19/11/2014 19:01, Jason Schwanz wrote:
 Is this going to be an official release linked from the download page?

That depends on whether the release vote that is currently in progress
passes (it looks like it will). You can follow that vote on the dev list.

 I found it on the github mirror, but would prefer to work with something from
 the official homepage.

You shouldn't find anything more than a tag on github. Please let us
know if that is not the case.

Mark

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