Two instance servlet during startup

2001-11-24 Thread Valera Molyakov

Hi !

I am load servlet on startup.

   servlet
  servlet-nameMailingListServlet/servlet-name
  servlet-classservlets.MailingListServlet/servlet-class
init-param
param-nameperiod/param-name
param-value20/param-value
/init-param
  load-on-startup/load-on-startup
   /servlet

But tomcat load two instance this servlet !!!
In what there can be a problem ?

I am using Windows 2000 + Java 1.3 + Tomcat 4.0.1.

P.S. Tomcat  start two instance of any servlets with startup.



Servlet on startup

2001-11-19 Thread Conrad Winchester

Hi all,

The following XML snippet has been used to initialize our application for
about the past 8 months.


  servlet
servlet-nameInit/servlet-name
servlet-classcom.hotgen.website.init.Init/servlet-class
load-on-startup1/load-on-startup
  /servlet

It has worked faultlessly with tomcat 3.2.3 but fails to startup with tomcat
4.0.1. 4.0.1 seems to know about the context - the following is in
server.xml

Context path=/nis docBase=../../../NisWebApplication/nis
debug=0 reloadable=true
  Logger className=org.apache.catalina.logger.FileLogger
prefix=nis_tomcat_log. suffix=.txt timestamp=true/
/Context

and web.xml is in ../../../NisWebApplication/nis/WEB-INF. Is there anything
wrong with this?

Any help will be appreciated

Conrad Winchester

BTW the ..'s are the only way I could get it to load the application without
a file io exception!!

--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: servlet in startup

2001-10-22 Thread Dr. Evil

   Can someone please help me how to make my servlet run when the Tomcat
 starts up. What do I have to do in my codes
 to impelement this or some setup needed for my Tomcat config.?


Put these lines in web.xml:

   servlet
  servlet-namestartlogging/servlet-name
  servlet-classstartlogging/servlet-class
  load-on-startup1/load-on-startup
   /servlet

The number in the load-on-startup tag specifies the order of loadup.

In your servlet, put the code that you want to run on startup in the
init() method.  It will be called in the order listed in the web.xml
on server startup.  It works.  I use it to start log4j and to start my
database connection pool.



servlet in startup

2001-10-21 Thread Jovie Castaneda

Hi guys,

  Can someone please help me how to make my servlet run when the Tomcat
starts up. What do I have to do in my codes
to impelement this or some setup needed for my Tomcat config.?
Thanks in advance





Re: servlet in startup

2001-10-21 Thread Dmitri Colebatch

Look at the load on startup flag in web.xml

hth
dim

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 Hi guys,
 
   Can someone please help me how to make my servlet run when the Tomcat
 starts up. What do I have to do in my codes
 to impelement this or some setup needed for my Tomcat config.?
 Thanks in advance
 
 
 




RE: servlet in startup

2001-10-21 Thread Jovie Castaneda

Im trying to load this servlet but I think im doing some funny thing here
I edited the following tags in the web.xml
servlet-name
   Demolog
/servlet-name
servlet-class
   Demolog
/servlet-class
load-on-startup
   -2147483646--- i am not sure of this so i retained this value
/load-on-startup
...then I tried to start Tomcat and it says that it cannot load Demolog 
How do I get around with this?
Thanks in advance.

-Original Message-
From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 10:07 AM
To: [EMAIL PROTECTED]
Subject: Re: servlet in startup


Look at the load on startup flag in web.xml

hth
dim

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 Hi guys,
 
   Can someone please help me how to make my servlet run when the Tomcat
 starts up. What do I have to do in my codes
 to impelement this or some setup needed for my Tomcat config.?
 Thanks in advance
 
 
 




RE: servlet in startup

2001-10-21 Thread pero

Are you sure, that 'Demolog' is the fully qualified name of your Servlet? I
mean, don't you have a package name? (property servlet-class)
To load a Servlet at startup you need to provide some positive number as the
load-on-startup property.
If you want to call your Servlet from an URL like
http://localhost:8080/Demolog then you have to add a servlet-mapping to your
web.xml. Example

servlet-mapping
servlet-nameDemolog/servlet-name
url-pattern/Demolog/url-pattern
/servlet-mapping

hope this helps.

