You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jaroslav Záruba <ja...@gmail.com> on 2005/04/02 20:58:00 UTC

context path/URL only from request?

Hello

I've been looking for a way how to obtain ServletContext pah/URL
without a request; eventually I've found thius reply in the Tomcat
mail-archive claiming it is not possible:
http://www.servlets.com/archive/servlet/ReadMsg?msgId=69529&listName=tomcat-user

It was 5yrs ago and I wonder whether it is still true (or whether Sun
has considered this to be a "missing feature")?
(If it is still true I'd guess it's because of keeping
server-dependant stuff from webapp code. Is that right?)

Regards
  Jaroslav Záruba
  Czech Republic

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Andrew Miehs <an...@2sheds.de>.
how about running tcpdump on the box to see what it is doing when you 
start tomcat?

Andrew

On Apr 4, 2005, at 5:46 PM, Michael Mehrle wrote:

> You guys might be on to something - on my development machine it's 
> taking only 25 seconds or so (identical code, tomcat version, and 
> mysql installation). Question is: how do I fix a possible DNS lookup 
> problem?
>
>
> ----- Original Message ----- From: "Andrew Miehs" <an...@2sheds.de>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, April 04, 2005 2:02 AM
> Subject: Re: Tomcat taking 125 seconds to launch
>
>
>> hmm - sounds like a dns lookup causing a problem....
>>
>> Andrew
>>
>> On Apr 4, 2005, at 11:03 AM, t.n.a. wrote:
>>
>>> Michael Mehrle wrote:
>>>
>>>> The configuration is a modified version of appfuse 1.5 (struts and 
>>>> hibernate) - so this should give you a good idea of how it is 
>>>> structured. FYI: on my development machine here at home Tomcat 
>>>> starts in 28 seconds - identical project and configuration.
>>>
>>> A fairly long time, any way you cut it. It takes about 6-9s on my 
>>> Athlon 1900+ (using JDK 1.5), and a couple of seconds more on my 
>>> laptop (even though the laptop has a 2.8GHz P4!, but runs blackdawn 
>>> jdk 1.4).
>>> Just a wild guess, but it seemes to me that you have a 2-minute 
>>> timeout on something, and than tomcat normally loads in 5-6s.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Jason Bainbridge <jb...@gmail.com>.
On Apr 4, 2005 10:46 AM, Michael Mehrle <mi...@datasaur.com> wrote:
> 
> You guys might be on to something - on my development machine it's taking
> only 25 seconds or so (identical code, tomcat version, and mysql
> installation). Question is: how do I fix a possible DNS lookup problem?
> 

Check your /etc/hosts file you should have something like:

 127.0.0.1 <http://127.0.0.1> www.yourdomain.com
<http://www.yourdomain.com>localhost

I've also heard of smilar problems related to IPv6 but can't recall what 
they were.

Regards,
-- 
Jason Bainbridge
http://kde.org - webmaster@kde.org
Personal Site - http://jasonbainbridge.com

Re: Tomcat taking 125 seconds to launch

Posted by Michael Mehrle <mi...@datasaur.com>.
You guys might be on to something - on my development machine it's taking 
only 25 seconds or so (identical code, tomcat version, and mysql 
installation). Question is: how do I fix a possible DNS lookup problem?


----- Original Message ----- 
From: "Andrew Miehs" <an...@2sheds.de>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, April 04, 2005 2:02 AM
Subject: Re: Tomcat taking 125 seconds to launch


> hmm - sounds like a dns lookup causing a problem....
>
> Andrew
>
> On Apr 4, 2005, at 11:03 AM, t.n.a. wrote:
>
>> Michael Mehrle wrote:
>>
>>> The configuration is a modified version of appfuse 1.5 (struts and 
>>> hibernate) - so this should give you a good idea of how it is 
>>> structured. FYI: on my development machine here at home Tomcat starts in 
>>> 28 seconds - identical project and configuration.
>>
>> A fairly long time, any way you cut it. It takes about 6-9s on my Athlon 
>> 1900+ (using JDK 1.5), and a couple of seconds more on my laptop (even 
>> though the laptop has a 2.8GHz P4!, but runs blackdawn jdk 1.4).
>> Just a wild guess, but it seemes to me that you have a 2-minute timeout 
>> on something, and than tomcat normally loads in 5-6s.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Andrew Miehs <an...@2sheds.de>.
hmm - sounds like a dns lookup causing a problem....

Andrew

On Apr 4, 2005, at 11:03 AM, t.n.a. wrote:

> Michael Mehrle wrote:
>
>> The configuration is a modified version of appfuse 1.5 (struts and 
>> hibernate) - so this should give you a good idea of how it is 
>> structured. FYI: on my development machine here at home Tomcat starts 
>> in 28 seconds - identical project and configuration.
>
> A fairly long time, any way you cut it. It takes about 6-9s on my 
> Athlon 1900+ (using JDK 1.5), and a couple of seconds more on my 
> laptop (even though the laptop has a 2.8GHz P4!, but runs blackdawn 
> jdk 1.4).
> Just a wild guess, but it seemes to me that you have a 2-minute 
> timeout on something, and than tomcat normally loads in 5-6s.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by "t.n.a." <tn...@sharanet.org>.
Michael Mehrle wrote:

