RE: still not clear with connection pooling in tomcat

2005-04-02 Thread Guy Katz
everything you need is here:
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html

-Original Message-
From: Krishnakant Mane [mailto:[EMAIL PROTECTED]
Sent: Sunday, April 03, 2005 7:05 AM
To: tomcat-user@jakarta.apache.org
Subject: still not clear with connection pooling in tomcat


hello all,
I am still a bit confused on the pooling issue in
tomcat.
I will be very happy if some one could explain
connection pooling with reference to my problems
listed below.
1. there are the jakarta commons libraries like the
dbcp etc in the catalina/common/lib directory.  how do
I take advantage of these libraries to use pooled
connections?  Wat I mean is that I found some
resources on google which did explain connection
pooling but those articles tryed to use some other
methods.  I know how to setup the tags in server.xml
but don't know what to do in a servlet and where to do
it after the commons jars are made available.
2. there were two tags in server.xml out of which one
is for the maximum pool of connections eg 100 500 etc.
 and the other tag is related to innactive
connections.  can some one explain? I am confused with
these two tags.
3. right now I am not using connection pooling and I
am opening connections in the init methods of my
servlets.  what changes should I make in my servlets
after a connection pool is established?
4. where should I initialise the context and lookup
the connection from the data source?
I will be happy if some one gives an example of just
the code snippad of using a pooled connection in a
servlet.
thanks
Krishnakant. 


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

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


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



still not clear with connection pooling in tomcat

2005-04-02 Thread Krishnakant Mane
hello all,
I am still a bit confused on the pooling issue in
tomcat.
I will be very happy if some one could explain
connection pooling with reference to my problems
listed below.
1. there are the jakarta commons libraries like the
dbcp etc in the catalina/common/lib directory.  how do
I take advantage of these libraries to use pooled
connections?  Wat I mean is that I found some
resources on google which did explain connection
pooling but those articles tryed to use some other
methods.  I know how to setup the tags in server.xml
but don't know what to do in a servlet and where to do
it after the commons jars are made available.
2. there were two tags in server.xml out of which one
is for the maximum pool of connections eg 100 500 etc.
 and the other tag is related to innactive
connections.  can some one explain? I am confused with
these two tags.
3. right now I am not using connection pooling and I
am opening connections in the init methods of my
servlets.  what changes should I make in my servlets
after a connection pool is established?
4. where should I initialise the context and lookup
the connection from the data source?
I will be happy if some one gives an example of just
the code snippad of using a pooled connection in a
servlet.
thanks
Krishnakant. 


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

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



[Way off topic] Getting MSOutlook calendar to interface with Tomcat-served data

2005-04-02 Thread Rob Hunt
I'd like to serve calendar/event info to the calendar in MS Outlook (or is that 
LookOUT!?).  I know that it's possible to create output that can be 
"statically" imported, but I'd like to make it as easy as possible to 
periodically/on-demand synchronize Outlook with a Tomcat server.



Tomcat taking 125 seconds to launch

2005-04-02 Thread Michael Mehrle
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: context path/URL only from request?

2005-04-02 Thread Tim Funk
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Configuring Manager for different Virtual Hosts

2005-04-02 Thread John B. Moore
Folks,
  I got it working finally...(after several days of repeated head 
banging..) 

Following is how I got it to work (Tomcat 4.1.29)..
  1) Copy the folder 

  $CATALINA_HOME/server/webapps/manager
..to the directory that contains your web application..
Example:
 $CATALINA_HOME = /usr/local/tomcat
 ..copy folder /usr/local/tomcat/server/webapps/manager to 
/usr/local/tomcat/webapps/somesubdirectory/

  2) Copy the manager.xml found in the main webapps directory:
$CATALINA_HOME/webapps/manager.xml
...to the same directory that you copied the manager folder..
  3) Edit manager.xml
 Change the "docBase" attribute to reflect the location copied to 
above..

Example:
 docBase="/usr/local/tomcat/webapps/somesubdirectory/manager"
  4) Edit either your mod_jk.conf file or the specific copy for that 