pero

 -Original Message-
 From: Jovie Castaneda [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 22, 2001 2:20 AM
 To: [EMAIL PROTECTED]
 Subject: RE: servlet in startup


 Im trying to load this servlet but I think im doing some funny thing here
 I edited the following tags in the web.xml
 servlet-name
Demolog
 /servlet-name
 servlet-class
Demolog
 /servlet-class
 load-on-startup
-2147483646--- i am not sure of this so i retained this value
 /load-on-startup
 ...then I tried to start Tomcat and it says that it cannot load Demolog
 How do I get around with this?
 Thanks in advance.

 -Original Message-
 From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 22, 2001 10:07 AM
 To: [EMAIL PROTECTED]
 Subject: Re: servlet in startup


 Look at the load on startup flag in web.xml

 hth
 dim

 On Mon, 22 Oct 2001, Jovie Castaneda wrote:

  Hi guys,
 
Can someone please help me how to make my servlet run when the Tomcat
  starts up. What do I have to do in my codes
  to impelement this or some setup needed for my Tomcat config.?
  Thanks in advance
 
 
 






RE: servlet in startup

2001-10-21 Thread Dmitri Colebatch

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 Im trying to load this servlet but I think im doing some funny thing here
 I edited the following tags in the web.xml
 servlet-name
Demolog
 /servlet-name
 servlet-class
Demolog
 /servlet-class
 load-on-startup
-2147483646--- i am not sure of this so i retained this value
 /load-on-startup
 ...then I tried to start Tomcat and it says that it cannot load Demolog 
 How do I get around with this?

FIrstly, the load-on-startup is explained in the spec (worth a
read: http://java.sun.com/products/servlet/download.html), but you have
two options.  the simple option is to use an empty 

load-on-startup /

tag, and tomcat will load the server (call its init method) in the startup
procedure, with no guarentee of order.  If you need servlets to be loaded
in a certain order, then you specify the value

load-on-startup1/load-on-startup

in the load on startup tag.  lower values are loaded first.

now if you get the error message, that means something is going wrong in
yourt init method.  use your favourite logging package to find out whats
going on (see http://jakarta.apache.org/log4j if you dont have a favourite
logging package (o:  ).

hth
dim



 Thanks in advance.
 
 -Original Message-
 From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 22, 2001 10:07 AM
 To: [EMAIL PROTECTED]
 Subject: Re: servlet in startup
 
 
 Look at the load on startup flag in web.xml
 
 hth
 dim
 
 On Mon, 22 Oct 2001, Jovie Castaneda wrote:
 
  Hi guys,
  
Can someone please help me how to make my servlet run when the Tomcat
  starts up. What do I have to do in my codes
  to impelement this or some setup needed for my Tomcat config.?
  Thanks in advance
  
  
  
 
 




RE: servlet in startup

2001-10-21 Thread Jovie Castaneda

thanks for the reply my Demolog servlet resides in /test/servlet/*
what I did is change the dtd for servlet-mapping into this
servlet-name
  Demolog
/servlet-name
url-pattern
  /test/servlet/*
/url-pattern
Does this make sense ?

-Original Message-
From: pero [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 10:32 AM
To: [EMAIL PROTECTED]
Subject: RE: servlet in startup


Are you sure, that 'Demolog' is the fully qualified name of your Servlet? I
mean, don't you have a package name? (property servlet-class)
To load a Servlet at startup you need to provide some positive number as the
load-on-startup property.
If you want to call your Servlet from an URL like
http://localhost:8080/Demolog then you have to add a servlet-mapping to your
web.xml. Example

servlet-mapping
servlet-nameDemolog/servlet-name
url-pattern/Demolog/url-pattern
/servlet-mapping

hope this helps.

pero





RE: servlet in startup

2001-10-21 Thread Jovie Castaneda

 -Original Message-
 From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 22, 2001 10:07 AM
 To: [EMAIL PROTECTED]
 Subject: Re: servlet in startup
 
 
 Look at the load on startup flag in web.xml
 
 hth
 dim
 
 On Mon, 22 Oct 2001, Jovie Castaneda wrote:
 
  Hi guys,
  
Can someone please help me how to make my servlet run when the Tomcat
  starts up. What do I have to do in my codes
  to impelement this or some setup needed for my Tomcat config.?
  Thanks in advance
  
  
  
Hi thanks for the reply but Im really grasping here :(
I tried to download  tomcat-manual-3.2.3-1.noarch.rpm   
but I dont know how to open this file so I can read on this..
thanks for guiding me :)




RE: servlet in startup

2001-10-21 Thread Dmitri Colebatch

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 Can someone please help me how to make my servlet run when the Tomcat
   starts up. What do I have to do in my codes
   to impelement this or some setup needed for my Tomcat config.?
   Thanks in advance
   
 Hi thanks for the reply but Im really grasping here :(
 I tried to download  tomcat-manual-3.2.3-1.noarch.rpm   
 but I dont know how to open this file so I can read on this..
 thanks for guiding me :)
 

this sort of stuff isn't specific to tomcat, which is why I pointed you at
the spec, rather than the tomcat manual.  however, the tomcat docs should
be included in the tomcat file you downloaded, look in tomcat/docs to see
them.  

as for installing rpms , try

# rpm -ivh tomcat-manual-3.2.3-1.noarch.rpm

as root.  rpms are out of the scope of this list, you'd be better off
finding a linux book for that, but I wouldn't worry about it, you dont
need to - just look in the docs directory of tomcat, and the mailing list
acrhives:

http://www.mail-archive.com/tomcat-user@jakarta.apache.org/

hth
dim





RE: servlet in startup

2001-10-21 Thread Jovie Castaneda

I tried testing my servlet to run when Tomcat starts...and I got this mesg
from my console

cannot load servlet name: StartMe
In WebCollect, this day =  296
In WebCollect, next day = 297
Starting WebCollect Server...
cannot load servlet name: StartMe
cannot load servlet name: StartMe

I just find it strange because it says that it cannot load the StartMe but
the next line are from the init method of my StartMe Servlet

Does my init method have a prob?

public void init (ServletConfig config) throws ServletException {

  System.out.println(Init Called for WebCollect ...);
  java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone(AET));
  java.text.SimpleDateFormat sdf = new
java.text.SimpleDateFormat(MMMddhhmm);

  java.util.Date thisTime = new java.util.Date();
  calendar.setTime(thisTime);
  dayOfYear = calendar.get(Calendar.DAY_OF_YEAR) ;
  dayOfYear += 1 ;
  nextDay = dayOfYear + 1 ;
  System.out.println(In WebCollect, this day =   + dayOfYear );
  System.out.println(In WebCollect, next day =  + nextDay);
  sdf = new java.text.SimpleDateFormat(dd/MM/yy hh:mm:ss a);
  System.out.println(Starting WebCollect Server...);
}

hoping for your replies...

-Original Message-
From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: RE: servlet in startup


On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 Can someone please help me how to make my servlet run when the
Tomcat
   starts up. What do I have to do in my codes
   to impelement this or some setup needed for my Tomcat config.?
   Thanks in advance
  
 Hi thanks for the reply but Im really grasping here :(
 I tried to download  tomcat-manual-3.2.3-1.noarch.rpm
 but I dont know how to open this file so I can read on this..
 thanks for guiding me :)


this sort of stuff isn't specific to tomcat, which is why I pointed you at
the spec, rather than the tomcat manual.  however, the tomcat docs should
be included in the tomcat file you downloaded, look in tomcat/docs to see
them.

as for installing rpms , try

# rpm -ivh tomcat-manual-3.2.3-1.noarch.rpm

as root.  rpms are out of the scope of this list, you'd be better off
finding a linux book for that, but I wouldn't worry about it, you dont
need to - just look in the docs directory of tomcat, and the mailing list
acrhives:

http://www.mail-archive.com/tomcat-user@jakarta.apache.org/

hth
dim





RE: servlet in startup

2001-10-21 Thread Dmitri Colebatch

Put a try/catch around the init method, and print the stack trace.  by the
looks of it I'm guessing your date format is wrong.  btw, if you want the
default date format use DateFormat.getDateInstance() or
DateFormat.getDateTimeInstance() for the locale's normal date and
date/time formats.  THere's a host of other DateFormat.get... methods
which are also worth looking at.

hth
dim

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 I tried testing my servlet to run when Tomcat starts...and I got this mesg
 from my console
 
 cannot load servlet name: StartMe
 In WebCollect, this day =  296
 In WebCollect, next day = 297
 Starting WebCollect Server...
 cannot load servlet name: StartMe
 cannot load servlet name: StartMe
 
 I just find it strange because it says that it cannot load the StartMe but
 the next line are from the init method of my StartMe Servlet
 
 Does my init method have a prob?
 
 public void init (ServletConfig config) throws ServletException {
 
   System.out.println(Init Called for WebCollect ...);
   java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone(AET));
   java.text.SimpleDateFormat sdf = new
 java.text.SimpleDateFormat(MMMddhhmm);
 
   java.util.Date thisTime = new java.util.Date();
   calendar.setTime(thisTime);
   dayOfYear = calendar.get(Calendar.DAY_OF_YEAR) ;
   dayOfYear += 1 ;
   nextDay = dayOfYear + 1 ;
   System.out.println(In WebCollect, this day =   + dayOfYear );
   System.out.println(In WebCollect, next day =  + nextDay);
   sdf = new java.text.SimpleDateFormat(dd/MM/yy hh:mm:ss a);
   System.out.println(Starting WebCollect Server...);
 }
 
 hoping for your replies...
 
 -Original Message-
 From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 22, 2001 11:05 AM
 To: [EMAIL PROTECTED]
 Subject: RE: servlet in startup
 
 
 On Mon, 22 Oct 2001, Jovie Castaneda wrote:
 
  Can someone please help me how to make my servlet run when the
 Tomcat
starts up. What do I have to do in my codes
to impelement this or some setup needed for my Tomcat config.?
Thanks in advance
   
  Hi thanks for the reply but Im really grasping here :(
  I tried to download  tomcat-manual-3.2.3-1.noarch.rpm
  but I dont know how to open this file so I can read on this..
  thanks for guiding me :)
 
 
 this sort of stuff isn't specific to tomcat, which is why I pointed you at
 the spec, rather than the tomcat manual.  however, the tomcat docs should
 be included in the tomcat file you downloaded, look in tomcat/docs to see
 them.
 
 as for installing rpms , try
 
 # rpm -ivh tomcat-manual-3.2.3-1.noarch.rpm
 
 as root.  rpms are out of the scope of this list, you'd be better off
 finding a linux book for that, but I wouldn't worry about it, you dont
 need to - just look in the docs directory of tomcat, and the mailing list
 acrhives:
 
 http://www.mail-archive.com/tomcat-user@jakarta.apache.org/
 
 hth
 dim
 
 
 




RE: servlet in startup

2001-10-21 Thread Jovie Castaneda

I tried putting a try catch clause but nothing has been caught..
then i made my init mehtod simple
public void init (ServletConfig config) throws ServletException {
 System.out.println(Init Called for WebCollect ...);
 System.out.println ( TEST START );
 System.out.println(Starting WebCollect Server...);
}
and the console showed this mesg

cannot load servlet name: StartMe
Init Called for WebCollect ...
TEST START
Starting WebCollect Server...
cannot load servlet name: StartMe
cannot load servlet name: StartMe

its laoding the init()of StartMe but its saying that it
cant load the StartMe..im confused now..please help!!

-Original Message-
From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 11:54 AM
To: [EMAIL PROTECTED]
Subject: RE: servlet in startup


Put a try/catch around the init method, and print the stack trace.  by the
looks of it I'm guessing your date format is wrong.  btw, if you want the
default date format use DateFormat.getDateInstance() or
DateFormat.getDateTimeInstance() for the locale's normal date and
date/time formats.  THere's a host of other DateFormat.get... methods
which are also worth looking at.

hth
dim

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

 I tried testing my servlet to run when Tomcat starts...and I got this mesg
 from my console

 cannot load servlet name: StartMe
 In WebCollect, this day =  296
 In WebCollect, next day = 297
 Starting WebCollect Server...
 cannot load servlet name: StartMe
 cannot load servlet name: StartMe

 I just find it strange because it says that it cannot load the StartMe
but
 the next line are from the init method of my StartMe Servlet

 Does my init method have a prob?

 public void init (ServletConfig config) throws ServletException {

   System.out.println(Init Called for WebCollect ...);
   java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone(AET));
   java.text.SimpleDateFormat sdf = new
 java.text.SimpleDateFormat(MMMddhhmm);

   java.util.Date thisTime = new java.util.Date();
   calendar.setTime(thisTime);
   dayOfYear = calendar.get(Calendar.DAY_OF_YEAR) ;
   dayOfYear += 1 ;
   nextDay = dayOfYear + 1 ;
   System.out.println(In WebCollect, this day =   + dayOfYear );
   System.out.println(In WebCollect, next day =  + nextDay);
   sdf = new java.text.SimpleDateFormat(dd/MM/yy hh:mm:ss a);
   System.out.println(Starting WebCollect Server...);
 }

 hoping for your replies...

 -Original Message-
 From: Dmitri Colebatch [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 22, 2001 11:05 AM
 To: [EMAIL PROTECTED]
 Subject: RE: servlet in startup


 On Mon, 22 Oct 2001, Jovie Castaneda wrote:

  Can someone please help me how to make my servlet run when the
 Tomcat
starts up. What do I have to do in my codes
to impelement this or some setup needed for my Tomcat config.?
Thanks in advance
   
  Hi thanks for the reply but Im really grasping here :(
  I tried to download  tomcat-manual-3.2.3-1.noarch.rpm
  but I dont know how to open this file so I can read on this..
  thanks for guiding me :)
 

 this sort of stuff isn't specific to tomcat, which is why I pointed you at
 the spec, rather than the tomcat manual.  however, the tomcat docs should
 be included in the tomcat file you downloaded, look in tomcat/docs to see
 them.

 as for installing rpms , try

 # rpm -ivh tomcat-manual-3.2.3-1.noarch.rpm

 as root.  rpms are out of the scope of this list, you'd be better off
 finding a linux book for that, but I wouldn't worry about it, you dont
 need to - just look in the docs directory of tomcat, and the mailing list
 acrhives:

 http://www.mail-archive.com/tomcat-user@jakarta.apache.org/

 hth
 dim







RE: Double loading when loading servlet on startup

2001-08-10 Thread Alexander Cherinko

Lot of thanks, Larry.
You are absolutely right.
It was due to different contexts.
Thank you!
I actually was in little panic about this problem:)
--Che


 -Original Message-
 From: Larry Isaacs [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 08, 2001 10:05 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Double loading when loading servlet on startup
 
 
 I tried this scenario with Tomcat 3.2.1 and I only get one call
 to init().  Are you on Windows?  If your ts directory is actually
 named Ts, I think you would get two context's.  What does your
 tomcat log show about contexts being added?
 
 Larry
 
  -Original Message-
  From: Alexander Cherinko [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 08, 2001 1:51 PM
  To: [EMAIL PROTECTED]
  Subject: RE: Double loading when loading servlet on startup
  
  
  The case:
  
  Nt/Linux v3.2.1,2,3.
  There is one context:
  Context path=/ts
   docBase=webapps/ts
   crossContext=true
   debug=1
   reloadable=true(or false)
   trusted=false 
  /Context
  
  The web.xml piece for this context
  servlet
  servlet-nameLoader/servlet-name
  servlet-classLoader/servlet-class
  load-on-startup1/load-on-startup
  /servlet
  
  jdb shows double classes named Loader loaded with different 
  instances of
  org.apache.tomcat.loader.AdaptiveClassLoader12 which have 
  generation field 2
  and 4 correspondingly. If I call
  
  Class.forName(MyClass)
  
  in init method of servlet and MyClass is subclass of thread I 
  have double
  threads. And so on.
  gc gets nothing and trying to interrupt threads in servlet's 
  destroy method
  gets nothing as well.
  
  And this occurs only when servlet is marked as 
  load-on-startup. For ordinary
  servlet there is nothing like this.
  
  --Che
  
  
   -Original Message-
   From: Larry Isaacs [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, August 08, 2001 7:58 PM
   To: '[EMAIL PROTECTED]'
   Subject: RE: Double loading when loading servlet on startup
  
  
   In the past, the cases of double loading I've seen have all been
   because an auto-loaded context (created by AutoSetup from the
   webapps directory) was also manually loaded as a second 
  context, i.e.
  
   Context path=/othercontext
docBase=webapps/examples  ...
  
   Each context gets its own instance of servlets.  As a result,
   init() is called twice, once for each context.
  
   There isn't enough information below to tell if this is the
   source of the double-loading.
  
   Cheers,
   Larry
  
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 12:32 PM
To: [EMAIL PROTECTED]
Subject: RE: Double loading when loading servlet on startup
   
   
Got the same problem :(( (on v3.2.3 - NT)
   
-Message d'origine-
De : Alexander Cherinko [mailto:[EMAIL PROTECTED]]
Envoye : mercredi 8 aout 2001 16:38
A : [EMAIL PROTECTED]
Objet : Double loading when loading servlet on startup
   
   
Hi
problem is that when I mark servlets as load-on-startup they
are loaded
twice in jvm.
I want this servlet to serve as initializer i.e. to
initialize some other
classes in its init method.
The worst is that that classes are double loaded too. I.e. I
want to init
class which is Thread subclass to perform periodical 
  custom action. As
result I have double threads running in jvm and making the
same things! That
was obviousely not my real intention.
From the other hand when I launch that initializer from
common servlet (not
loaded on startup) the problem is not present.
The most strange thing about it is that in both cases all
classes are loaded
with the same ClassLoader.
I cannot understand is it a bug or just I don't 
  understand something.
Please help.
--Che
   
  
  
 



Double loading when loading servlet on startup

2001-08-08 Thread Alexander Cherinko

Hi
problem is that when I mark servlets as load-on-startup they are loaded
twice in jvm.
I want this servlet to serve as initializer i.e. to initialize some other
classes in its init method.
The worst is that that classes are double loaded too. I.e. I want to init
class which is Thread subclass to perform periodical custom action. As
result I have double threads running in jvm and making the same things! That
was obviousely not my real intention.
From the other hand when I launch that initializer from common servlet (not
loaded on startup) the problem is not present.
The most strange thing about it is that in both cases all classes are loaded
with the same ClassLoader.
I cannot understand is it a bug or just I don't understand something.
Please help.
--Che




Re: Double loading when loading servlet on startup

2001-08-08 Thread Mike McGuinness

What version of tomcat?

Alexander Cherinko wrote:

 Hi
 problem is that when I mark servlets as load-on-startup they are loaded
 twice in jvm.
 I want this servlet to serve as initializer i.e. to initialize some other
 classes in its init method.
 The worst is that that classes are double loaded too. I.e. I want to init
 class which is Thread subclass to perform periodical custom action. As
 result I have double threads running in jvm and making the same things! That
 was obviousely not my real intention.
 From the other hand when I launch that initializer from common servlet (not
 loaded on startup) the problem is not present.
 The most strange thing about it is that in both cases all classes are loaded
 with the same ClassLoader.
 I cannot understand is it a bug or just I don't understand something.
 Please help.
 --Che





RE: Double loading when loading servlet on startup

2001-08-08 Thread Loc Lefvre

Got the same problem :(( (on v3.2.3 - NT)

-Message d'origine-
De : Alexander Cherinko [mailto:[EMAIL PROTECTED]]
Envoye : mercredi 8 aout 2001 16:38
A : [EMAIL PROTECTED]
Objet : Double loading when loading servlet on startup


Hi
problem is that when I mark servlets as load-on-startup they are loaded
twice in jvm.
I want this servlet to serve as initializer i.e. to initialize some other
classes in its init method.
The worst is that that classes are double loaded too. I.e. I want to init
class which is Thread subclass to perform periodical custom action. As
result I have double threads running in jvm and making the same things! That
was obviousely not my real intention.
From the other hand when I launch that initializer from common servlet (not
loaded on startup) the problem is not present.
The most strange thing about it is that in both cases all classes are loaded
with the same ClassLoader.
I cannot understand is it a bug or just I don't understand something.
Please help.
--Che




RE: Double loading when loading servlet on startup

2001-08-08 Thread Larry Isaacs

In the past, the cases of double loading I've seen have all been
because an auto-loaded context (created by AutoSetup from the
webapps directory) was also manually loaded as a second context, i.e.

Context path=/othercontext 
 docBase=webapps/examples  ...

Each context gets its own instance of servlets.  As a result,
init() is called twice, once for each context.

There isn't enough information below to tell if this is the
source of the double-loading.

Cheers,
Larry

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 08, 2001 12:32 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Double loading when loading servlet on startup
 
 
 Got the same problem :(( (on v3.2.3 - NT)
 
 -Message d'origine-
 De : Alexander Cherinko [mailto:[EMAIL PROTECTED]]
 Envoye : mercredi 8 aout 2001 16:38
 A : [EMAIL PROTECTED]
 Objet : Double loading when loading servlet on startup
 
 
 Hi
 problem is that when I mark servlets as load-on-startup they 
 are loaded
 twice in jvm.
 I want this servlet to serve as initializer i.e. to 
 initialize some other
 classes in its init method.
 The worst is that that classes are double loaded too. I.e. I 
 want to init
 class which is Thread subclass to perform periodical custom action. As
 result I have double threads running in jvm and making the 
 same things! That
 was obviousely not my real intention.
 From the other hand when I launch that initializer from 
 common servlet (not
 loaded on startup) the problem is not present.
 The most strange thing about it is that in both cases all 
 classes are loaded
 with the same ClassLoader.
 I cannot understand is it a bug or just I don't understand something.
 Please help.
 --Che
 



RE: Double loading when loading servlet on startup

2001-08-08 Thread Alexander Cherinko

3.2.1 on NT/Linux.
I had the same problem on earlier versions.
And Loic Lefevre [[EMAIL PROTECTED]] has got the same on NT with v.3.2.3.
--Che

 -Original Message-
 From: Mike McGuinness [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 08, 2001 7:14 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Double loading when loading servlet on startup
 
 
 What version of tomcat?
 
 Alexander Cherinko wrote:
 
  Hi
  problem is that when I mark servlets as load-on-startup they are loaded
  twice in jvm.
  I want this servlet to serve as initializer i.e. to initialize 
 some other
  classes in its init method.
  The worst is that that classes are double loaded too. I.e. I 
 want to init
  class which is Thread subclass to perform periodical custom action. As
  result I have double threads running in jvm and making the same 
 things! That
  was obviousely not my real intention.
  From the other hand when I launch that initializer from common 
 servlet (not
  loaded on startup) the problem is not present.
  The most strange thing about it is that in both cases all 
 classes are loaded
  with the same ClassLoader.
  I cannot understand is it a bug or just I don't understand something.
  Please help.
  --Che
 
 
 



RE: Double loading when loading servlet on startup

2001-08-08 Thread Alexander Cherinko

The case:

Nt/Linux v3.2.1,2,3.
There is one context:
Context path=/ts
 docBase=webapps/ts
 crossContext=true
 debug=1
 reloadable=true(or false)
 trusted=false 
/Context

The web.xml piece for this context
servlet
servlet-nameLoader/servlet-name
servlet-classLoader/servlet-class
load-on-startup1/load-on-startup
/servlet

jdb shows double classes named Loader loaded with different instances of
org.apache.tomcat.loader.AdaptiveClassLoader12 which have generation field 2
and 4 correspondingly. If I call

Class.forName(MyClass)

in init method of servlet and MyClass is subclass of thread I have double
threads. And so on.
gc gets nothing and trying to interrupt threads in servlet's destroy method
gets nothing as well.

And this occurs only when servlet is marked as load-on-startup. For ordinary
servlet there is nothing like this.

--Che


 -Original Message-
 From: Larry Isaacs [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 08, 2001 7:58 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Double loading when loading servlet on startup


 In the past, the cases of double loading I've seen have all been
 because an auto-loaded context (created by AutoSetup from the
 webapps directory) was also manually loaded as a second context, i.e.

 Context path=/othercontext
  docBase=webapps/examples  ...

 Each context gets its own instance of servlets.  As a result,
 init() is called twice, once for each context.

 There isn't enough information below to tell if this is the
 source of the double-loading.

 Cheers,
 Larry

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 08, 2001 12:32 PM
  To: [EMAIL PROTECTED]
  Subject: RE: Double loading when loading servlet on startup
 
 
  Got the same problem :(( (on v3.2.3 - NT)
 
  -Message d'origine-
  De : Alexander Cherinko [mailto:[EMAIL PROTECTED]]
  Envoye : mercredi 8 aout 2001 16:38
  A : [EMAIL PROTECTED]
  Objet : Double loading when loading servlet on startup
 
 
  Hi
  problem is that when I mark servlets as load-on-startup they
  are loaded
  twice in jvm.
  I want this servlet to serve as initializer i.e. to
  initialize some other
  classes in its init method.
  The worst is that that classes are double loaded too. I.e. I
  want to init
  class which is Thread subclass to perform periodical custom action. As
  result I have double threads running in jvm and making the
  same things! That
  was obviousely not my real intention.
  From the other hand when I launch that initializer from
  common servlet (not
  loaded on startup) the problem is not present.
  The most strange thing about it is that in both cases all
  classes are loaded
  with the same ClassLoader.
  I cannot understand is it a bug or just I don't understand something.
  Please help.
  --Che
 





RE: Double loading when loading servlet on startup

2001-08-08 Thread Larry Isaacs

I tried this scenario with Tomcat 3.2.1 and I only get one call
to init().  Are you on Windows?  If your ts directory is actually
named Ts, I think you would get two context's.  What does your
tomcat log show about contexts being added?

Larry

 -Original Message-
 From: Alexander Cherinko [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 08, 2001 1:51 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Double loading when loading servlet on startup
 
 
 The case:
 
 Nt/Linux v3.2.1,2,3.
 There is one context:
 Context path=/ts
  docBase=webapps/ts
  crossContext=true
  debug=1
  reloadable=true(or false)
  trusted=false 
 /Context
 
 The web.xml piece for this context
 servlet
   servlet-nameLoader/servlet-name
   servlet-classLoader/servlet-class
   load-on-startup1/load-on-startup
 /servlet
 
 jdb shows double classes named Loader loaded with different 
 instances of
 org.apache.tomcat.loader.AdaptiveClassLoader12 which have 
 generation field 2
 and 4 correspondingly. If I call
 
 Class.forName(MyClass)
 
 in init method of servlet and MyClass is subclass of thread I 
 have double
 threads. And so on.
 gc gets nothing and trying to interrupt threads in servlet's 
 destroy method
 gets nothing as well.
 
 And this occurs only when servlet is marked as 
 load-on-startup. For ordinary
 servlet there is nothing like this.
 
 --Che
 
 
  -Original Message-
  From: Larry Isaacs [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, August 08, 2001 7:58 PM
  To: '[EMAIL PROTECTED]'
  Subject: RE: Double loading when loading servlet on startup
 
 
  In the past, the cases of double loading I've seen have all been
  because an auto-loaded context (created by AutoSetup from the
  webapps directory) was also manually loaded as a second 
 context, i.e.
 
  Context path=/othercontext
   docBase=webapps/examples  ...
 
  Each context gets its own instance of servlets.  As a result,
  init() is called twice, once for each context.
 
  There isn't enough information below to tell if this is the
  source of the double-loading.
 
  Cheers,
  Larry
 
   -Original Message-
   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, August 08, 2001 12:32 PM
   To: [EMAIL PROTECTED]
   Subject: RE: Double loading when loading servlet on startup
  
  
   Got the same problem :(( (on v3.2.3 - NT)
  
   -Message d'origine-
   De : Alexander Cherinko [mailto:[EMAIL PROTECTED]]
   Envoye : mercredi 8 aout 2001 16:38
   A : [EMAIL PROTECTED]
   Objet : Double loading when loading servlet on startup
  
  
   Hi
   problem is that when I mark servlets as load-on-startup they
   are loaded
   twice in jvm.
   I want this servlet to serve as initializer i.e. to
   initialize some other
   classes in its init method.
   The worst is that that classes are double loaded too. I.e. I
   want to init
   class which is Thread subclass to perform periodical 
 custom action. As
   result I have double threads running in jvm and making the
   same things! That
   was obviousely not my real intention.
   From the other hand when I launch that initializer from
   common servlet (not
   loaded on startup) the problem is not present.
   The most strange thing about it is that in both cases all
   classes are loaded
   with the same ClassLoader.
   I cannot understand is it a bug or just I don't 
 understand something.
   Please help.
   --Che
  
 
 



Tomcat-servlet at startup

2001-07-10 Thread Lakshminarayanan Ramakrishnan
Title: Tomcat-servlet at startup






Hi


Tomcat loads the servlet class at startup, as far as my knowledge goes it functions properly, but when i look into tomcat.log, 

it is something like this, pls look at the the highlighted text, it says null, what does it mean?, and moreover, two contexts are present one empty and the other /root

2001-07-10 08:50:16 - Ctx( /examples ): Add context

2001-07-10 08:50:16 - ContextManager: Adding context Ctx( /examples )

2001-07-10 08:50:17 - Ctx( /admin ): Add context

2001-07-10 08:50:17 - ContextManager: Adding context Ctx( /admin )

2001-07-10 08:50:17 - Ctx( /root ): Add context

2001-07-10 08:50:17 - ContextManager: Adding context Ctx( /root )

2001-07-10 08:50:17 - ContextManager: Engine init

2001-07-10 08:50:17 - Ctx( ): Add context

2001-07-10 08:50:17 - ContextManager: Adding context Ctx( )

2001-07-10 08:50:17 - Ctx( /test ): Add context

2001-07-10 08:50:17 - ContextManager: Adding context Ctx( /test )

2001-07-10 08:50:17 - Ctx( /examples ): Context Init 

2001-07-10 08:50:17 - Ctx( /examples ): Pre servlet init jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /examples ): Post servlet init jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /admin ): Context Init 

2001-07-10 08:50:17 - Ctx( /admin ): Pre servlet init jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /admin ): Post servlet init jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /root ): Context Init 

2001-07-10 08:50:17 - Ctx( /root ): Removing duplicate servlet jsp jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /root ): Removing duplicate *.jsp - jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /root ): Pre servlet init HangFung(JWLStartUp.JWLLoadDefaults/null)

2001-07-10 08:50:17 - Ctx( /root ): Post servlet init HangFung(JWLStartUp.JWLLoadDefaults/null)

2001-07-10 08:50:17 - Ctx( ): Context Init 

2001-07-10 08:50:17 - Ctx( ): Removing duplicate servlet jsp jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( ): Removing duplicate *.jsp - jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( ): Pre servlet init HangFung(JWLStartUp.JWLLoadDefaults/null)

2001-07-10 08:50:17 - Ctx( ): Post servlet init HangFung(JWLStartUp.JWLLoadDefaults/null)

2001-07-10 08:50:17 - Ctx( /test ): Context Init 

2001-07-10 08:50:17 - Ctx( /test ): Pre servlet init jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:17 - Ctx( /test ): Post servlet init jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 08:50:19 - PoolTcpConnector: Starting HttpConnectionHandler on 8080

2001-07-10 08:50:19 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007

2001-07-10 09:05:13 - ContextManager: Removing context Ctx( /examples )

2001-07-10 09:05:13 - Ctx( /examples ): Remove context

2001-07-10 09:05:13 - Ctx( /examples ): Pre servlet destroy jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 09:05:13 - Ctx( /examples ): Post servlet destroy jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 09:05:13 - Ctx( /examples ): Context Shutdown 

2001-07-10 09:05:13 - ContextManager: Removing context Ctx( /admin )

2001-07-10 09:05:13 - Ctx( /admin ): Remove context

2001-07-10 09:05:13 - Ctx( /admin ): Pre servlet destroy jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 09:05:13 - Ctx( /admin ): Post servlet destroy jsp(org.apache.jasper.servlet.JspServlet/null)

2001-07-10 09:05:13 - Ctx( /admin ): Context Shutdown 


thanx in adv


Lax





RE: Unable to load servlet on startup ??

2001-02-06 Thread Michael Wentzel

Also, if you want to debug the startup of your servlet you can
do whatever you want(i.e. debug output) in your servlets init() method.

This is the method that gets called when a servlet is instantiated.
Utilize it like you would a constructor.

---
Michael Wentzel
Software Developer
Software As We Think - http://www.aswethink.com
mailto:[EMAIL PROTECTED]

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




Unable to load servlet on startup ??

2001-02-05 Thread Srinivas Kurella
Title:  Unable to load servlet on startup ??






Hi,


I am trying to use Tomcat in a standalone mode. I have a working application under jrun and am trying to move it to
Tomcat. I am trying to use my existing directory structure and hence am not using the /webapps/ path.
I have a servlet which i need to load on startup. This servlet reads a properties files. I have this information (load-on-startup and param name/value) in the web.xml file in the conf directory. I have added a context /context block in the server.xml file.

I have all the necessary jars and class files in the CLASSPATH.


However, when tomcat starts , i don't think the servlet is being loaded. How do i check if the servlet is loaded ?? What am i doing wrong ??

I donot see any errors in the log files.


Any help is appreciated.


Srini





RE: Unable to load servlet on startup ??

2001-02-05 Thread Stefan Langer



If you 
are using tomcat 3.2.1 or higher you have to move the web.xml file to the 
WEB-INF directory of your webapp since tomcat 3.2/.1 ignores the web.xml in the 
conf directory.

Stefan


RE: Unable to load servlet on startup ??

2001-02-05 Thread Srinivas Kurella



thanks 
for the reply. 
So how 
do i use the WEB-ING directory without putting my app under webapps 
??

Srini

  -Original Message-From: Stefan Langer 
  [mailto:[EMAIL PROTECTED]]Sent: Monday, February 05, 2001 4:02 
  PMTo: [EMAIL PROTECTED]Subject: RE: Unable 
  to load servlet on startup ??
  If 
  you are using tomcat 3.2.1 or higher you have to move the web.xml file to the 
  WEB-INF directory of your webapp since tomcat 3.2/.1 ignores the web.xml in 
  the conf directory.
  
  Stefan


RE: Unable to load servlet on startup ??

2001-02-05 Thread Stefan Langer



Sorry 
for the confusion but with webapp I actually ment your webapplication. The 
WEB-INF directory goes in the root folder of your webapplication. 

Example:

Suppose you have a webapplication called foo and you have added a context 
for it to server.xml similar to this

Context path="/foo" 
 
docBase="/base directory of your application/" 
 
crossContext="false" 
debug="0" 
 
reloadable="false"   
/Context

THe 
WEB-INF directory would be located at

/base 
directory of your application/WEB-INF

and in 
this directory you drop your web.xml file.

Hope 
that helps

Stefan


loading servlet on startup

2000-12-04 Thread Chris Huisman

Hello,

How do I go about loading a sevlet on startup?  I know this is probably on
the FAQ page, but unfortunately I am unable to get onto the faq page at the
moment.  ANy help would be great.

thanks,
Chris.