• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Filter not being called

 
Greenhorn
Posts: 15
Mac Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic