Re: Tomcat 8 - session replication DeltaManager not working

2015-02-06 Thread Konstantin Kolinko
2015-02-06 19:09 GMT+03:00 Junek Leoš :
> Hello to all,
>
> Would anyone know why session replication does not work for me? Load balancer 
> with session afinity works great, but after reconfiguration settings to 
> session replication my sessions are not persisted. I am running Oracle Linux 
> 6.5 (almost same as RHEL 6.5) with Tomcat 8.0.18, Java 1.7.0_55. There are 
> three instances of Tomcat. All relevant config is listed below.
>
> [...]


> I am following video guide of Rama Krishnnan: 
> https://www.youtube.com/watch?v=cYBdaeNeXbY
>
> What could be source or symptom of problems?
>
>
> 1) In catalina.out I could not see messages
> INFO: Register manager /examples to cluster element Engine with name 
> 
>
>
> org.apache.catalina.ha.session.DeltaManager start
>
> INFO: Starting clustering manager at /examples
>
> as blog post 
> http://blogs.agilefaqs.com/2009/11/09/setting-up-tomcat-cluster-for-session-replication/
>  mentions
>
> Does it mean DeltaManager was not properly loaded?
>
>
> 2) Tomcat docs says "All your session attributes must implement 
> java.io.Serializable" and I am not sure about it. Below my index.jsp is 
> listed.


It an attribute is not a Serializable, it cannot be transmitted over the wire.

For starters, see javadoc of java.io.Serializable. There are also
tutorials and good books elsewhere.

> All files
> $CATALINA1_HOME/conf/web.xml
> $CATALINA2_HOME/conf/web.xml
> $CATALINA3_HOME/conf/web.xml
> ends with
>
>   
> 

Your own application application in its WEB-INF/web.xml must be marked
as distributable.

I doubt that changing the above server-wide defaults helps you.

> $CATALINA1_HOME/logs/catalina.out - startup
> 06-Feb-2015 16:49:43.449 WARNING [main] 
> org.apache.tomcat.util.digester.SetPropertiesRule.begin 
> [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 
> 'docbase' to '' did not find a matching property.

Do not put  elements into server.xml. That is a really bad practice.
See Context element in Configuration Reference Guide,
webapps/docs/config/context.html

Be careful with typos.  XML files are case-sensitive. There is no such
attribute as "docbase".

Best regards,
Konstantin Kolinko

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



Re: TomcatSasJAASRealm issue while Tomcat6 to Tomcat7 migration

2015-02-06 Thread Konstantin Kolinko
2015-02-06 20:05 GMT+03:00 Mahato, Jitendra N.
:
> Hi All,
>
> I am facing issue while migrating my application from Tomcat 6 to Tomcat 7.
> Current Version:- Tomcat 6.0.18, Java 1.6.0.30
> Upgrade Version:- Tomcat 7.0.50, Java 1.7.0.51
>
> Please help me to resolve the below issue.
>
> Issue after migration:- Not able to login into the application.
>
> Stage log errors:-
>
> Jan 16, 2015 9:10:39 AM org.apache.catalina.startup.SetAllPropertiesRule begin
> WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 
> 'maxSpareThreads' to '64' did not find a matching property.

Broken configuration. There is no such attribute on .

> Jan 16, 2015 9:10:39 AM org.apache.tomcat.util.digester.Digester endElement
> WARNING:   No rules found matching 'Server/Service/Engine/Loader'.

Broken configuration. There is no support for a  element in an .

> Jan 16, 2015 9:10:39 AM org.apache.tomcat.util.digester.Digester startElement
> SEVERE: Begin event threw error
> java.lang.NoClassDefFoundError: org/apache/catalina/util/StringManager
> at 
> com.shaws.framework.security.realm.TomcatSasJAASRealm.(TomcatSasJAASRealm.java:212)

The someone's TomcatSasJAASRealm is not designed for Tomcat 7. It
depends on an internal API that was changed / moved.

As Mark mentioned,  the Migration guide is a must-read.


Best regards,
Konstantin Kolinko

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



Re: IIS 6.0 isapi_redirect 1.2.40 Tomcat 7.0 403 Forbidden

2015-02-06 Thread Konstantin Kolinko
2015-02-06 23:30 GMT+03:00 RICHARD DOUST :
> Hi,
>
> I've got an application that ran well with Tomcat 6.0, but is causing me 
> problems on Tomcat 7.0. The front end is IIS (listening on port 80, passing 
> requests to the isapi_redirect (1.2.40) filter which is configured to send 
> some urls on to ajp13, then to port 8009 were Tomcat is listening), all 
> running on Windows Server 2003.
>
> I know the isapi filter is working because I've configured mappings to the 
> Tomcat docs and manager web apps and can get to them without any problems 
> (via IIS).
>
> I have a servlet deployed to Tomcat that I'm POSTing to via an XMLHttpRequest 
> in a browser. For the life of me, I cannot get it to respond to me with 
> anything but a 403 and I can't figure out why. It is not a cross-domain 
> request, so a CORS Filter (which is installed in support of a rewrite of the 
> application which is underway) can't be having any effect. I have added an 
> init-param to the servlet definition in the web.xml to make sure that it's 
> not an issue having to do with the fact that it's a POST:
>
> 
> ,
> .
> .
> 
> readonly
> false
> 
> 
>
>
> In the isapi_redirect.log I can see that the request is being passed to the 
> ajp13 connector. The request is well formed. Everything is as it should be. 
> The war file is configured as it was configured with Tomcat 6.0, in terms of 
> its deployment descriptor with the above minor difference. Here is an excerpt 
> from the isapi_redirect log with the request itself preceding what's shown 
> here:
>
> 00 00 00  - ManagerRqst>  (Tail end of request XML)
> [Fri Feb 06 14:08:35.328 2015] [1128:4744] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1403): received from ajp13 
> pos=0 len=38 max=8192
> [Fri Feb 06 14:08:35.343 2015] [1128:4744] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 04 01 93 00 
> 09 46 6F 72 62 69 64 64 65 6E 00 00  - .Forbidden..
> [Fri Feb 06 14:08:35.359 2015] [1128:4744] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 001002 A0 01 00 
> 0A 74 65 78 74 2F 70 6C 61 69 6E 00  - .text/plain.
> [Fri Feb 06 14:08:35.359 2015] [1128:4744] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 0020A0 03 00 01 
> 30 00 00 00 00 00 00 00 00 00 00 00  - 0...
> [Fri Feb 06 14:08:35.359 2015] [1128:4744] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (705): status = 403
> [Fri Feb 06 14:08:35.375 2015] [1128:4744] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (712): Number of headers is = 2
> [Fri Feb 06 14:08:35.375 2015] [1128:4744] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (768): Header[0] [Content-Type] = 
> [text/plain]
> [Fri Feb 06 14:08:35.390 2015] [1128:4744] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (768): Header[1] [Content-Length] = 
> [0]
> [Fri Feb 06 14:08:35.406 2015] [1128:4744] [debug] 
> start_response::jk_isapi_plugin.c (1025): Starting response for URI 
> '/bbmwebapi_set15ul/api/xml' (protocol HTTP/1.1)
> [Fri Feb 06 14:08:35.406 2015] [1128:4744] [debug] 
> start_response::jk_isapi_plugin.c (1134): Not using Keep-Alive
> [Fri Feb 06 14:08:35.421 2015] [1128:4744] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1403): received from ajp13 
> pos=0 len=2 max=8192
> [Fri Feb 06 14:08:35.437 2015] [1128:4744] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 05 01 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00  - 
> [Fri Feb 06 14:08:35.437 2015] [1128:4744] [debug] 
> ajp_process_callback::jk_ajp_common.c (2054): AJP13 protocol: Reuse is OK
> [Fri Feb 06 14:08:35.453 2015] [1128:4744] [debug] 
> HttpExtensionProc::jk_isapi_plugin.c (2317): service() returned OK
> [Fri Feb 06 14:08:35.468 2015] [1128:4744] [debug] 
> ajp_reset_endpoint::jk_ajp_common.c (810): (ajp13) resetting endpoint with 
> socket 2300
> [Fri Feb 06 14:08:35.468 2015] [1128:4744] [debug] ajp_done::jk_ajp_common.c 
> (3144): recycling connection pool for worker ajp13 and socket 2300
>
> I have a breakpoint set in the servlet's doPost method. It gets hit if I use 
> the rewrite which bypasses IIS and goes direct to port 8080 to hit Tomcat 
> directly. It does not get hit when the request is sent via IIS. I have no 
> insight into what or where the problem might be. Somewhere between ajp13 and 
> Tomcat.
>
> The application works without a problem if I hit it from a browser running on 
> the same computer as is running IIS and Tomcat. It doesn't work if I hit it 
> from a client from outside.
>
> I've been banging my head against this for 2 days. Any help would be 
> appreciated.

