Hi,
I have developed my own BeanFactory as explained in your JNDI-RESOURCE-HOWTO.
Everything works fine and I can use the corresponding factory successfully.
But when I try to upgrade it a bit, I'm facing a problem:
I'd like my factory to access a database to update the bean it returns. So I'd like it to use the datasource I've also configured in server.xml:
<GlobalNamingResources> <Resource name="jdbc/oracle/sjogmxf" auth="Container" type="
javax.sql.DataSource" factory="
org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@(protected):
<ResourceLink name="infocenter" type="cosmos.infocenter.Infocenter" global="infocenter"/> <ResourceLink name="jdbc/oracle/sjogmxf" type="
javax.sql.DataSource" global="jdbc/oracle/sjogmxf"/>
When I try to lookup and use one of these resources directly from the webapps, it just works great. But if I try to modify my custom factory to make it lookup the datasource, it gets a NamingException (Comp is not linked to the initial context).
I suppose this means the initial context is created after the resources are created. Is there a way to have my custom resource reference another resource (in this case, the datasource)? Then is there a way to specify the order of loading for resources? (Here I'll need the datasource to be loaded BEFORE the custom factory...)
I thank you in advance,
Alexandre BORGOLTZ
Head of Technology
SmartJog SA
Phone: +33 (0)1 4996 6324
Fax: +33 (0)1 4996 6405
Mobile: +33 (0)6 8882 1417
alexandre.borgoltz@(protected)