Howdy, Your context constructor? What's that? Last I checked, javax.servlet.ServletContext was an interface, and the container provides an implementation.
If you want to tie into the context lifecycle, which is a very valid design, use a ServletContextListener implementation. The context parameters are available in that listener's contextInitialized() method. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Mike Roest [mailto:[EMAIL PROTECTED]] >Sent: Thursday, January 16, 2003 1:49 PM >To: [EMAIL PROTECTED] >Subject: Question about context-param > >Hi all, > I'm trying to initialize a few parameters from my web.xml to be >available to my context. > >I'm just wondering when they become available. As I'm attempting to >access them during my Context constructor and I'm getting to following >exception trace. > >(This call was just trying to get the names not actually access the >values but trying to access the values give similar results) > >java.lang.NullPointerException >at >javax.servlet.GenericServlet.getInitParameterNames(GenericServlet.java: 167) >at polaris.servlet.PolarisContext.<init>(PolarisContext.java:54) >at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) >at >sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructor Acce >ssorImpl.java:39) >at >sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCon stru >ctorAccessorImpl.java:27) >at java.lang.reflect.Constructor.newInstance(Constructor.java:274) >at java.lang.Class.newInstance0(Class.java:296) >at java.lang.Class.newInstance(Class.java:249) >at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper. >java:902) >at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821) >at >org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext. java >:3420) >at org.apache.catalina.core.StandardContext.start(StandardContext.java:3 >608) >at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) >at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) >at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) >at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347 >) >at org.apache.catalina.core.StandardService.start(StandardService.java:4 >97) >at org.apache.catalina.core.StandardServer.start(StandardServer.java:218 >9) >at org.apache.catalina.startup.Catalina.start(Catalina.java:512) >at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) >at org.apache.catalina.startup.Catalina.process(Catalina.java:180) >at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. >java:39) >at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces >sorImpl.java:25) >at java.lang.reflect.Method.invoke(Method.java:324) >at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) > >The only thing I can think of is that the context-param isn't accessable > until after the context constructor is finished. Which makes it not >very helpfull for me. > >If anyone has another way of doing this without putting it into a >properties file I'm interested. > >(The whole point of this is we're trying to migrate our properties to DB >tables and need to give the app the DB user and password) > >Thanks > > >-- >To unsubscribe, e-mail: <mailto:tomcat-user- >[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:tomcat-user- >[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>