1. You are not saying what exact version of Tomcat 7.0.x you are using.

2. If you are debugging it, put a breakpoint on
org.apache.catalina.connector.Response.sendError() and look what calls
the sendError() method.

As a reminder (maybe you already know that),
http://wiki.apache.org/tom

IIS 6.0 isapi_redirect 1.2.40 Tomcat 7.0 403 Forbidden

2015-02-06 Thread RICHARD DOUST
Hi,

I've got an application that ran well with Tomcat 6.0, but is causing me 
problems on Tomcat 7.0. The front end is IIS (listening on port 80, passing 
requests to the isapi_redirect (1.2.40) filter which is configured to send some 
urls on to ajp13, then to port 8009 were Tomcat is listening), all running on 
Windows Server 2003.

I know the isapi filter is working because I've configured mappings to the 
Tomcat docs and manager web apps and can get to them without any problems (via 
IIS). 

I have a servlet deployed to Tomcat that I'm POSTing to via an XMLHttpRequest 
in a browser. For the life of me, I cannot get it to respond to me with 
anything but a 403 and I can't figure out why. It is not a cross-domain 
request, so a CORS Filter (which is installed in support of a rewrite of the 
application which is underway) can't be having any effect. I have added an 
init-param to the servlet definition in the web.xml to make sure that it's not 
an issue having to do with the fact that it's a POST:


,
.
.

readonly
false




In the isapi_redirect.log I can see that the request is being passed to the 
ajp13 connector. The request is well formed. Everything is as it should be. The 
war file is configured as it was configured with Tomcat 6.0, in terms of its 
deployment descriptor with the above minor difference. Here is an excerpt from 
the isapi_redirect log with the request itself preceding what's shown here:

00 00 00  - ManagerRqst>  (Tail end of request XML)
[Fri Feb 06 14:08:35.328 2015] [1128:4744] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1403): received from ajp13 
pos=0 len=38 max=8192
[Fri Feb 06 14:08:35.343 2015] [1128:4744] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 04 01 93 00 09 
46 6F 72 62 69 64 64 65 6E 00 00  - .Forbidden..
[Fri Feb 06 14:08:35.359 2015] [1128:4744] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 001002 A0 01 00 0A 
74 65 78 74 2F 70 6C 61 69 6E 00  - .text/plain.
[Fri Feb 06 14:08:35.359 2015] [1128:4744] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 0020A0 03 00 01 30 
00 00 00 00 00 00 00 00 00 00 00  - 0...
[Fri Feb 06 14:08:35.359 2015] [1128:4744] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (705): status = 403
[Fri Feb 06 14:08:35.375 2015] [1128:4744] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (712): Number of headers is = 2
[Fri Feb 06 14:08:35.375 2015] [1128:4744] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (768): Header[0] [Content-Type] = 
[text/plain]
[Fri Feb 06 14:08:35.390 2015] [1128:4744] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (768): Header[1] [Content-Length] = [0]
[Fri Feb 06 14:08:35.406 2015] [1128:4744] [debug] 
start_response::jk_isapi_plugin.c (1025): Starting response for URI 
'/bbmwebapi_set15ul/api/xml' (protocol HTTP/1.1)
[Fri Feb 06 14:08:35.406 2015] [1128:4744] [debug] 
start_response::jk_isapi_plugin.c (1134): Not using Keep-Alive
[Fri Feb 06 14:08:35.421 2015] [1128:4744] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1403): received from ajp13 
pos=0 len=2 max=8192
[Fri Feb 06 14:08:35.437 2015] [1128:4744] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1403): 05 01 00 00 00 
00 00 00 00 00 00 00 00 00 00 00  - 
[Fri Feb 06 14:08:35.437 2015] [1128:4744] [debug] 
ajp_process_callback::jk_ajp_common.c (2054): AJP13 protocol: Reuse is OK
[Fri Feb 06 14:08:35.453 2015] [1128:4744] [debug] 
HttpExtensionProc::jk_isapi_plugin.c (2317): service() returned OK
[Fri Feb 06 14:08:35.468 2015] [1128:4744] [debug] 
ajp_reset_endpoint::jk_ajp_common.c (810): (ajp13) resetting endpoint with 
socket 2300
[Fri Feb 06 14:08:35.468 2015] [1128:4744] [debug] ajp_done::jk_ajp_common.c 
(3144): recycling connection pool for worker ajp13 and socket 2300

I have a breakpoint set in the servlet's doPost method. It gets hit if I use 
the rewrite which bypasses IIS and goes direct to port 8080 to hit Tomcat 
directly. It does not get hit when the request is sent via IIS. I have no 
insight into what or where the problem might be. Somewhere between ajp13 and 
Tomcat.

The application works without a problem if I hit it from a browser running on 
the same computer as is running IIS and Tomcat. It doesn't work if I hit it 
from a client from outside.

I've been banging my head against this for 2 days. Any help would be 
appreciated.

Thanks.




Problems with enabling SSL with GoDaddy cert with Tomcat 7.0.57

2015-02-06 Thread nicksemai...@juno.com
Good afternoon,​I have a SHA2 certificate for a RHEL 6 server using 
tomcat 7.0.57.Port 8443 is listening, selinux is disabled, and have tried it 
with 8443 enabled in firewall and with firewall off. After receiving the .crt 
file from GoDaddy: ran the 4 keytool -import commands: For the alias=root, 
I used gdroot-g2.crt(from repository) For the alias=intermed, I used 
gd_ig2.crt(from GoDaddy) For the alias=cross, I used 
gdroot-g2_cross.crt(from repository) For the alias= tomcat, I used the .crt(from GoDaddy)I see all the entries when I did the keytool 
-list I made this change in server.xml: I thenshutdown tomcatstartup tomcat 
When I go to the URL in the browser with the port 8443, I get this:Firefox:
 Cannot communicate securely with peer: no common encryption algorithm(s). 
(Error code: ssl_error_no_cypher_overlap) ​

Chrome:
A secure connection cannot be established because this site uses an unsupported 
protocol.Error code: ERR_SSL_VERSION_OR_CIPHER_MISMATCH
Thank you


NetZero now offers 4G mobile broadband. Sign up now.
http://www.netzero.net/?refcd=NZINTISP0512T4GOUT1


Re: tomcat-jdbc PoolCleaner deadlock

2015-02-06 Thread Filip Hanik
thank you Robert!

On Fri, Feb 6, 2015 at 11:14 AM, Robert Anderson  wrote:

