Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Filter not being called  RSS feed

 
Maria Diminuta
Greenhorn
Posts: 15
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have Filter that is randomly being called and randomly not being called without any logical reason...

The mapping is very simple:



And the filter itself is also very simple:



So, init is called, so it works... but most of the time the doFilter method is not being called at all... what am I doing wrong?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know doFilter is not called - do you have logging in place to ascertain that fact which you didn't post?
 
Maria Diminuta
Greenhorn
Posts: 15
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am debugging and I have set some breakpoints...

Anyway, if I set it to print logs when entering the doFilter and before it goes out, the logs are neither printed...
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Are you talking about this log? I don't see any other log messages in the method.
If yes, it wont print every time it enters doFilter since its in a condition.

Are you able to reproduce the scenarios when the doFilter is called and when doFilter is not called? or it is random as you have mentioned?

Please post us the log trace with loggers in doFilter method written clearly for entry and exit.
 
vikram reddy bollu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you add one log.info() in doFilter method as first line, and check whether it is being printed every time or not.
 
Maria Diminuta
Greenhorn
Posts: 15
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I told you I was debugging and I had set breakpoints in the method so I am pretty sure it wasn't called. I also told you that if I put logs at the first line it wasn't printed...

Anyway, after some Eclipse restarts aand workspace cleaning it works again.

Thank you anyway.
 
Dave Tolls
Ranch Hand
Posts: 2504
27
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not that people don't believe you, but you have to remember that we cannot se your machine from here so, unless something is actually posted to the forum, we cannot assume that (in this case) logging statements are where we think they should be.

So could you post a version of the code containing additional log.info calls before the try block, and the output.

Also, does this happen on and off for the same request URL? Or is it some URLs work and others don't?
 
Maria Diminuta
Greenhorn
Posts: 15
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Here it is:


Today it works sometimes and sometimes not... I mean, for the same URLs sometimes it is called and sometimes not... But when I do some Eclipse restarts and Project clean... then it starts working again as expected...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say you have an Eclipse problem, not a servlet API problem.

rant - Another example of why I do not trust IDEs to do what you think they are doing - end rant

Bill
 
Maria Diminuta
Greenhorn
Posts: 15
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's what I realised after it started working again after the restarts and cleans... now I am testing it on a Tomcat Server outside Eclipse...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!