javax.naming.ConfigurationException - when trying to access Database from - MBean-NotificationLister
posted 6 years ago
I am getting the following exception when a MBean which has a timer and implements NotificationListner-handleNotification calls a Dataaccess class.
If I call the Dataaccess class from jsp it works fine, however the class is giving the below exception when called in handleNotification method.
Any pointers will be greatly appericated.
A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component.
This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request.
Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.
Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names.
Exception stack trace:
javax.naming.ConfigurationException [Root exception is javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context "java:".]