> Hi,
>
> After a full week of normal usage, no deadlocks were found.
>
>
> Thank you very much.
>
> Robert
>
>
>
> 2015-01-30 16:38 GMT-03:00 Robert Anderson :
>
> > Ok, Filip!
> >
> > Thanks,
> >
> > Robert
> >
> > 2015-01-30 16:31 GMT-03:00 Filip Hanik :
> >
> > Robert, kindly let us know if disabling the pool cleaner does resolve
> your
> >> dead lock
> >>
> >> Filip
> >>
> >>
> >> On Fri, Jan 30, 2015 at 12:25 PM, Robert Anderson 
> >> wrote:
> >>
> >> > Great, Filip!
> >> >
> >> > "Returns true if the pool sweeper is enabled for the connection pool.
> >> The
> >> > pool sweeper is enabled if any settings that require async
> intervention
> >> in
> >> > the pool are turned on boolean result =
> >> > getTimeBetweenEvictionRunsMillis()>0; result = result &&
> >> > (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); result =
> result
> >> ||
> >> > (isTestWhileIdle() && getValidationQuery()!=null); return result;" [1]
> >> >
> >> > Best regards.
> >> >
> >> >
> >> > [1]
> >> >
> >> >
> >>
> https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/PoolConfiguration.html#isPoolSweeperEnabled()
> >> >
> >> > 2015-01-30 16:13 GMT-03:00 Filip Hanik :
> >> >
> >> > > Are you seeing that message, cause it seems to be a defensive check,
> >> but
> >> > > wouldn't happen due to
> >> > >
> >> > > 509 public void initializePoolCleaner(PoolConfiguration properties)
> {
> >> 510
> >> > > //if
> >> > > the evictor thread is supposed to run, start it now 511 if
> >> (properties.
> >> > > isPoolSweeperEnabled()) { 512 poolCleaner = new PoolCleaner(this,
> >> > > properties
> >> > > .getTimeBetweenEvictionRunsMillis()); 513 poolCleaner.start(); 514 }
> >> > //end
> >> > > if 515 }
> >> > >
> >> > > On Fri, Jan 30, 2015 at 12:05 PM, Robert Anderson <
> ranom...@gmail.com
> >> >
> >> > > wrote:
> >> > >
> >> > > > Filip,
> >> > > >
> >> > > > timeBetweenEvictionRunsMillis=0 does not disable PoolCleaner [1].
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > > >
> >> > > > if (sleepTime <= 0) {
> >> > > > log.warn("Database connection pool evicter thread
> >> > > > interval is set to 0, defaulting to 30 seconds");
> >> > > > this.sleepTime = 1000 * 30;
> >> > > > } else if (sleepTime < 1000) {
> >> > > > log.warn("Database connection pool evicter thread
> >> > > > interval is set to lower than 1 second.");
> >> > > > }
> >> > > >
> >> > >
> >> > >
> >> > >
> >> > > >
> >> > > >
> >> > > > [1]
> >> > > >
> >> > >
> >> >
> >>
> http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
> >> > > >
> >> > > >
> >> > > > 2015-01-30 15:17 GMT-03:00 Robert Anderson :
> >> > > >
> >> > > > > Sorry,
> >> > > > >
> >> > > > > [1] https://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html
> >> > > > >
> >> > > > > 2015-01-30 15:15 GMT-03:00 Robert Anderson  >:
> >> > > > >
> >> > > > > Filip,
> >> > > > >>
> >> > > > >> however, disabling the pool cleaner it should yield better
> >> results.
> >> > > > >>
> >> > > > >> The documention[1] says:
> >> > > > >>
> >> > > > >> "This value should not be set under 1 second"
> >> > > > >>
> >> > > > >> Isn't true?
> >> > > > >>
> >> > > > >>
> >> > > > >>
> >> > > > >> 2015-01-30 15:07 GMT-03:00 Filip Hanik :
> >> > > > >>
> >> > > > >> Looking at the locks that are involved in the dead lock, it's
> >> all in
> >> > > the
> >> > > > >>> intersys traces. Furthermore, it seems as intersys may already
> >> be
> >> > > doing
> >> > > > >>> pooling inside the driver. If that is the case, you have two
> >> > options
> >> > > > >>>
> >> > > > >>> 1. disable pooling in intersys OR
> >> > > > >>> 2. don't use tomcat's jdbc pool since intersys already does
> >> pooling
> >> > > > >>>
> >> > > > >>> however, disabling the pool cleaner it should yield better
> >> results.
> >> > > > >>>
> >> > > > >>> On Fri, Jan 30, 2015 at 11:02 AM, Filip Hanik <
> fi...@hanik.com>
> >> > > wrote:
> >> > > > >>>
> >> > > > >>> > Disable the pool cleaner
> >> > > > >>> >
> >> > > > >>> > timeBetweenEvictionRunsMillis=0
> >> > > > >>> >
> >> > > > >>> >
> >> > > > >>> >
> >> > > > >>>
> >> > > > >>
> >> > > > >>
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>


Re: tomcat-jdbc PoolCleaner deadlock

2015-02-06 Thread Robert Anderson
Hi,

After a full week of normal usage, no deadlocks were found.


Thank you very much.

Robert



2015-01-30 16:38 GMT-03:00 Robert Anderson :

> Ok, Filip!
>
> Thanks,
>
> Robert
>
> 2015-01-30 16:31 GMT-03:00 Filip Hanik :
>
> Robert, kindly let us know if disabling the pool cleaner does resolve your
>> dead lock
>>
>> Filip
>>
>>
>> On Fri, Jan 30, 2015 at 12:25 PM, Robert Anderson 
>> wrote:
>>
>> > Great, Filip!
>> >
>> > "Returns true if the pool sweeper is enabled for the connection pool.
>> The
>> > pool sweeper is enabled if any settings that require async intervention
>> in
>> > the pool are turned on boolean result =
>> > getTimeBetweenEvictionRunsMillis()>0; result = result &&
>> > (isRemoveAbandoned() && getRemoveAbandonedTimeout()>0); result = result
>> ||
>> > (isTestWhileIdle() && getValidationQuery()!=null); return result;" [1]
>> >
>> > Best regards.
>> >
>> >
>> > [1]
>> >
>> >
>> https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/tomcat/jdbc/pool/PoolConfiguration.html#isPoolSweeperEnabled()
>> >
>> > 2015-01-30 16:13 GMT-03:00 Filip Hanik :
>> >
>> > > Are you seeing that message, cause it seems to be a defensive check,
>> but
>> > > wouldn't happen due to
>> > >
>> > > 509 public void initializePoolCleaner(PoolConfiguration properties) {
>> 510
>> > > //if
>> > > the evictor thread is supposed to run, start it now 511 if
>> (properties.
>> > > isPoolSweeperEnabled()) { 512 poolCleaner = new PoolCleaner(this,
>> > > properties
>> > > .getTimeBetweenEvictionRunsMillis()); 513 poolCleaner.start(); 514 }
>> > //end
>> > > if 515 }
>> > >
>> > > On Fri, Jan 30, 2015 at 12:05 PM, Robert Anderson > >
>> > > wrote:
>> > >
>> > > > Filip,
>> > > >
>> > > > timeBetweenEvictionRunsMillis=0 does not disable PoolCleaner [1].
>> > > >
>> > >
>> > >
>> > >
>> > > >
>> > > > if (sleepTime <= 0) {
>> > > > log.warn("Database connection pool evicter thread
>> > > > interval is set to 0, defaulting to 30 seconds");
>> > > > this.sleepTime = 1000 * 30;
>> > > > } else if (sleepTime < 1000) {
>> > > > log.warn("Database connection pool evicter thread
>> > > > interval is set to lower than 1 second.");
>> > > > }
>> > > >
>> > >
>> > >
>> > >
>> > > >
>> > > >
>> > > > [1]
>> > > >
>> > >
>> >
>> http://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
>> > > >
>> > > >
>> > > > 2015-01-30 15:17 GMT-03:00 Robert Anderson :
>> > > >
>> > > > > Sorry,
>> > > > >
>> > > > > [1] https://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html
>> > > > >
>> > > > > 2015-01-30 15:15 GMT-03:00 Robert Anderson :
>> > > > >
>> > > > > Filip,
>> > > > >>
>> > > > >> however, disabling the pool cleaner it should yield better
>> results.
>> > > > >>
>> > > > >> The documention[1] says:
>> > > > >>
>> > > > >> "This value should not be set under 1 second"
>> > > > >>
>> > > > >> Isn't true?
>> > > > >>
>> > > > >>
>> > > > >>
>> > > > >> 2015-01-30 15:07 GMT-03:00 Filip Hanik :
>> > > > >>
>> > > > >> Looking at the locks that are involved in the dead lock, it's
>> all in
>> > > the
>> > > > >>> intersys traces. Furthermore, it seems as intersys may already
>> be
>> > > doing
>> > > > >>> pooling inside the driver. If that is the case, you have two
>> > options
>> > > > >>>
>> > > > >>> 1. disable pooling in intersys OR
>> > > > >>> 2. don't use tomcat's jdbc pool since intersys already does
>> pooling
>> > > > >>>
>> > > > >>> however, disabling the pool cleaner it should yield better
>> results.
>> > > > >>>
>> > > > >>> On Fri, Jan 30, 2015 at 11:02 AM, Filip Hanik 
>> > > wrote:
>> > > > >>>
>> > > > >>> > Disable the pool cleaner
>> > > > >>> >
>> > > > >>> > timeBetweenEvictionRunsMillis=0
>> > > > >>> >
>> > > > >>> >
>> > > > >>> >
>> > > > >>>
>> > > > >>
>> > > > >>
>> > > > >
>> > > >
>> > >
>> >
>>
>
>


Re: TomcatSasJAASRealm issue while Tomcat6 to Tomcat7 migration

2015-02-06 Thread Mark Eggers
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2/6/2015 9:05 AM, Mahato, Jitendra N. wrote:
> Hi All,
> 
> I am facing issue while migrating my application from Tomcat 6 to
> Tomcat 7. Current Version:- Tomcat 6.0.18, Java 1.6.0.30 Upgrade
> Version:- Tomcat 7.0.50, Java 1.7.0.51
> 
> Please help me to resolve the below issue.
> 
> Issue after migration:- Not able to login into the application.
> 
> Stage log errors:-
> 
> Jan 16, 2015 9:10:39 AM
> org.apache.catalina.startup.SetAllPropertiesRule begin WARNING:
> [SetAllPropertiesRule]{Server/Service/Connector} Setting property
> 'maxSpareThreads' to '64' did not find a matching property. Jan 16,
> 2015 9:10:39 AM org.apache.tomcat.util.digester.Digester
> endElement WARNING:   No rules found matching
> 'Server/Service/Engine/Loader'. Jan 16, 2015 9:10:39 AM
> org.apache.tomcat.util.digester.Digester startElement SEVERE: Begin
> event threw error java.lang.NoClassDefFoundError:
> org/apache/catalina/util/StringManager at
> com.shaws.framework.security.realm.TomcatSasJAASRealm.(TomcatSasJAASRealm.java:212)
>
> 
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>
> 
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:526) 
> at java.lang.Class.newInstance(Class.java:374) at
> org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
>
> 
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1288)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
>
> 
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1342)
>
> 
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
>
> 
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
>
> 
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
>
> 
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
> at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
>
> 
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
> at org.apache.catalina.startup.Catalina.load(Catalina.java:616) at
> org.apache.catalina.startup.Catalina.load(Catalina.java:664) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>
> 
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606) at
> org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281) at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455) 
> Caused by: java.lang.ClassNotFoundException:
> org.apache.catalina.util.StringManager at
> java.net.URLClassLoader$1.run(URLClassLoader.java:366) at
> java.net.URLClassLoader$1.run(URLClassLoader.java:355) at
> java.security.AccessController.doPrivileged(Native Method) at
> java.net.URLClassLoader.findClass(URLClassLoader.java:354) at
> java.lang.ClassLoader.loadClass(ClassLoader.java:425) at
> java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> 
> 
> I configured in my dev environment and getting the below error. Log
> errors in dev.
> 
> Feb 6, 2015 8:21:51 PM
> org.apache.catalina.startup.SetAllPropertiesRule begin WARNING:
> [SetAllPropertiesRule]{Server/Service/Connector} Setting property
> 'maxSpareThreads' to '64' did not find a matching property. Feb 6,
> 2015 8:21:51 PM org.apache.tomcat.util.digester.Digester
> endElement WARNING:   No rules found matching
> 'Server/Service/Engine/Loader'. Feb 6, 2015 8:21:51 PM
> org.apache.tomcat.util.digester.Digester startElement SEVERE: Begin
> event threw error java.lang.VerifyError: class
> com.shaws.framework.security.realm.TomcatSasJAASRealm overrides
> final method start.()V at java.lang.ClassLoader.defineClass1(Native
> Method) at java.lang.ClassLoader.defineClass(Unknown Source) at
> java.security.SecureClassLoader.defineClass(Unknown Source) at
> java.net.URLClassLoader.defineClass(Unknown Source) at
> java.net.URLClassLoader.access$000(Unknown Source) at
> j

