Hi you all,

I'm trying to build application wide variable from a ServletContextListener under Tomcat 4.1.24.
Some of the variables are built with data read from a database.
I've been able to successfully define the JNDI datasources and to list them in the contextInitialized method
but I needed to try many possible combinations (see later) to succesfully perform the lookup in the contextInitialized call: it seems like if Tomcat doesn't make the JNDI completely available during the initialization sequence of the web application: infact the following behaviour is applicable to an init method of a servlet loaded at start-up.
I would like to share this experience and to ask for help, if I'm doing something wrong.


There is only a way I've managed to get the result (to be able to estabilish a connection using a DataSource retrieved from a JDNI lookup):
- declare the use of the resource in web.xml
- define the resource in server.xml (this is a little 'limitating' for me)
- deploy the applications in unpacked format (i.e. not from a war file: this is quite limiting, however)


I want to list othe options I've tried (sarting from an 'empty' webapps directory) without success:
- stop tomcat, copy theApplication.war and theApplication.xml in CATALINA_HOME/webapps: theApplication.xml contains the context configuration, start tomcat
- deploy theApplication.war with a META-INF/theApplication.xml in it:
The stack traces look like this:
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:189)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at it.masterhouse.termopoli.web.startup.Init.contextInitialized(Init.java:37)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3269)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3598)
at org.apache.catalina.core.StandardHostDeployer.start(StandardHostDeployer.java:629)
Any feedback would be appreciate
Thank you very much
Federico Spinazzi



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to