-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Thufir,
On 3/9/15 12:47 PM, Thufir wrote: > On Mon, 09 Mar 2015 08:59:33 +0000, Mark Thomas wrote: > >> On 09/03/2015 03:59, Thusitha Thilina Dayaratne wrote: >>> Hi, >>> >>> I want to access the JNDI Directory context in Tomcat8. I've >>> used *DirContextURLStreamHandler* class which was in Tomcat 7. >>> But now that has been removed. Can someone tell me how can I >>> access the JNDI Directory Context in Tomcat 8? >> >> Via the standard JNDI API. >> >> Mark > > > > Can you elaborate a little? For this example: > > > public static void main(String[] args) { try { // Gets the JNDI > context Context jndiContext = new InitialContext(); // Looks up the > administered objects ConnectionFactory connectionFactory = > (ConnectionFactory) > jndiContext.lookup("jms/javaee7/ConnectionFactory"); Destination > queue = (Destination) jndiContext.lookup("jms/javaee7/ Queue"); // > Sends a text message to the queue try (JMSContext context = > connectionFactory.createContext()) { > context.createProducer().send(queue, "Text message sent at " + new > Date()); } } catch (NamingException e) { e.printStackTrace(); } } > > http://stackoverflow.com/questions/23037845/ > > > > how can that be modified to load the jndi.properties file? The javadoc for InitialContext seems to indicate that this file will be processed automatically. If it isn't processed automatically, I'd suggest trying to figure out why. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAEBCAAGBQJU/eI8AAoJEBzwKT+lPKRY+YgP/2BdznexT1XxxBa751DdQEAc n3C0MhqpBb5udv+yL3PLasyoPozPEcS+7Ql3nK6PRBseXqbzmzRVuuJdsAIP7EPI 4lhWMnk3BzoVwz2VNaAfNKAp6ZZhKVBHvhKk5iOI62exJFHKhgPgk72HTGB8FuxJ emRxfWPJ1L1xu+bX0MSPuxmrKXjKlhy2/VZD99LFvazeCzoB+TgmNhYH9MmCXKI1 nXRz9fPc0nKwAXo8EIBaUluTcMte++//MsoJTWqZaFOBDtPTXnE/twRdHDtyY+3R AlKDBxPVPx1OsouyJs0Ajq89CHdIEVjDS2SIMqt//ZNsyqN7BpUdR3KnojuR5rvk fzaFia6m13t/oIMvC6T+V6CwNTcp5sSR3yezSAKNjEk2drg5LKczj45uyTiRnfwU hYMB7vV9iyRqRPhJRtHzHyisOsZrYGi0ZaFsTxuJL3AMuahiax7QC4zLEtB6nN2Z P/CQne/6KNGV92u8baOd0C7GVojtVVfmGgEqt1iEBF1LQn/LXZlg4eKvoajjtxXs FF9AdiWeAZNKoXipk86NgDHRehgvhvBW6wea+3uiHpvTHgSCRbkE1CmSqznVOn8c IS9Q2c0bS3Nq5OHdDmvhoH71Q5xCXOrlGCasI12iyBt/syByZO44tkFSgc3a8uOq AYwMwB9xPqV731AUsGC3 =nIZi -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org