host.   (here I keep a custom conf file for each host, with the name of 
that host.conf)  This is the same file or files that you "include" in 
the Apache httpd.conf file   (There may be other ways around this, but 
this is the way I did it..)

  a) Open the mod_jk.conf file (after Tomcat has be started at 
least once if you have AutoConfig on..) and find the localhost:/manager 
section.  Copy this entire section to the end of the JkMount commands..

  b) Paste this section into each VirtualHost setting (possibly a 
different .conf file..)

  c) Edit the Alias and Directory tags to reflect the same full 
path to the manager folder..

 5) Make sure you have setup the role "manager" in the tomcat_users.xml 
file and a user for that role. (Instructions in the Manager HowTo)

 6) Restart Tomcat
 7) Access manager via a browser at
  http://your.domainhere.com:8080/manager/html
 (I have yet to get it to load directly through Apache yet..  for my 
purposes this is fine and works for me..)

  Hope that helps someone...
  John Moore
  SonicSpider LLC
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: connection pooling basic help please

2005-04-02 Thread QM
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: session management

2005-04-02 Thread Jagadeesha T
Hi, Thanks the reply,
 My requirement is little different.
I want to have many browser instaces (2 or more)to use the same session.
In my first.jsp, on first hit, i will get the session and store it.
Again,if the first jsp is hit for the second time. It should use the
same session. SO, I will not let it allow to create a new one. Instead use the 
one already stored for user.
I have to do like this since the user login is done from a Java 
Applacition(Swing).
If the user wants to go to a browser. User has to click on the button (Swing 
UI) that will launch the 
browser. each click on the button should launch a browser.
I want all those browsers launched for that login to use a shared session 
object.
Could you tell How can I do it.
I tried by setting the cookie at the first.jsp when the second browser 
launch(Coolke which had created at the 
first
hit).
addCookie,
  In one of the middle jsps, there is 
  response.sendRedirect(response.encodeURL("samepage?somename=somevalue"))
 Every time,it is failing here, response.sendRedirect();
 //When it is reloaded i have observerd that it is not getting the cookie in 
the headers.
 I don't understand why the browser not sending the cookie. cookie is not 
disabled.
 
Scenario 2.
If all browser uses different session objects. then it works fine.
 
could you tell me is there any way to get this done?
Thanks,
Jagadish


 

Lionel Farbos <[EMAIL PROTECTED]> wrote:
On Thu, 31 Mar 2005 11:41:55 -0800 (PST)
Jagadeesha T wrote:

> Hi all,
> I want to set session in httpservletresponse object, Is there 
> any way to do it.
> Otherthan response.addCookie(), or 
> response.encodeURL();
> Is there any way to set the Jsession In headers, So that it gets that 
> in the next Jsp by request object, 
> If I use addCookie of response object, It fails if any where encodeURL 
> is used. 
> If i user encodeURL, every JSP needs to updated with that method.
> Please if anybody knows tell the way that can be done. 
>
You don't have to create yourself the cookie.
You create the HttpSession with HttpServletRequest.getSession() or 
HttpServletRequest.getSession(boolean)
Then, the session is created and the cookie JSESSIONID is added to the 
HttpServletResponse.
So, the next time you'll invoke a servlet or JSP in the same Context (with the 
same browser),
the Cookie JSESSIONID will be attached to your request.

If you have clustered your Tomcat, the JSESSIONID will have a suffix .,
so, if you use the mod_jk to load-balance your tomcat clustered servers, 
your request will be sent to the same tomcat (as the precedent).

Enjoy

> Thanks,
> Jagadeesha T
> 
> 
> 
> -
> Do you Yahoo!?
> Better first dates. More second dates. Yahoo! Personals 

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



-
Do you Yahoo!?
 Better first dates. More second dates. Yahoo! Personals 

connection pooling basic help please

2005-04-02 Thread Krishnakant Mane
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



context path/URL only from request?

2005-04-02 Thread Jaroslav Záruba
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Configuring Manager for different Virtual Hosts

2005-04-02 Thread John B. Moore
Anto,
   Thanks for replying..  Sadly there must be something else to 
configure..  I did read all the relevant documents and the manager works 
fine for the default "webapps" context.  I added the line you suggested 
to that virtual host.. restarted everything (including Apache)  

  I then type in
  http:// /manager/html
... and Tomcat indicates that such a context does not exist..
  This, in my thinking is understandable, because I have not 
