• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JBoss 6.1.0:: ServletContextListener is not invoking on server shutdown.  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I don't know whether it's a bug in JBoss or not, but the contextDestroyed method is not invoking at the time of server shutdown. Can anyone please help me with this issue.

The ServletContextListener looks like this,


The web.xml mapping looks like this,



and for shutting the server down, I'm using the shutdown --host=192.168.3.70 --port=1090 -S command in the bin folder of JBoss 6.1.0 Final.

The sysout that is at the context initialized is getting printed in the console and I'm also able to take debug at that specific line. But sadly neither the sysout is getting executed nor I'm being able to take debug within the contextDestroyed method.
 
Agnibha Bose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<listener>
<listener-class>com.arktech.common.listener.MyServletContextListener </listener-class>
</listener>
 
Bartender
Posts: 1810
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is your class called MyServletContextListener, yet your web.xml file is referring to EvaluationServletContextListener?
 
Agnibha Bose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry it was a mistake, I updated the servlet mapping part in the next part of the post. Still the issue isn't resolved.
 
J. Kevin Robbins
Bartender
Posts: 1810
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, that's better. But the bad news is, I can't see any reason why it shouldn't work. I've written many context listeners but I've never seen this problem. However, I'm running on Tomcat so this may be a quirk of JBoss. I'll copy this thread to the old JBoss forum; maybe someone there can help.
 
Bartender
Posts: 20765
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not annotate MyServletContextLIstener with "@WebServletContextListener "?

Unless you're running an old version of JBoss, that will eliminate the need for a web.xml entry entirely (if you have both, web.xml overrides the annotation, though).

And that way, there's a virtual guarantee that the listener will get properly wired in.
 
Agnibha Bose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

J. Kevin Robbins wrote:Okay, that's better. But the bad news is, I can't see any reason why it shouldn't work. I've written many context listeners but I've never seen this problem. However, I'm running on Tomcat so this may be a quirk of JBoss. I'll copy this thread to the old JBoss forum; maybe someone there can help.



Thanks for your support. I also assumed that the problem is with JBoss because like you I've also tried with Tomcat 8 and it worked like a charm. I've also went through various forums regarding the same but none turned up with a valid solution. Let's see what can be done to solve the issue if it's not a bug in JBoss 6.1.0.
 
Agnibha Bose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Why not annotate MyServletContextLIstener with "@WebServletContextListener "?

Unless you're running an old version of JBoss, that will eliminate the need for a web.xml entry entirely (if you have both, web.xml overrides the annotation, though).

And that way, there's a virtual guarantee that the listener will get properly wired in.



Sorry to disappoint, but the product on which I'm working on is using servlet 2.0, so WebListener annotation can't be used in my case.
 
Squanch that. And squanch this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!