You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jacob Kjome <ho...@visi.com> on 2002/12/12 23:19:59 UTC

Re: Sevlet at startup, not starting

Hello Alexander,

Note that loading on startup only calls the init() method.  It does not call doGet()
or anything like that.  Just making sure you understood that.

Jake

Thursday, December 12, 2002, 4:09:41 PM, you wrote:

AW> Hi there... I have 1 servlet to start at startup, but it doesnt. If i call the 
AW> servlet from a browser, it starts fine.

AW> My web.xml has:

AW>   <servlet>
AW>     <servlet-name>Startup</servlet-name>
AW>     <description>Servlet that starts different startup classes and 
AW> stuff.</description>
AW>     <servlet-class>com.difh.servlets.Startup</servlet-class>
AW>     <load-on-startup>1</load-on-startup>
AW>   </servlet>

AW> and

AW>   <servlet-mapping>
AW>     <servlet-name>Startup</servlet-name>
AW>     <url-pattern>/srv/com.difh.servlets.Startup</url-pattern>
AW>   </servlet-mapping>

AW> Any clues as to why this doesn't get run when tomcat starts?

AW> Thanks!


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



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


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


Re: Sevlet at startup, not starting

Posted by Alexander Wallace <aw...@rwsoft-online.com>.
Thanks for all the help.

On Thursday 12 December 2002 19:15, Jacob Kjome wrote:
> That's what init() is there for.  Just note that the container is allowed
> to unload and reload servlets at any time it wants to so your init() and
> destroy() methods aren't guaranteed to run just once.  If you have
> application initialization that you want to happen once and only once
> during the entire run of the application, look into putting that code in
> the contextInitialized() method of a servlet context listener.
>
> Jake
>
> At 05:40 PM 12/12/2002 -0600, you wrote:
> >Well, that must be it then!
> >
> >I should just move all my code that i want inited to the init then righ?
> > Is that safe to do?
> >
> >Thanks!
> >
> >On Thursday 12 December 2002 16:19, Jacob Kjome wrote:
> > > Hello Alexander,
> > >
> > > Note that loading on startup only calls the init() method.  It does not
> > > call doGet() or anything like that.  Just making sure you understood
> > > that.
> > >
> > > Jake
> > >
> > > Thursday, December 12, 2002, 4:09:41 PM, you wrote:
> > >
> > > AW> Hi there... I have 1 servlet to start at startup, but it doesnt. If
> > > i call the AW> servlet from a browser, it starts fine.
> > >
> > > AW> My web.xml has:
> > >
> > > AW>   <servlet>
> > > AW>     <servlet-name>Startup</servlet-name>
> > > AW>     <description>Servlet that starts different startup classes and
> > > AW> stuff.</description>
> > > AW>     <servlet-class>com.difh.servlets.Startup</servlet-class>
> > > AW>     <load-on-startup>1</load-on-startup>
> > > AW>   </servlet>
> > >
> > > AW> and
> > >
> > > AW>   <servlet-mapping>
> > > AW>     <servlet-name>Startup</servlet-name>
> > > AW>     <url-pattern>/srv/com.difh.servlets.Startup</url-pattern>
> > > AW>   </servlet-mapping>
> > >
> > > AW> Any clues as to why this doesn't get run when tomcat starts?
> > >
> > > AW> Thanks!
> > >
> > >
> > > AW> --
> > > AW> To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org> AW> For additional
> > > commands, e-mail: <ma...@jakarta.apache.org>
> >
> >--
> >To unsubscribe, e-mail:  
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>


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


Re: Sevlet at startup, not starting

Posted by Jacob Kjome <ho...@visi.com>.
That's what init() is there for.  Just note that the container is allowed 
to unload and reload servlets at any time it wants to so your init() and 
destroy() methods aren't guaranteed to run just once.  If you have 
application initialization that you want to happen once and only once 
during the entire run of the application, look into putting that code in 
the contextInitialized() method of a servlet context listener.

Jake

At 05:40 PM 12/12/2002 -0600, you wrote:
>Well, that must be it then!
>
>I should just move all my code that i want inited to the init then righ? Is
>that safe to do?
>
>Thanks!
>
>On Thursday 12 December 2002 16:19, Jacob Kjome wrote:
> > Hello Alexander,
> >
> > Note that loading on startup only calls the init() method.  It does not
> > call doGet() or anything like that.  Just making sure you understood that.
> >
> > Jake
> >
> > Thursday, December 12, 2002, 4:09:41 PM, you wrote:
> >
> > AW> Hi there... I have 1 servlet to start at startup, but it doesnt. If i
> > call the AW> servlet from a browser, it starts fine.
> >
> > AW> My web.xml has:
> >
> > AW>   <servlet>
> > AW>     <servlet-name>Startup</servlet-name>
> > AW>     <description>Servlet that starts different startup classes and
> > AW> stuff.</description>
> > AW>     <servlet-class>com.difh.servlets.Startup</servlet-class>
> > AW>     <load-on-startup>1</load-on-startup>
> > AW>   </servlet>
> >
> > AW> and
> >
> > AW>   <servlet-mapping>
> > AW>     <servlet-name>Startup</servlet-name>
> > AW>     <url-pattern>/srv/com.difh.servlets.Startup</url-pattern>
> > AW>   </servlet-mapping>
> >
> > AW> Any clues as to why this doesn't get run when tomcat starts?
> >
> > AW> Thanks!
> >
> >
> > AW> --
> > AW> To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org> AW> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: Sevlet at startup, not starting

Posted by Alexander Wallace <aw...@rwsoft-online.com>.
Well, that must be it then! 
 
I should just move all my code that i want inited to the init then righ? Is 
that safe to do?

Thanks!

On Thursday 12 December 2002 16:19, Jacob Kjome wrote:
> Hello Alexander,
>
> Note that loading on startup only calls the init() method.  It does not
> call doGet() or anything like that.  Just making sure you understood that.
>
> Jake
>
> Thursday, December 12, 2002, 4:09:41 PM, you wrote:
>
> AW> Hi there... I have 1 servlet to start at startup, but it doesnt. If i
> call the AW> servlet from a browser, it starts fine.
>
> AW> My web.xml has:
>
> AW>   <servlet>
> AW>     <servlet-name>Startup</servlet-name>
> AW>     <description>Servlet that starts different startup classes and
> AW> stuff.</description>
> AW>     <servlet-class>com.difh.servlets.Startup</servlet-class>
> AW>     <load-on-startup>1</load-on-startup>
> AW>   </servlet>
>
> AW> and
>
> AW>   <servlet-mapping>
> AW>     <servlet-name>Startup</servlet-name>
> AW>     <url-pattern>/srv/com.difh.servlets.Startup</url-pattern>
> AW>   </servlet-mapping>
>
> AW> Any clues as to why this doesn't get run when tomcat starts?
>
> AW> Thanks!
>
>
> AW> --
> AW> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org> AW> For additional
> commands, e-mail: <ma...@jakarta.apache.org>


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