开发者

Tomcat JNDI: managed stack of objects

开发者 https://www.devze.com 2022-12-24 16:44 出处:网络
I have a class class ObjFactory { MyObject getObject() {...} void returnObject() {...} } How can we configure Tomcat so that it would provide this factory through JNDI and manages

I have a class

class ObjFactory {
 MyObject getObject() {...}
 void returnObject() {...}
}

How can we configure Tomcat so that it would provide this factory through JNDI and manages this factory?

Say, one web app should get access to this factory and it must exist only 1 factory in Tomcat, every copy of a web app references the 开发者_开发技巧same object.

  1. What are specific rules to design this factory class? Maybe it should implement some interface to work with Tomcat, JNDI in the way I described?

  2. How to glue this class, tomcat and webapp (what should be written in what file, web.xml, context.xml, etc)?


If you are using Tomcat 5.5, this is a good place to start: JNDI Resources HOW-TO.

Scroll down to the 'Adding Custom Resource Factories' section for a step-by-step explanation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号