> The configuration is a modified version of appfuse 1.5 (struts and 
> hibernate) - so this should give you a good idea of how it is 
> structured. FYI: on my development machine here at home Tomcat starts 
> in 28 seconds - identical project and configuration.

A fairly long time, any way you cut it. It takes about 6-9s on my Athlon 
1900+ (using JDK 1.5), and a couple of seconds more on my laptop (even 
though the laptop has a 2.8GHz P4!, but runs blackdawn jdk 1.4).
Just a wild guess, but it seemes to me that you have a 2-minute timeout 
on something, and than tomcat normally loads in 5-6s.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Michael Mehrle <mi...@datasaur.com>.
Okay, what exactly do you guys need?

----- Original Message ----- 
From: "Remy Maucherat" <re...@gmail.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Sunday, April 03, 2005 2:09 PM
Subject: Re: Tomcat taking 125 seconds to launch



You didn't post anything really relevant, but maybe it could be caused
by the port binding (for some reason).

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Remy Maucherat <re...@gmail.com>.
On Apr 3, 2005 11:04 PM, Michael Mehrle <mi...@datasaur.com> wrote:
> Hi Mark:
> 
> Okay, the machine is a P4, 1GB RAM (512MB assigned to tomcat), and besides
> Tomcat 5.5.9, there's Apache running and mysql. Apache is not in use much. I
> have the apache logging set to WARN, so the slowdown is not due to excessive
> logging.
> 
> The site is running an image gallery and there are probably around 100 jps
> for the gallery and image pages. I am not sure if adding jsps does affect
> the startup time.
> 
> The configuration is a modified version of appfuse 1.5 (struts and
> hibernate) - so this should give you a good idea of how it is structured.
> FYI: on my development machine here at home Tomcat starts in 28 seconds -
> identical project and configuration.
> 
> Any help would be greatly appreciated - if you need any configuration files,
> just ask and I'll email them to you.

You didn't post anything really relevant, but maybe it could be caused
by the port binding (for some reason).

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Michael Mehrle <mi...@datasaur.com>.
Hi Mark:

Okay, the machine is a P4, 1GB RAM (512MB assigned to tomcat), and besides 
Tomcat 5.5.9, there's Apache running and mysql. Apache is not in use much. I 
have the apache logging set to WARN, so the slowdown is not due to excessive 
logging.

The site is running an image gallery and there are probably around 100 jps 
for the gallery and image pages. I am not sure if adding jsps does affect 
the startup time.

The configuration is a modified version of appfuse 1.5 (struts and 
hibernate) - so this should give you a good idea of how it is structured. 
FYI: on my development machine here at home Tomcat starts in 28 seconds - 
identical project and configuration.

Any help would be greatly appreciated - if you need any configuration files, 
just ask and I'll email them to you.

Michael


----- Original Message ----- 
From: "Mark" <el...@gmail.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Sunday, April 03, 2005 1:39 PM
Subject: Re: Tomcat taking 125 seconds to launch


> gonna need more information.   hardware, config files..etc.
>
> On Apr 2, 2005 6:42 PM, Michael Mehrle <mi...@datasaur.com> wrote:
>> I just installed tomcat 5.5.9 on Fedora FC3 and it's suddenly taking a 
>> long
>> amount of time to launch - 125 seconds to be exact!
>>
>> INFO: Starting Coyote HTTP/1.1 on http-8080
>> Apr 2, 2005 6:39:00 PM org.apache.jk.common.ChannelSocket init
>> INFO: JK: ajp13 listening on /0.0.0.0:8009
>> Apr 2, 2005 6:39:00 PM org.apache.jk.server.JkMain start
>> INFO: Jk running ID=0 time=0/364  config=null
>> Apr 2, 2005 6:39:00 PM org.apache.catalina.storeconfig.StoreLoader load
>> INFO: Find registry server-registry.xml at classpath resource
>> Apr 2, 2005 6:39:00 PM org.apache.catalina.startup.Catalina start
>> INFO: Server startup in 125430 ms
>>
>> I didn't have this problem before - does anyone experience the same 
>> delay?
>> It's also looking a bit more sluggish... Any input would be greatly
>> appreciated.
>>
>> Michael
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat taking 125 seconds to launch

Posted by Mark <el...@gmail.com>.
gonna need more information.   hardware, config files..etc.

