Feb 22nd, 2010, 11:11 AM
Does Spring handle stale JNDI destinations?
Reading the WebLogic documentation http://download.oracle.com/docs/cd/E...html#wp1311973 it states:
..some JMS providers, like WebLogic JMS, may invalidate a Destination object after a server failure. So, if the EJB runs on Server A, and JMS runs on Server B, then the EJB on Server A will have to perform the JNDI lookup of the objects from Server B again after that server has recovered.
So if I am using Spring to load all my JNDI objects at context startup, will it handle doing to re-lookups automatically if my JMS Provider does invalidate the Destination object?
Thanks for any help,
Feb 23rd, 2010, 05:21 AM
JndiDestinationResolver has a setCache method which defaults to true and also implements the CachingDestinationResolver interface which allows removal of specific items from the cache or the clearing of the cache. Set caching to false will cause some performance overhead so you may want check how much of a performance overhead that causes before considering that as an option.
A better solution would be to detect the exception indicating that the destination is no longer valid and remove that particular destination from the cache.
Feb 23rd, 2010, 08:02 AM
Thanks for the reply Jonas, pls could you explain how I can detect the exception? Also, to remove the destination from the cache do I just get hold of the JndiDestinationResolver bean from the application context and call removeFromCache()? If so, is the param to removeFromCache() the bean name of the destination or the jndi lookup name?