I think what you want to do is something like:
try{
// process property file.....
}
catch(IOException ioe){
/* throw a servlet exception to tell the servlet runner that you were not
successful */
throw(new ServletException("Init failed in servlet 'MyServlet' with
" + ioe.getMessage());
}
John Zerbe - Mellon Bank
Phone: 412-234-1048 E-Mail: [EMAIL PROTECTED]
> -----Original Message-----
> From: roopa [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, May 24, 1999 5:19 AM
> To: [EMAIL PROTECTED]
> Subject: Re: how to advise class loader that init() failed
>
> I don't know whether i am correct or not!!!..
>
> within init method, where you are reading the property file, put
> everything
> inside try-catch block
>
> try{
> //all statements
> }catch ( Exception e )
> {
> //..
> return
> }
>
>
> guillaume ORIOL wrote:
>
> > When a servlet starts, the loader first invokes its init() method in
> order
> > for the
> > servlet to initialize. And the signature of this method is:
> > public void init(ServletConfig config) throws ServletException.
> > As the method doesn't return any object, is there any mean to tell the
> > loader
> > that the servlet could not be correctly initialized? In my case, the
> init()
> > method
> > first attempts to open a properties file. If the file cannot be found,
> the
> > servlet will not function properly and thus i would like the web server
> to
> > return an error and not to try to invoke any service() or doGet()
> method.
> >
> >
> __________________________________________________________________________
> _
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html