configured  a context IN tomcat (i.e. server.xml) for that Host and that 
is what I think I'm missing.. It is  just can not find any documentation 
to help me on this.. (though I remember seeing a discussion on this 
somewhere..)  I tried to pattern after the default host but because  my 
webapps are "down one more level" in the directory structure the pattern

Alias /usr/local/tomcat/webapps/someapp/../../server/webapps/manager
..does not work..  it parses it to
Alias /usr/local/tomcat/webapps/someapp/../server/webapps/manager
.. which does not exist..
  If you have a momment, please reread my original message that 
explains the configuration of my web applications..  Any ideas would be 
appreciated...

  Thanks again for taking the time to respond..
  John..
Anto Paul wrote:
I have a single line to do it in the VirtualHost
JkMount /manager/* a9
First configure manager application as specified in the Manager how to.
There are some config steps in Tomcat if you have different
CATALINA_BASE for each web application.
 



Loopback Adapter

2005-04-02 Thread dumbQuestionsAsker _
Hi,
Im workin on windows XP and Im using a loopback adapter.
My problem is when my loopback adapter is enable, I can't receive remote 
http requests, that only works when it is disabled.
Any idea about making both working at the same time. ?
thanks by advance.

Best regards.
_
Essayez le nouveau MSN Search : plus performant, plus précis. 
http://search.msn.fr/

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


Re: Cannot get a connection, pool exhausted

2005-04-02 Thread Hassan Schroeder
Koller Krisztian wrote:
Try adding the abandoned connection recovery settings and have it log
them. 
How can I do this?
The FM will help:

:: as will looking at the JavaDoc for commons-dbcp

HTH!
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
  dream.  code.

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


Re: Apache as front-end for several tomcat

2005-04-02 Thread Christophe Lemaire
Hello,
Sorry for the quoting :)
Good idea to test the Virtual hosts! There was a small error... I 
didn't noticed one of the virtual hosts was defined like this :

 ...


And the other ones were defined like this :

 ...

I have fixed this error and now everything is working properly!
Thank you all for your help!
Regards,
Christophe
Here is the config I have used for the test :
On 31-mars-05, at 21:10, Mladen Turk wrote:
Hi,
First of all you will need to learn how to quote ;)
I do not understand what is your question?
First of all make sure your apache configuration is
working for vitual hosts, and then add mod_jk mappings.
The easiest way is to create a simple separate index.html
page for each vitual host and see if that works at the
first place.
Regards,
Mladen
Christophe Lemaire wrote:
Hello,
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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


Re: Debugging tomcat startup

2005-04-02 Thread Larry Meadors
Hey Sasha, I have been wanting to do an iBATIS realm for a while. Glad to 
see I am not alone. ;-)

You have a couple of options.

I use IDEA, and run tomcat externally. When I want to debug startup code, I 
set JPDA_OPTS (in setenv.sh/bat) to this:

JPDA_OPTS="-Xdebug 
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"

Most of that is already there (in tomcat 5.0.27 line 141 of catalina.sh), 
and tells the JVM to start the debugger in server mode using sockets, to 
listen on address 8000, and to suspend immediately, until a debugger 
attaches.

Then, set your breakpoints, and start tomcat using this:

$CATALINA_HOME/bin/catalina.sh jpda start

Once it starts, you can attach, and debug everything starting at the 
beginning.

Java rocks! :-D

Larry

On Apr 1, 2005 12:57 PM, Sasha Borodin <[EMAIL PROTECTED]> wrote:
> 
> I'd like to solicit suggestions for debugging Tomcat startup - 
> specifically
> various class initializations.
> 
> I've written a custom Realm implementation; in it, I use some data access
> classes which use iBatis; these classes work great when used in a web
> application (all jars residing in the apps WEB-INF/lib); but I'm getting
> errors when these classes are initialized from jars in the server/lib
> directory at startup.
> 
> If you have suggestions for how to debug the startup, especially from an 
> IDE
> like Idea, please post. Also, if there are guidelines for where to place
> certain types of jars (common vs. server), please post a link. Right now
> I've got my jdbc jars in common/lib, and my custom Realm and data access
> classes (including ibatis related jars) in server/lib.
> 
> Thanks for your help,
> 
> -Sasha Borodin
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>


Re: Debugging tomcat startup

2005-04-02 Thread Larry Meadors
Realm implementations should go into server/lib.

On Apr 2, 2005 12:16 AM, Anto Paul <[EMAIL PROTECTED]> wrote:
> 
> On Apr 2, 2005 1:27 AM, Sasha Borodin <[EMAIL PROTECTED]> wrote:
> 
> What is the motive to place jars in server/lib. These jars are not
> visible to applications.
>


Re: build problem

2005-04-02 Thread Anto Paul
On Apr 1, 2005 8:52 PM, Fay, Michael <[EMAIL PROTECTED]> wrote:
> I downloaded the latest version of ant. 1.6.2.
> 
> -Original Message-
> From: Antony Paul [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 31, 2005 8:29 PM
> To: Tomcat Users List
> Subject: Re: build problem
> 
> What version of Ant you are using ?. It seems that Ant is not
> supporting the attribute "compression"
> 
> On Apr 1, 2005 3:48 AM, Fay, Michael <[EMAIL PROTECTED]> wrote:
> > I'm sure it's something simple, but I'm getting the following error when I
> > try to build tomcat:
> >
> > BUILD FAILED
> >
> > /home/mfay/jakarta-tomcat-5.5.7-src/build.xml:94: The  task doesn't
> > support the "compression" attribute.
> >
> > I've searched the Jakarta website to see if there was something on this,
> but
> > I haven't found anything. Do I need to make some change to the
> > build.properties or something?
> >
> >
> 
> --
> rgds
> Antony Paul
> http://www.geocities.com/antonypaul24/
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
run Ant with debug enabled or verbose out put enabled to find the
exact element at which it failed.

-- 
Anto Paul
www.benchmarksoft.com

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



RE: Cannot get a connection, pool exhausted

2005-04-02 Thread Koller Krisztian
> Try adding the abandoned connection recovery settings and have it log
them. 

How can I do this?

> If they show in your log as abandoned, then they are not getting closed. 
> Even if you wrote the code as recommended, I have found that it does not 
> always work. I am still chasing the exact details of this and when I get a

> handle on it I will weigh in on it. I think it has to do with the exact 
> ordering in the try catches. For now add these and see what you get. The 
> other questions is if you are getting more request than you have
connections 
> to handle, and how long the code holds the connection. If you are grabbing

> the connection and holding it for a long time in the code, it will not be 
> considered to be abandoned.



> Doug



-- 
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 2004.12.21.
 


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



Re: Installation problem

2005-04-02 Thread Anto Paul
On Apr 2, 2005 3:05 PM, Panagiotis Karvounis <[EMAIL PROTECTED]> wrote:
> I've done all these.
> 
> A msgbox appears informing me about the problem again!It says "Failed
> to install service!Check your settings and permissions!"
> 
> On Apr 1, 2005 11:53 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > 01Apr2005 @ 22:24 Panagiotis Karvounis thusly spake
> > > I am trying to install Tomcat latest version but I have a problem.
> > > During installation a problem about "jvm.dll" occurs!
> > > Can you help me?
> >
> > Try uninstalling tomcat first.
> > If you already have a tomcat installed, you will get this message.
> > Remove the other tomcats, or remove the existing 'jvm.dll' file.
> >
> > hth,
> > Luke
> >
> > --
> >   /  /  _
> >  /_ /_/ /< /=
> >  0421 276 282
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
Do you have administrative priviliges in that system ?

-- 
Anto Paul
www.benchmarksoft.com

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



Re: Installation problem

2005-04-02 Thread Panagiotis Karvounis
I've done all these.

A msgbox appears informing me about the problem again!It says "Failed
to install service!Check your settings and permissions!"


On Apr 1, 2005 11:53 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> 01Apr2005 @ 22:24 Panagiotis Karvounis thusly spake
> > I am trying to install Tomcat latest version but I have a problem.
> > During installation a problem about "jvm.dll" occurs!
> > Can you help me?
> 
> Try uninstalling tomcat first.
> If you already have a tomcat installed, you will get this message.
> Remove the other tomcats, or remove the existing 'jvm.dll' file.
> 
> hth,
> Luke
> 
> --
>   /  /  _
>  /_ /_/ /< /=
>  0421 276 282
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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