tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: javax.servlet.ServletContext missing two methods
Date Thu, 27 Jul 2000 14:50:50 GMT

Hi Craig,

thanks for that sequence of commands. I tried it your way and the methods
seem to be inplace 8-).
I might have to make a rule for myself: "never trust visual tools".

I noticed this problem when I tried to compile my servlet (which user
ServletContext) under Forte build 842. I got the message that the method
getInitParamter() is not defined. I started exploring by adding those
servlet.jar files into my Forte environment. Forte showed that
ServletContext really misses those two methods.

I think that there is a bug in Forte 842, which played this trick on me. I
think Forte internally uses the older version of servlet.jar file and each
time I try to explore the contents of a different servlet.jar file, the
classes from the inner version are displayed.

Faustas wrote:

> I checked the servlet.jar file that comes with Tomcat 3.1. ServletContext
> didn't have those methods.
> I also checked the latest servlet.jar file from the site. The
> same problem.
> I'm using Forte for Java to inspect the contents of the jar files.

That's intriguing.  I got the following results, where
is the directory containing the binary distribution of Tomcat 3.1:

    cd /usr/local/jakarta-tomcat/lib
    jar xvf servlet.jar
    javap -classpath . javax.servlet.ServletContext

returned the following results

    Compiled from
    public interface javax.servlet.ServletContext
        /* ACC_SUPER bit NOT set */
        public abstract java.lang.Object getAttribute(java.lang.String);
        public abstract java.util.Enumeration getAttributeNames();
        public abstract javax.servlet.ServletContext
        public abstract java.lang.String
        public abstract java.util.Enumeration getInitParameterNames();
        public abstract int getMajorVersion();
        public abstract java.lang.String getMimeType(java.lang.String);
        public abstract int getMinorVersion();
        public abstract javax.servlet.RequestDispatcher
        public abstract java.lang.String getRealPath(java.lang.String);
        public abstract javax.servlet.RequestDispatcher
        public abstract getResource(java.lang.String)
        public abstract
        public abstract java.lang.String getServerInfo();
        public abstract javax.servlet.Servlet
getServlet(java.lang.String) throws
        public abstract java.util.Enumeration getServletNames();
        public abstract java.util.Enumeration getServlets();
        public abstract void log(java.lang.Exception, java.lang.String);
        public abstract void log(java.lang.String);
        public abstract void log(java.lang.String, java.lang.Throwable);
        public abstract void removeAttribute(java.lang.String);
        public abstract void setAttribute(java.lang.String,

and the two methods we are discussing are the fourth and fifth ones

What happens when you compile a servlet (against your servlet.jar) that
tries to use
these methods?


> wrote:
> > Hi,
> >
> > I wonder if anyone else has noticed the problem with the latest version
> > Java Servlet specification 2.2.
> >
> > If you look at the servlet.jar file (which contains all the standardized
> > interfaces), the interface javax.servlet.ServletContext doesn't define
> > these methods:
> >
> > public java.lang.String getInitParameter(java.lang.String name)
> > public java.util.Enumeration getInitParameterNames()
> >
> > I think they should be defined, because servlet specification 2.2 (page 23)
> and Java Servlet > API documentation (generated by javadoc) do include them.
> >
> > I wounder if there is some reason why they are not defined.
> >
> Where did you get your "servlet.jar" file from?  The servlet.jar that comes
with > Tomcat certainly includes these methods.
> >
> > Faustas Zilinskas
> > First Union
> Craig McClanahan

View raw message