tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Bug with contextInitialized using otherServletContext.getContext ?
Date Mon, 15 Nov 2004 13:52:52 GMT

Hi,
First, if you stick with 4.1, you might want to try 4.1.31 instead of
4.1.27 as it's the latest stable release.

However, I don't think what you're reporting is a bug, and so 4.1.27 vs
4.1.31 doesn't matter for this specific issue.  The reason I don't think
it's a bug is that webapp initialization order is not guaranteed: it may
simply be the context you're trying to get hasn't been initialized yet,
so a null return is valid.  Your code should be tolerant of it (and
defer registration, throw an error, or whatever you want).  That also
means a Servlet's init method isn't guaranteed to return the context
object, because it might be called before the container even starts
initializing another webapp.

Yoav Shapira http://www.yoavshapira.com
 

>-----Original Message-----
>From: Andreas Steffan [mailto:a.steffan@s2neueinformatik.de]
>Sent: Saturday, November 13, 2004 11:42 AM
>To: tomcat-dev@jakarta.apache.org
>Subject: Bug with contextInitialized using
otherServletContext.getContext ?
>
>Hallo tomcat developers,
>
>we are using Vignette Application Portal v7.1 on tomcat 4.1.27, and we
>are encountering a problem using a ServletContext to obtain a reference
>to another one.
>
>The whole story goes as follows:
>
>The portal (which is a web-application) is configured in server.xml to
>make sure it gets started before the portlet-application. Both
>applications have crossContext set to true. The portlet application
uses
>a ServletContextListener (provided by Vignette) to register with the
>portal (which also is a web-application). In contextInitialized(), this
>ServletContextListener uses the portals ServletContext object invoking
>getContext("/portlet-app-context") to obtain a reference to the
>portlet-applications ServletContext. This call sometimes (seems to
>depend on timing) returns null and makes application unavailable.
>Obtaining the ServletContext from the event on the other hand always
>returns the expected object.
>
>The spec says that getContext() may return null if the context does not
>exist or the container wishes to restrict access and
>contextInitialized() is called when the web-application is ready to
>process requests.
>
>The spec and its reference implementation don't seem to make a good
>match here.
>
>Is it a bug in tomcat that this call returns null ?
>
>We are very late on a project and need to get out fast. I see three
>possibilities here:
>
>1. Use tomcat 5.0 if it is a bug in tomcat 4.1 (assuming v5.0 has
>diffrent behaviour and Vignette will support it)
>
>2. Fix tomcat 4.1
>
>3. Move initialization to a Servlets init method (assuming that would
>make getContext not return null)
>
>What would you suggest ?
>--
>Thanks
>
>Andreas Steffan
>Entwicklung
>
>a.steffan@s2neueinformatik.de
>
>T: +49.40.80 81 69-634
>F: +49.40.80 81 69-808
>
>SinnerSchrader Neue Informatik
> >> Software. Design. Interfaces.
>http://www.s2neueinformatik.de/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message