Andrea, Guillaume pointed me to the better solution:
getContext().getNamingContext() should work and is also the better way if it is inside of a component. You don't have to set those properties then. Cheers, Thomas Andrea Zoppello wrote: > It works. > > Thank you. > > Thomas TERMIN ha scritto: >> Andrea Zoppello wrote: >> >>> Hi to all >>> >>> I'm asking if there's a way to access Jndi resources (defined in >>> jndi.xml ) in the java code of a component/endpoint??? >>> >> >> That should work. >> >> private String jndiInitialContextFactory = >> "org.apache.xbean.spring.jndi.SpringInitialContextFactory"; >> private String jndiProviderUrl = "classpath:jndi.xml"; >> >> Hashtable env = new Hashtable(); >> env.put(Context.INITIAL_CONTEXT_FACTORY, >> this.jndiInitialContextFactory); >> env.put(Context.PROVIDER_URL, jndiProviderUrl); >> >> Context ctx = new InitialContext(env); >> >> Cheers, >> Thomas >> > > -- Thomas Termin _______________________________ blue elephant systems GmbH Wollgrasweg 49 D-70599 Stuttgart Tel : (+49) 0711 - 45 10 17 676 Fax : (+49) 0711 - 45 10 17 573 WWW : http://www.blue-elephant-systems.com Email : [EMAIL PROTECTED] blue elephant systems GmbH Firmensitz : Wollgrasweg 49, D-70599 Stuttgart Registergericht : Amtsgericht Stuttgart, HRB 24106 Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle
