You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/10/05 01:10:23 UTC

DO NOT REPLY [Bug 13320] New: - Can't get initialized static variables from servlet

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13320>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13320

Can't get initialized static variables from servlet

           Summary: Can't get initialized static variables from servlet
           Product: Tomcat 4
           Version: 4.1.12
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: dinigor@mail.ru


In my web application I have several static variables and try to initialize 
them using ServletContextListener defined in web.xml.
In log file I see that variables were properly initialized.
But when I send requests to servlet or JSP I get NPE, becase that variables is 
null.
Then I stop TomCat and see in files that variables were correctly finilized! 
So, they lived somewhere, but I could not get them. Tomcat server is one JVM.
I checked classloader in several cases and got the same class 
org.apache.catalina.loader.WebappClassLoader.

I got the same problem using init() method in servlet together with
load-on-startup.

It looks like for one web application defined in one context I got two 
different ServletContexts when try to initialize application using 
ServletContextListener or init()+load-on-startup. First contains init. 
parameters from both server.xml & web.xml, second only from web.xml. 
In this case I can't pass initialized variales to servlet using
ServletContext arguments.

First I got the problem in 4.0.2.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>