Thanks Regis, but I had already added the new context when I reported
this problem.

It seems to be related to packages. When I use packages with my
servlets, they can't get the init parameters. If I don't use packages
everything works as expected...

Regis Muller wrote:
> 
> You may need to add a context in TOMCAT_HOME/conf/server.xml
> 
> like
> <Context path=""
> docBase="webapps/webdev/WEB-INF" />
> 
> Fabio Sato wrote:
> 
> > I'm facing a strange problem with servlets and init parameters under
> > Tomcat 3.2.1:
> >
> > I created a servlet and put it in the following directory:
> >
> > $TOMCAT_HOME/webapps/webdev/WEB-INF/classes/coreservlets/
> >
> > Then, I created the file web.xml under the WEB-INF directory:
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <!DOCTYPE web-app
> >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >     "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
> >
> > <web-app>
> >   <servlet>
> >     <servlet-name>
> >       ShowMsg
> >     </servlet-name>
> >     <servlet-class>
> >       coreservlets.ShowMessage
> >     </servlet-class>
> >
> >     <init-param>
> >       <param-name>message</param-name>
> >       <param-value>xxx</param-value>
> >     </init-param>
> >
> >     <init-param>
> >       <param-name>repeats</param-name>
> >       <param-value>5</param-value>
> >     </init-param>
> >
> >   </servlet>
> > </web-app>
> >
> > With this configuration the servlet didn't read any of the init
> > parameters and both values are set to null.
> >
> > But if I remove the package declaration of the source file, recompile
> > it, put the servlet in the WEB-INF/classes directory, and remove the
> > package prefix in the <servlet-class> section of the web.xml, everything
> > works fine.
> >
> > Any hints?
> > --
> > Fábio Sato - [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

-- 
Fábio Sato - [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to