On Fri, 12 Nov 2004 11:46:22 +1300, Jonathan Wright <[EMAIL PROTECTED]> wrote: > Hi, > > Just a quick question about JNDI in a Struts setting. I want to reduce the > dependencies between objects in my app. Some objects that are not servlet > aware need access to the ServletContext and DataSources. However rather than > complicating matters and increasing the number of arguments I need to pass > around I'm thinking of putting references to DataSources and the > ServletContext into a JNDI context. > > Which JNDI SPI would you recommend for a simple object registry/store? What > are the issues regarding the Referenceable interface?
Why not use the JNDI naming context provided by your container? You shouldn't have to be worried about implementing this -- just configure the JNDI resources that you want to make available to your application. For example, the instructions for using the naming context provided by Tomcat: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html and specific info about using a data source provided by Tomcat: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html Other servers will have their own mechanisms for configuring these things. Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]