TomcatSasJAASRealm issue while Tomcat6 to Tomcat7 migration

2015-02-06 Thread Mahato, Jitendra N.
Hi All,

I am facing issue while migrating my application from Tomcat 6 to Tomcat 7.
Current Version:- Tomcat 6.0.18, Java 1.6.0.30
Upgrade Version:- Tomcat 7.0.50, Java 1.7.0.51

Please help me to resolve the below issue.

Issue after migration:- Not able to login into the application.

Stage log errors:-

Jan 16, 2015 9:10:39 AM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 
'maxSpareThreads' to '64' did not find a matching property.
Jan 16, 2015 9:10:39 AM org.apache.tomcat.util.digester.Digester endElement
WARNING:   No rules found matching 'Server/Service/Engine/Loader'.
Jan 16, 2015 9:10:39 AM org.apache.tomcat.util.digester.Digester startElement
SEVERE: Begin event threw error
java.lang.NoClassDefFoundError: org/apache/catalina/util/StringManager
at 
com.shaws.framework.security.realm.TomcatSasJAASRealm.(TomcatSasJAASRealm.java:212)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at 
org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
at 
org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1288)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1342)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at 
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.Catalina.load(Catalina.java:616)
at org.apache.catalina.startup.Catalina.load(Catalina.java:664)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: java.lang.ClassNotFoundException: 
org.apache.catalina.util.StringManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)


I configured in my dev environment and getting the below error.
Log errors in dev.

Feb 6, 2015 8:21:51 PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 
'maxSpareThreads' to '64' did not find a matching property.
Feb 6, 2015 8:21:51 PM org.apache.tomcat.util.digester.Digester endElement
WARNING:   No rules found matching 'Server/Service/Engine/Loader'.
Feb 6, 2015 8:21:51 PM org.apache.tomcat.util.digester.Digester startElement
SEVERE: Begin event threw error
java.lang.VerifyError: class 
com.shaws.framework.security.realm.TomcatSasJAASRealm overrides final method 
start.()V
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLo

Re: Sporadic HTTP 403 returned by Tomcat when this should not happen ever. How to find out why this happens?

2015-02-06 Thread Mark Eggers
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2/6/2015 2:21 AM, Brian wrote:
> Hello Mark,
> 
> 1- No authentication at all, since the user authenticates sending a
> parameter in the query string.
> 
> 2- I have two filters:
> "org.tuckey.web.filters.urlrewrite.UrlRewriteFilter" (which has
> been working fine for years now) and CORS, yes!!! Actually, the
> CORS filter (org.apache.catalina.filters.CorsFilter) is the first
> filter in my web.xml file, so it is the first to run. This is the
> way I have configured it:
> 
>  CorsFilter 
> org.apache.catalina.filters.CorsFilter
>
> 

