[jboss-user] [JNDI and Naming] - lookup on ServletContextListener.contextDestroyed

Grigory Kalabin do-not-reply at jboss.com
Wed Oct 10 10:15:06 EDT 2012


Grigory Kalabin [https://community.jboss.org/people/gkalabin] created the discussion

"lookup on ServletContextListener.contextDestroyed"

To view the discussion, visit: https://community.jboss.org/message/764118#764118

--------------------------------------------------------------
Hi everybody!

I'm using JBoss as 7.1.1.

I want to release some resources when my application stops (undeploy or server instance shutdown). The resources are located in jndi. 

Currently I'm using ServletContextListener interface: on contextInitialized I bind resources to JNDI and on contextDestroyed I have to release the resources, but I have an exception:

Error looking up myName, service service jboss.naming.context.java.myName is not started


I tryed to bind data on different addresses (java:comp/myName, java:comp/env/myName, java:/myName,java:jboss/myName), but behaviour is the same in all cases.
When the application runs I can successfuly look up my object.

What I'm doing wrong? My be there is another method to release resources on application stop?

P.S. I also attached a sample project: if deploy it and then undeploy you can see that it can't look up the objects on destroy. In index.jsp you can see that it's possible to lookup the objects when the app runs.

Thank you for any help.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/764118#764118]

Start a new discussion in JNDI and Naming at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121010/c64035c2/attachment.html 


More information about the jboss-user mailing list