tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aner <>
Subject Naming factory for generic java beans
Date Fri, 31 Aug 2001 17:23:10 GMT

I recently worked on getting a JDBC connection pool/DataSource working on
Tomcat 4.0b7.  I was interested in trying out the OracleConnectionCacheImpl
which Oracle provides in their JDBC drivers.

I eventually found out that the only way to make an instance of this class
available from JNDI was to create my own Factory class for it.  It seemed
to me like there should be a simpler way to do something like this so I
created a factory class (BeanFactory) which can instantiate any class which
conforms to the JavaBeans spec (i.e. most classes...).

What would I have to do to contribute this class so it ships as a standard
part of Tomcat?  The class has worked out well for my purposes but I am not
sure if the ClassLoader portion of the code is doing the right thing, I copied
it from one of the other factory classes in org.apache.naming.factory.

Using this class, I am able to make the Oracle DataSource implementation
available to all my servlets using the following xml fragment in server.xml

  <Resource name="jdbc/myDataSource" auth="SERVLET"
  <ResourceParams name="jdbc/myDataSource">


Similarly, you could make ANY JavaBean available from jndi using this factory.

I have attached my implementation to this message if anybody is interested in
getting it incorporated into Tomcat.


	- Aner
View raw message