> cors.allowed.origins 
> *   
> cors.support.credentials 
> false   
>  CorsFilter 
> /* 
> 
> I added the CORS filter probably two months ago, and probably I
> have started seen the 403 errors since then, yes! And now that I
> think about it, probably it is the CORS filter the reason of the
> 403 indeed, since my API is being called not only from servers but
> also from Javascript running in all kind of browsers and maybe some
> of them don't deal with CORS properly. That would explain why the
> 403s happens ocasionally. In fact, I see this 403 ocurring in most
> of the cases by one specific user (authenticated by a parameter in
> the query string) that calls my API from javacript!
> 
> In what conditions does this filter return a 403 error? What are
> the Headers involved when that happens? How can I avoid this
> problem? Where (on the internet) can I learn more about this
> specific problem?

CORS basically doesn't with Internet Explorer < 10.

IE < 8, and CORS does not work at all.
IE 8 - Microsoft has a 'special mechanism' for CORS
IE 9 - Microsoft breaks the 'special mechanism'
IE 10 - Microsoft tells people to use CORS

http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx

. . . been there, fought that
/mde/

> 
> Thanks Mark!
> 
> 
> 
>> -Original Message- From: Mark Thomas
>> [mailto:ma...@apache.org] Sent: viernes, 06 de febrero de 2015
>> 04:47 a.m. To: Tomcat Users List Subject: Re: Sporadic HTTP 403
>> returned by Tomcat when this should not happen ever. How to find
>> out why this happens?
>> 
>> On 05/02/2015 23:14, Brian wrote:
>>> Hello David,
>>> 
>>> Not, it is not the case. No exceptions whatsoever. And about
>>> 1/100 (or less) of
>> the requests return a 403 to the users, and all those requests
>> are doing the same thing.
>>> Thanks a lot for your help!
>> 
>> Is any authentication configured for this web application?
>> 
>> What filters are configured (the CORS filter might return a 403
>> for example)?
>> 
>> Mark

-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBAgAGBQJU1PLOAAoJEEFGbsYNeTwtg18H/j1yQF3474DOj7aqlV6coukt
IHzxkKPADyxEZ/CeAlJrV/E/dGkhk4CI4hYsnYogzRZi0RNyf6ibiwCIS+nClYqD
XqsuLrgVfULgqoo2C2rqRhVXgE6PruVv3C+Sw6PfqXLzVziNZANKaUEKUyzHdbfB
CFc8pbPKdZ/cCUYB46FNfw0xH//3v05xs9lxB88GDzmpa1ByDKggyG8t8KDO8BN3
skyr/36yaE/Xecr6bpTserOQQu+2IWH+H386ucZr0WMWGxL4rYCZLOyQK57RzJFk
regMSEgHZmKxluiEwf09VrgZD+crjN1MRI+eiYigQ5VxgQNliFIhluR58I8euxc=
=c7fL
-END PGP SIGNATURE-

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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



Tomcat 8 - session replication DeltaManager not working

2015-02-06 Thread Junek Leoš
Hello to all,

Would anyone know why session replication does not work for me? Load balancer 
with session afinity works great, but after reconfiguration settings to session 
replication my sessions are not persisted. I am running Oracle Linux 6.5 
(almost same as RHEL 6.5) with Tomcat 8.0.18, Java 1.7.0_55. There are three 
instances of Tomcat. All relevant config is listed below.

I am following video guide of Rama Krishnnan: 
https://www.youtube.com/watch?v=cYBdaeNeXbY

What could be source or symptom of problems?


1) In catalina.out I could not see messages
INFO: Register manager /examples to cluster element Engine with name 



org.apache.catalina.ha.session.DeltaManager start

INFO: Starting clustering manager at /examples

as blog post 
http://blogs.agilefaqs.com/2009/11/09/setting-up-tomcat-cluster-for-session-replication/
 mentions

Does it mean DeltaManager was not properly loaded?


2) Tomcat docs says "All your session attributes must implement 
java.io.Serializable" and I am not sure about it. Below my index.jsp is listed.


Thanks in advance for your help

Leoš



Here are relevant parts of settings:
/etc/httpd/conf/httpd.conf 
LoadModulejk_module  modules/mod_jk.so
JkWorkersFile conf/workers.properties

JkLogFile logs/mod_jk.log
JkLogLevelemerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

JkMount /status stat
JkMount /* balancer

#JkMount /instance1* instance1
#JkMount /instance2* instance2
#JkMount /instance3* instance3

Cluster conf copied from 
http://tomcat.apache.org/tomcat-8.0-doc/cluster-howto.html , Deployer config 
was dropped.

$CATALINA1_HOME/conf/server.xml --




  

  




  



  

  
  

  


  

  

  

   
  

=== /opt/tom1/conf/server.xml END ==

$CATALINA2_HOME/conf/server.xml --


--- (as above) ---


--- (as above) ---



My application $CATALINA_HOME/webapps/ROOT/index.jsp is

<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
Instance 1 


Session Id : <%=request.getSession().getId()%> 
Is it New Session : <%=request.getSession().isNew()%>
Session Creation Date : <%=new 
Date(request.getSession().getCreationTime())%>
Session Access Date : <%=new 
Date(request.getSession().getLastAccessedTime())%>


Cart List 


<%
 String bookName = request.getParameter("bookName");
 List listOfBooks = (List) 
request.getSession().getAttribute("Books");

if (listOfBooks != null) {
  listOfBooks.add(bookName);

  for (String book : listOfBooks) {
out.println(""+book+"");
  }
}
if (listOfBooks == null) {
  listOfBooks = new ArrayList();
  request.getSession().setAttribute("Books",listOfBooks);
}
%>


  
Book Name 

  



$CATALINA1_HOME/logs/catalina.out - startup
06-Feb-2015 16:49:43.449 WARNING [main] 
org.apache.tomcat.util.digester.SetPropertiesRule.begin 
[SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 
'docbase' to '' did not find a matching property.
06-Feb-2015 16:49:43.470 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Server version:
Apache Tomcat/8.0.18
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Server built:  
Jan 23 2015 11:56:07 UTC
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Server number: 
8.0.18.0
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log OS Name:   
Linux
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log OS Version:
3.8.13-16.2.1.el6uek.x86_64
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Architecture:  
amd64
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log Java Home: 
/opt/programs/jdk1.7.0_55/jre
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log JVM Version:   
1.7.0_55-b13
06-Feb-2015 16:49:43.471 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:
Oracle Corporation
06-Feb-2015 16:49:43.472 INFO [main] 
org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: 
/opt/programs/1tom
06-Feb-2015 16:49:43.472 INFO [main] 
org.apache.catalina

Re: Sporadic HTTP 403 returned by Tomcat when this should not happen ever. How to find out why this happens?

2015-02-06 Thread Sean Dawson
http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter

"The filter works by adding required Access-Control-* headers to
HttpServletResponse object. The filter also protects against HTTP response
splitting. If request is invalid, or is not permitted, then request is
rejected with HTTP status code 403 (Forbidden)"


On Fri, Feb 6, 2015 at 5:45 AM, Mark Thomas  wrote:

> On 06/02/2015 10:21, Brian wrote:
> > Hello Mark,
> >
> > 1- No authentication at all, since the user authenticates sending a
> parameter in the query string.
> >
> > 2- I have two filters:
> "org.tuckey.web.filters.urlrewrite.UrlRewriteFilter" (which has been
> working fine for years now) and CORS, yes!!!
> > Actually, the CORS filter (org.apache.catalina.filters.CorsFilter) is
> the first filter in my web.xml file, so it is the first to run.
> > This is the way I have configured it:
> >
> >   
> > CorsFilter
> > org.apache.catalina.filters.CorsFilter
> > 
> >   cors.allowed.origins
> >   *
> > 
> > 
> >   cors.support.credentials
> >   false
> > 
> >   
> >   
> > CorsFilter
> > /*
> >   
> >
> > I added the CORS filter probably two months ago, and probably I have
> started seen the 403 errors since then, yes!
> > And now that I think about it, probably it is the CORS filter the reason
> of the 403 indeed, since my API is being called not only from servers but
> also from Javascript running in all kind of browsers and maybe some of them
> don't deal with CORS properly. That would explain why the 403s happens
> ocasionally. In fact, I see this 403 ocurring in most of the cases by one
> specific user (authenticated by a parameter in the query string) that calls
> my API from javacript!
> >
> > In what conditions does this filter return a 403 error? What are the
> Headers involved when that happens? How can I avoid this problem? Where (on
> the internet) can I learn more about this specific problem?
> >
> > Thanks Mark!
>
> There have been some changes to the best bet is to look at the source
> code for version you are using:
>
>
> http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_50/java/org/apache/catalina/filters/CorsFilter.java?view=annotate
>
> If I recall, clients that send a null origin will be rejected when * is
> used. That got fixed recently.
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Issue when using tomcat JDBC Connection Pool with a shared resource

2015-02-06 Thread Daniel Mikusa
On Fri, Feb 6, 2015 at 9:57 AM, Jean-Louis Mateo 
wrote:

> Hi Dan,
>
> Thank you for having replied to this issue.
> First of all, now it works fine but I would like to answer your
> questions...
>
> > Not sure about this "global" attribute.  I don't believe it's an
> attribute of the pool.  Why did you add it?
> That's what I've read here
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Definitions


The "global" attribute is on the ResourceLink tag, not the Resource tag.


>
>
> > 2.) It has no url or driver set.
> Thanks. The issue was here and  I should have read it more closely
> about the "name" property (at the same above url):
> "name: The name of the resource link to be created,
> relative to the java:comp/env context."
> So...
> Before, in my context file
>  R  this jndi name doesn't exist
> global="sharedDataSource"
> type="javax.sql.DataSource"/>
>
> After, in my context file
>  name
> global="sharedDataSource"
> type="javax.sql.DataSource"/>
>
> Now it works fine
>
> Note: In a way, you were right "global" property is no need in
>  (server.xml)
> Only "global" (from context.xml, ResourceLink) and "name"
> (from server.xml, ) are needed and have to
> match
>

Awesome!  Glad you caught that and were able to get it working.

Dan



>
> > You have initialSize set to 2.  This should attempt to make connections
> when you start Tomcat.  Do you see any errors at that time?
> There were no errors. At launching time, the pool is well created
> with 2 connexions in LISTENING state (netstat -an)
>
> > This is unrelated, but don't set "path" here.  The path attribute is
> ignore here.  The path is determined by the name of the xml file, which
> just happens to be "test-app" as well.
> OK. "path" is no longer set.
>
> > Do you have anything set in "conf/context.xml" or in your web.xml?
> See the attached file
>
>
> Best Regards
>
> Jean-Louis Matéo
>
>
> -Message d'origine-
> De : Daniel Mikusa [mailto:dmik...@pivotal.io]
> Envoyé : vendredi 6 février 2015 14:06
> À : Tomcat Users List
> Objet : Re: Issue when using tomcat JDBC Connection Pool with a shared
> resource
>
> On Fri, Feb 6, 2015 at 6:27 AM, Jean-Louis Mateo <
> jean-louis.ma...@bull.net>
> wrote:
>
> >  Hi,
> >
> >
> >
> > I would like to use the Tomcat JDBC Connection Pool with a shared
> > resource so I’ve read :
> >
> >  http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Standalone and
> > http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_L
> > inks
> >
> >
> >
> > …. and tried to do the same but when I try to access to my servlet I
> > get the following message:
> >
> >
> >
> > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
> > driver of class '' for connect URL 'null'
> >
>
> A couple odd things here...
>
> 1.) It's trying to use DBCP, not the jdbc connection pool.
> 2.) It has no url or driver set.
>
>
> >  at
> > org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(Ba
> > sicDataSource.java:1452)
> >
> > at
> > org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicData
> > Source.java:1371)
> >
> > at
> > org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSou
> > rce.java:1044)
> >
> > at testPackage.DBTest.doGet(DBTest.java:62)
> >
> > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
> >
> > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:303)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:208)
> >
> > at
> > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:241)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:208)
> >
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
> > lve.java:220)
> >
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
> > lve.java:122)
> >
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat
> > orBase.java:612)
> >
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
> > va:170)
> >
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
> > va:103)
> >
> >  

RE: Issue when using tomcat JDBC Connection Pool with a shared resource

2015-02-06 Thread MWick


> -Original Message-
> From: Daniel Mikusa [mailto:dmik...@pivotal.io]
> Sent: Friday, February 06, 2015 8:06 AM
> To: Tomcat Users List
> Subject: Re: Issue when using tomcat JDBC Connection Pool with a shared
> resource
> 
> On Fri, Feb 6, 2015 at 6:27 AM, Jean-Louis Mateo  louis.ma...@bull.net>
> wrote:
> 
> >  Hi,
> >
> >
> >
> > I would like to use the Tomcat JDBC Connection Pool with a shared
> > resource so I’ve read :
> >
> >  http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Standalone and
> > http://tomcat.apache.org/tomcat-7.0-
> doc/config/context.html#Resource_L
> > inks
> >
> >
> >
> > …. and tried to do the same but when I try to access to my servlet I
> > get the following message:
> >
> >
> >
> > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
> > driver of class '' for connect URL 'null'
> >
> 
> A couple odd things here...
> 
> 1.) It's trying to use DBCP, not the jdbc connection pool.
> 2.) It has no url or driver set.
> 
> 
> >  at
> >
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(Ba
> > sicDataSource.java:1452)
> >
> > at
> >
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicData
> > Source.java:1371)
> >
> > at
> >
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSou
> > rce.java:1044)
> >
> > at testPackage.DBTest.doGet(DBTest.java:62)
> >
> > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
> >
> > at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:303)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:208)
> >
> > at
> > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appli
> > cationFilterChain.java:241)
> >
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
> > lterChain.java:208)
> >
> > at
> >
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> a
> > lve.java:220)
> >
> > at
> >
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
> > lve.java:122)
> >
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticat
> > orBase.java:612)
> >
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
> > va:170)
> >
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
> > va:103)
> >
> > at
> > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:9
> > 50)
> >
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
> > e.java:116)
> >
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> > :421)
> >
> > at
> > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp1
> > 1Processor.java:1070)
> >
> > at
> >
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(A
> > bstractProtocol.java:611)
> >
> > at
> > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint
> > .java:316)
> >
> > at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j
> > ava:1145)
> >
> > at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
> > java:615)
> >
> > at
> >
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThr
> > ead.java:61)
> >
> > at java.lang.Thread.run(Thread.java:745)
> >
> > Caused by: java.lang.NullPointerException
> >
> > at
> > sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524)
> >
> > at
> > sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493)
> >
> > at
> > sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
> >
> > at
> > java.sql.DriverManager.getDriver(DriverManager.java:262)
> >
> > at
> >
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(Ba
> > sicDataSource.java:1437)
> >
> > ... 25 more
> >
> > 
> >
> >
> >
> > Environment :
> >
> > Win 7
> >
> > Java - jdk 1.7.0.65
> >
> > Tomcat - 7.0.57
> >
> > MySQL - 5.1.18
> >
> >
> >
> > 
> >
> >
> >
> > Tomcat service properties:
> >
> > -Dcatalina.home=Y:\Programs\Tomcat\Tomcat7
> >
> > -Dcatalina.base=Y:\00-Prod\data\catalina
> >
> > -Djava.endorsed.dirs=Y:\Programs\Tomcat\Tomcat7\endorsed
> >
> > -Djava.io.tmpdir=Y:\Pro

Re: Issue when using tomcat JDBC Connection Pool with a shared resource

2015-02-06 Thread Daniel Mikusa
On Fri, Feb 6, 2015 at 6:27 AM, Jean-Louis Mateo 
wrote:

>  Hi,
>
>
>
> I would like to use the Tomcat JDBC Connection Pool with a shared resource
> so I’ve read :
>
>  http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Standalone and
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Links
>
>
>
> …. and tried to do the same but when I try to access to my servlet I get
> the following message:
>
>
>
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver
> of class '' for connect URL 'null'
>

A couple odd things here...

1.) It's trying to use DBCP, not the jdbc connection pool.
2.) It has no url or driver set.


>  at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
>
> at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
>
> at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
>
> at testPackage.DBTest.doGet(DBTest.java:62)
>
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
>
> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>
> at
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
>
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:612)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
>
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
>
> at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
>
> at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
>
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
>
> 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)
>
> Caused by: java.lang.NullPointerException
>
> at
> sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524)
>
> at
> sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493)
>
> at
> sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
>
> at java.sql.DriverManager.getDriver(DriverManager.java:262)
>
> at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
>
> ... 25 more
>
> 
>
>
>
> Environment :
>
> Win 7
>
> Java - jdk 1.7.0.65
>
> Tomcat - 7.0.57
>
> MySQL - 5.1.18
>
>
>
> 
>
>
>
> Tomcat service properties:
>
> -Dcatalina.home=Y:\Programs\Tomcat\Tomcat7
>
> -Dcatalina.base=Y:\00-Prod\data\catalina
>
> -Djava.endorsed.dirs=Y:\Programs\Tomcat\Tomcat7\endorsed
>
> -Djava.io.tmpdir=Y:\Programs\Tomcat\Tomcat7\temp
>
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>
>
> -Djava.util.logging.config.file=Y:\Programs\Tomcat\Tomcat7\conf\logging.properties
>
> -Dcom.sun.management.jmxremote
>
> -Dcom.sun.management.jmxremote.port=8099
>
> -Dcom.sun.management.jmxremote.ssl=false
>
> -Dcom.sun.management.jmxremote.authenticate=false
>
> -XX:MaxPermSize=512m
>
>
>
> 
>
>
>
> CATALINA_HOME/lib contents
>
> …
>
> tomcat-dbcp.jar
>
> tomcat-jdbc.jar
>
> …
>
>
>
> 
>
>
>
> CATALINA_BASE/lib contents:
>
> mysql-connector-java-5.1.18-bin.jar
>
> 
>
>
>
> CATALINA_BASE/conf/server.xml
>
> ...
>
> …
>
>   
>
>   

Issue when using tomcat JDBC Connection Pool with a shared resource

2015-02-06 Thread Jean-Louis Mateo
Hi,

I would like to use the Tomcat JDBC Connection Pool with a shared resource so 
I've read :
 http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Standalone and 
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Links

 and tried to do the same but when I try to access to my servlet I get the 
following message:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of 
class '' for connect URL 'null'
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1452)
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at testPackage.DBTest.doGet(DBTest.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:612)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
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)
Caused by: java.lang.NullPointerException
at 
sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524)
at 
sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493)
at 
sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
at java.sql.DriverManager.getDriver(DriverManager.java:262)
at 
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437)
... 25 more


Environment :
Win 7
Java - jdk 1.7.0.65
Tomcat - 7.0.57
MySQL - 5.1.18



Tomcat service properties:
-Dcatalina.home=Y:\Programs\Tomcat\Tomcat7
-Dcatalina.base=Y:\00-Prod\data\catalina
-Djava.endorsed.dirs=Y:\Programs\Tomcat\Tomcat7\endorsed
-Djava.io.tmpdir=Y:\Programs\Tomcat\Tomcat7\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=Y:\Programs\Tomcat\Tomcat7\conf\logging.properties
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-XX:MaxPermSize=512m



CATALINA_HOME/lib contents
...
tomcat-dbcp.jar
tomcat-jdbc.jar
...



CATALINA_BASE/lib contents:
mysql-connector-java-5.1.18-bin.jar


CATALINA_BASE/conf/server.xml
...
...
  
   ...
-->


  

...
...


CATALINA_BASE/conf/Catalina/localhost/test-app.xml




...
...



...
...



DBTest.java excerpt :

package testPackage;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.Data

Re: Sporadic HTTP 403 returned by Tomcat when this should not happen ever. How to find out why this happens?

2015-02-06 Thread Mark Thomas
On 06/02/2015 10:21, Brian wrote:
> Hello Mark,
> 
> 1- No authentication at all, since the user authenticates sending a parameter 
> in the query string.
> 
> 2- I have two filters: "org.tuckey.web.filters.urlrewrite.UrlRewriteFilter" 
> (which has been working fine for years now) and CORS, yes!!!
> Actually, the CORS filter (org.apache.catalina.filters.CorsFilter) is the 
> first filter in my web.xml file, so it is the first to run.
> This is the way I have configured it:
> 
>   
> CorsFilter
> org.apache.catalina.filters.CorsFilter
> 
>   cors.allowed.origins
>   *
> 
> 
>   cors.support.credentials
>   false
> 
>   
>   
> CorsFilter
> /*
>   
> 
> I added the CORS filter probably two months ago, and probably I have started 
> seen the 403 errors since then, yes!
> And now that I think about it, probably it is the CORS filter the reason of 
> the 403 indeed, since my API is being called not only from servers but also 
> from Javascript running in all kind of browsers and maybe some of them don't 
> deal with CORS properly. That would explain why the 403s happens ocasionally. 
> In fact, I see this 403 ocurring in most of the cases by one specific user 
> (authenticated by a parameter in the query string) that calls my API from 
> javacript!
> 
> In what conditions does this filter return a 403 error? What are the Headers 
> involved when that happens? How can I avoid this problem? Where (on the 
> internet) can I learn more about this specific problem?
> 
> Thanks Mark!

There have been some changes to the best bet is to look at the source
code for version you are using:

http://svn.apache.org/viewvc/tomcat/tc7.0.x/tags/TOMCAT_7_0_50/java/org/apache/catalina/filters/CorsFilter.java?view=annotate

If I recall, clients that send a null origin will be rejected when * is
used. That got fixed recently.

Mark

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



RE: Sporadic HTTP 403 returned by Tomcat when this should not happen ever. How to find out why this happens?

2015-02-06 Thread Brian
Hello Mark,

1- No authentication at all, since the user authenticates sending a parameter 
in the query string.

2- I have two filters: "org.tuckey.web.filters.urlrewrite.UrlRewriteFilter" 
(which has been working fine for years now) and CORS, yes!!!
Actually, the CORS filter (org.apache.catalina.filters.CorsFilter) is the first 
filter in my web.xml file, so it is the first to run.
This is the way I have configured it:

  
CorsFilter
org.apache.catalina.filters.CorsFilter

  cors.allowed.origins
  *


  cors.support.credentials
  false

  
  
CorsFilter
/*
  

I added the CORS filter probably two months ago, and probably I have started 
seen the 403 errors since then, yes!
And now that I think about it, probably it is the CORS filter the reason of the 
403 indeed, since my API is being called not only from servers but also from 
Javascript running in all kind of browsers and maybe some of them don't deal 
with CORS properly. That would explain why the 403s happens ocasionally. In 
fact, I see this 403 ocurring in most of the cases by one specific user 
(authenticated by a parameter in the query string) that calls my API from 
javacript!

In what conditions does this filter return a 403 error? What are the Headers 
involved when that happens? How can I avoid this problem? Where (on the 
internet) can I learn more about this specific problem?

Thanks Mark!



> -Original Message-
> From: Mark Thomas [mailto:ma...@apache.org]
> Sent: viernes, 06 de febrero de 2015 04:47 a.m.
> To: Tomcat Users List
> Subject: Re: Sporadic HTTP 403 returned by Tomcat when this should not
> happen ever. How to find out why this happens?
> 
> On 05/02/2015 23:14, Brian wrote:
> > Hello David,
> >
> > Not, it is not the case. No exceptions whatsoever. And about 1/100 (or 
> > less) of
> the requests return a 403 to the users, and all those requests are doing the 
> same
> thing.
> > Thanks a lot for your help!
> 
> Is any authentication configured for this web application?
> 
> What filters are configured (the CORS filter might return a 403 for
> example)?
> 
> Mark
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org


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



Re: Sporadic HTTP 403 returned by Tomcat when this should not happen ever. How to find out why this happens?

2015-02-06 Thread Mark Thomas
On 05/02/2015 23:14, Brian wrote:
> Hello David,
> 
> Not, it is not the case. No exceptions whatsoever. And about 1/100 (or less) 
> of the requests return a 403 to the users, and all those requests are doing 
> the same thing.
> Thanks a lot for your help!

Is any authentication configured for this web application?

What filters are configured (the CORS filter might return a 403 for
example)?

Mark


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



Re: FileNotFoundException for existing JAR files

2015-02-06 Thread Mark Thomas
On 06/02/2015 08:16, Alexander Johnson wrote:
> I'd like to know what could cause Tomcat or the native Java ZipFile.open
> method to claim that a file does not exist when it actually does?\\

Usually file permissions on the file or one of the directories it is in.

Other possibilities include using symlinks without explicitly enabling
Tomcat to follow them.


> This
> has been a blocking issue for some of my work for the past month.  It's
> happening when attempting to run the tomcat7-maven-plugin.

Never used it so I don't have any other suggestions I am afraid.

Mark

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



Re: tomcat7-maven-plugin using standardjarscanner instead of webappclassloader

2015-02-06 Thread Alexander Johnson
It turns out I was mis-understanding the problem here by just looking at
the logging output.  The StandardJarScanner is always run before the
WebAppClassLoader, but only logs if it detects errors.  I've just
rephrased the question to make it clearer what my problem is and sent out
a separate e-mail about it.

On 2/4/15, 8:13 PM, "Alexander Johnson"  wrote:

>Original question here:
>http://stackoverflow.com/questions/28181602/whats-the-difference-between-w
>ebappclassloader-and-standardjarscanner
>
>I'm able to run my team's webapp on my local machine using the
>tomcat7-maven-plugin.  Unfortunately when I attempt to do the same on the
>build server it breaks.  This is a blocking issue for our team, but none
>of us are able to figure it out.  Nobody on Stack Overflow has been able
>to help either.
>
>Here is the tomcat7-maven-plugin configuration in our project:
>
>
>   
>   
>  start-tomcat-for-integration-tests
>  
> 
>!${skipTomcat}
> 
>  
>  
> 
>
>
>   org.apache.tomcat.maven
>   tomcat7-maven-plugin
>   2.2
>   
>  8009
>  2
>
>  
>org.apache.catalina.loader.WebappClassLoaderrClass>
>
>  
>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProj
>ect/ui/automation/tomcat7
>  
>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/u
>i/automation/tomcat7/conf/context.xml
>  false
>  false
>  localhost
>  8443
>  false
>  true
>
>  
>true
>
>  /contentmain
>  8080
>  
>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/ui/
>automation/tomcat7/conf/server.xml
>
>  
>  ${skipTomcat}
>  
>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/u
>i/automation/tomcat7/conf/tomcat-users.xml
>  
>${basedir}/src/test/resources/com/MyCompany/MyOrg/MyProject/
>ui/automation/tomcat7/conf/web.xml
>  true
>  true
>  true
>  
>${original.build.directory}/${original.build.finalName}Directory>
>   
>   
>  
> org.apache.tomcat.embed
> tomcat-embed-core
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-util
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-coyote
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-api
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-jdbc
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-dbcp
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-servlet-api
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-jsp-api
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-jasper
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-jasper-el
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-el-api
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-catalina
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-tribes
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-catalina-ha
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-annotations-api
> ${tomcat.version}
>  
>  
> org.apache.tomcat
> tomcat-juli
> ${tomcat.version}
>  
>  
> org.apache.tomcat.embed
> tomcat-embed-logging-juli
>  

FileNotFoundException for existing JAR files

2015-02-06 Thread Alexander Johnson
I'd like to know what could cause Tomcat or the native Java ZipFile.open
method to claim that a file does not exist when it actually does?  This
has been a blocking issue for some of my work for the past month.  It's
happening when attempting to run the tomcat7-maven-plugin.  It works fine
on most machines, including mine (OSX), but fails on our build server
(LINUX) and one of my co-workers' boxes (OSX, same model laptop as mine).
Here's the error as seen in a Maven build:

[INFO] --- tomcat7-maven-plugin:2.2:run (start-tomcat) @ PROJECT ---
[INFO] Running war on http://localhost:8080/contentmain
[INFO] Using existing Tomcat server configuration at
/WORKSPACE/PROJECT/tomcat7
Feb 05, 2015 11:17:53 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path: 
/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Feb 05, 2015 11:17:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Feb 05, 2015 11:17:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Feb 05, 2015 11:17:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Feb 05, 2015 11:17:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 651 ms
Feb 05, 2015 11:17:54 PM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Catalina
Feb 05, 2015 11:17:54 PM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.53
Feb 05, 2015 11:17:54 PM org.apache.tomcat.util.scan.StandardJarScanner
scan
WARNING: Failed to scan JAR
[file:/WORKSPACE/tomcat7/webapps/../../target/PROJECT/WEB-INF/lib/openws-1.
5.1.jar] from WEB-INF/lib
java.io.FileNotFoundException:
/WORKSPACE/PROJECT/tomcat7/webapps/../../target/PROJECT/WEB-INF/lib/openws-
1.5.1.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:215)
at java.util.zip.ZipFile.(ZipFile.java:145)
at java.util.jar.JarFile.(JarFile.java:154)
at java.util.jar.JarFile.(JarFile.java:91)
at sun.net.www.protocol.jar.URLJarFile.(URLJarFile.java:93)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:69)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:99)
at 
sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122
)
at 
sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:
89)
at org.apache.tomcat.util.scan.FileUrlJar.(FileUrlJar.java:41)
at 
org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:34)
at 
org.apache.catalina.startup.ContextConfig$FragmentJarScannerCallback.scan(C
ontextConfig.java:2612)
at 
org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.j
ava:259)
at 
org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java
:178)
at 
org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(Contex
tConfig.java:1868)
at 
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1256
)
at 
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java
:873)
at 
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java
:371)
at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppo
rt.java:117)
at 
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.jav
a:90)
at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java
:5355)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1
559)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1
549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1
145)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
615)
at java.lang.Thread.run(Thread.java:745)

*This error repeats for every JAR file in the project which was pulled in
from Maven dependencies.  There are hundreds of these.*

Note that I've placed a breakpoint at the ZipFile.open call on one of the
failing machines and performed the following in a separate terminal:

cd /WORKSPACE/PROJECT/tomcat7/webapps/../../target/PROJECT/WEB-INF/lib/

ls -la

I can confirm that all of the "missing" JAR files were there immediately
before the native 'open' method is called and the exceptions are thrown
which claim that the files aren't there.  This led me to suspect that the
JAR files may be corrupted,