On Mon, 2012-02-27 at 04:04 -0800, Pid wrote: > On 27/02/2012 11:46, Ziggy wrote: > > Hi, > > > > I am really struggling with this problem described here - > > http://stackoverflow.com/questions/9453109/using-jndi-to-share-servlet-session-objects-and-data-in-tomcat > > I would really appreciate any pointers. > > A pointer: it's usually polite to describe the problem you're having, > rather than just point to a link somewhere else.
+1 > How exactly is the object initialised in JNDI. For example, the > following configuration from the Tomcat docs shown the configuration > for JDBC It is initialized using a resource factory. https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Tomcat_Standard_Resource_Factories > How would i do a similar thing in my case and most importantly, how > would i initialise the object before it is put on the JNDI tree. This is all handled by the resource factory. You could use an existing resource factory implementation like Generic JavaBean factory. https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Generic_JavaBean_Resources or... > I guess what i am looking for is a simple example of the use of JNDI > in Tomcat but not for database connections but for service provider > type objects. You could create your own custom factory. https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Adding_Custom_Resource_Factories > I have been reading this tutorial http://docs.oracle.com/javase/tutorial/jndi/ops/bind.html > but it is focused more on LDAP naming directories which doesnt > really help. Nothing against the Oracle documentation, but you should probably focus more on the Tomcat documentation. It's going to have more relevant information. https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html > Having said that, it does rather seem like you're trying to: > > a) reinvent the wheel (distributed SSO is a solved problem), > b) force a square peg into a smaller round hole and > c) do it the hard way +1 You might want to look at using the built-in support... https://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Single%20Sign%20On https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Single_Sign_On_Valve or CAS. http://www.jasig.org/cas Dan