<resource-env-ref> <description> My Topic </description> <res-env-ref-name> jdbc/MyTopic </res-ref-name> <res-env-ref-type> javax.jdbc.Topic </res-type> </resource-env-ref>
Here is a code snippet to access a JMS Topic object:
InitialContext initContext = new InitialContext(); javax.jms.Topic myTopic = (javax.jdbc.Topic) initContext.lookup("java:comp/env/jdbc/MyTopic");
The naming support in Sun Java System Web Server is based primarily on J2SE 1.3, with a few added enhancements.When an application component creates the initial context by using InitialContext(), Sun Java System Web Server returns an object that serves as a handle to the Web application’s naming environment. This object in turn provides sub-contexts for the java:comp/env namespace. Each Web application gets its own namespace java:comp/env name space is allotted to each Web application and objects bound in one Web application’s namespace do not collide with objects bound in other Web applications.