On Apr 2, 2005 6:42 PM, Michael Mehrle <mi...@datasaur.com> wrote:
> I just installed tomcat 5.5.9 on Fedora FC3 and it's suddenly taking a long
> amount of time to launch - 125 seconds to be exact!
> 
> INFO: Starting Coyote HTTP/1.1 on http-8080
> Apr 2, 2005 6:39:00 PM org.apache.jk.common.ChannelSocket init
> INFO: JK: ajp13 listening on /0.0.0.0:8009
> Apr 2, 2005 6:39:00 PM org.apache.jk.server.JkMain start
> INFO: Jk running ID=0 time=0/364  config=null
> Apr 2, 2005 6:39:00 PM org.apache.catalina.storeconfig.StoreLoader load
> INFO: Find registry server-registry.xml at classpath resource
> Apr 2, 2005 6:39:00 PM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 125430 ms
> 
> I didn't have this problem before - does anyone experience the same delay?
> It's also looking a bit more sluggish... Any input would be greatly
> appreciated.
> 
> Michael
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Tomcat taking 125 seconds to launch

Posted by Michael Mehrle <mi...@datasaur.com>.
I just installed tomcat 5.5.9 on Fedora FC3 and it's suddenly taking a long 
amount of time to launch - 125 seconds to be exact!

INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 2, 2005 6:39:00 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 2, 2005 6:39:00 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/364  config=null
Apr 2, 2005 6:39:00 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Apr 2, 2005 6:39:00 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 125430 ms

I didn't have this problem before - does anyone experience the same delay? 
It's also looking a bit more sluggish... Any input would be greatly 
appreciated.

Michael 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: context path/URL only from request?

Posted by Tim Funk <fu...@joedog.org>.
As it was 5 years ago ... its the same today.

-Tim

Jaroslav Záruba wrote:
> Hello
> 
> I've been looking for a way how to obtain ServletContext pah/URL
> without a request; eventually I've found thius reply in the Tomcat
> mail-archive claiming it is not possible:
> http://www.servlets.com/archive/servlet/ReadMsg?msgId=69529&listName=tomcat-user
> 
> It was 5yrs ago and I wonder whether it is still true (or whether Sun
> has considered this to be a "missing feature")?
> (If it is still true I'd guess it's because of keeping
> server-dependant stuff from webapp code. Is that right?)
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: connection pooling basic help please

Posted by QM <qm...@brandxdev.net>.
On Sat, Apr 02, 2005 at 08:21:24PM +0100, Krishnakant Mane wrote:
: the example in tomcat documentation is on a jsp based
: applicatio.  but I don't understand how I use a pooled
: connection in a servlet.
: [snip]
: should I initialise the connection in the Init method?
:  how and when should I close the connection?


1/ please post a *new* message when writing to the list.  Replying to
an old (unrelated) message confuses thread-aware mailers, which makes
your question harder to find (and thus answer).


2/ I don't have the JSP sample in front of me, but there should be
plenty of examples of using a DataSource out on the web.  A little
Googling should turn them up.  The short version is:
 - perform a JNDI lookup to find the DataSource
 - pull a Connection from that data source
 - use the Connection to talk with a databse
 - call close() on that connection

You should hold on to the Connection for as short a period of time as
possible.  This is easier to manage if all of the database calls are
done from a particular set of objects (a data layer).

Having all of your components do the JNDI lookup, etc can get messy and
tough to maintain.  Isolate all of your data calls to a separate object
(or set of objects).  You could initialize these objects in a
ServletContextListener and either store them under Application scope or
in a singleton such that they would be globally available.

-QM


-- 
software   -- http://www.brandxdev.net/
tech news  -- http://www.RoarNetworX.com/
code scan  -- http://www.JxRef.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: connection pooling basic help please

Posted by Kwok Peng Tuck <pe...@gmail.com>.
Krishnakant Mane wrote:

>hello,
>I refered to the docs in tomcat 5 for connection
>pooling.  the document is pritty comprehencive and I
>understood the server.xml part of it.
>but now I want to know how exactly can I use a
>connection from the pool in my servlet.
>the example in tomcat documentation is on a jsp based
>applicatio.  but I don't understand how I use a pooled
>connection in a servlet.
>  
>
You use a pooled connection in a simillar manner to a driver managed 
connection, except that you look up a resource (JNDI in this case). In 
your servlet just look up the resource.

>should I initialise the connection in the Init method?
> how and when should I close the connection?
>  
>
You should close the connection immediately when you are done with it. 
Best not to pass references of them around. You would close them as a 
you would in a driver managed connection, that is Connection.close() ;

>and wat entries in the web.xml file will effect
>connection pooling?
>  
>
>Please help it is really urgent.
>thanks
>Krishnakant.
>
>Send instant messages to your online friends http://uk.messenger.yahoo.com 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


connection pooling basic help please

Posted by Krishnakant Mane <co...@yahoo.co.uk>.
hello,
I refered to the docs in tomcat 5 for connection
pooling.  the document is pritty comprehencive and I
understood the server.xml part of it.
but now I want to know how exactly can I use a
connection from the pool in my servlet.
the example in tomcat documentation is on a jsp based
applicatio.  but I don't understand how I use a pooled
connection in a servlet.
should I initialise the connection in the Init method?
 how and when should I close the connection?
and wat entries in the web.xml file will effect
connection pooling?
Please help it is really urgent.
thanks
Krishnakant.

Send instant messages to your online friends http://uk.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org