tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Roest <tom...@blahz.org>
Subject Re: Question about context-param
Date Thu, 16 Jan 2003 20:11:58 GMT
Sorry 2 different Contexts, and my brain was all messed up.  When I'm refering to my Context

Constructor it's actually the main servlet constructor (which in our app is PolarisContext).
 Which 
extends HttpServlet.

Sorry for the confusion
Shapira, Yoav wrote:
> 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:tomcat@blahz.org]
>>Sent: Thursday, January 16, 2003 1:49 PM
>>To: tomcat-user@jakarta.apache.org
>>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-
>>unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:tomcat-user-
>>help@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message