定义您自己的资源。请参阅Tomcat文档。您提供javax.naming.spi.ObjectFactory的实现。让它返回适当的Context实现,以便通过某个名称查找它会返回该名称的数据库连接。就我而言,context.xml中所需的条目如下所示:
<Resource name="ldap/Context" // your name, probably something like jdbc/dynamic auth="Container" type="javax.naming.ldap.LdapContext" factory="com.xxxx.ldap.LdapContextFactory" // your initialization params here, if any >



