We use a database connection pool class which is a servlet that we start on 
tomcat boot using the following in the application's web.xml. You may want to do 
something like this:

    <servlet>
        <servlet-name>
           conn_pool
        </servlet-name>
        <servlet-class>
           your_servlet
        </servlet-class>
        <init-param>
            <param-name>poolConf</param-name>                                    
            <param-value>path_to_config_file</param-value>
        </init-param>
        <load-on-startup>
             1
        </load-on-startup>
    </servlet>

 
hth
*********************************************************************
* Boris Niyazov                Ph:  212-854-4094  Fax: 212-854-1749 *
* Systems Manager              Email: [EMAIL PROTECTED]             * 
* Columbia Law School          URL: http://www.law.columbia.edu     *
*********************************************************************                  
             



>This is what I suggest you do:
>
>    Create Gateway class (login class) that metes out Session
>    objects to callers via getMySession() method.
>    Inside this method I would deserialize the bean object from the file and
>added it as     an attribute inside the session.
>
>    It is a common technique for passing Connection and Thread
>    Pool objects within the session.
>
>    Or simple change scope to session:
>    <jsp:useBean id="counter" scope="page" class="javabean.Counter" />
>
>    But I realize that programming with tags is very limited.
>
>Hope this helps.
>R/Luba
>
>----- Original Message -----
>From: "Debashis Ghosh" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, June 14, 2001 2:29 PM
>Subject: Re: How can I make tomcat to instantiate a class
>
>
>> Hi Luba,
>> Thanks for this . But actually my problem was to instantiate a class when
>> tomcat boots up...so that i can use that object across sessions.Can u
>suggest
>> something towarsd this.
>> Thanks
>> debashis
>> On Thursday 14 June 2001 08:18 am, you wrote:
>> > JSP will do it for you.  Example:
>> >
>> > <html>
>> > <body>
>> >
>> > <%@ page language="java" %>
>> > <%@ page import="javabean.Counter" %>
>> >
>> > <!-- page, request, session, application  -->
>> >
>> > <jsp:useBean id="counter" scope="page" class="javabean.Counter" />
>> >
>> > <%
>> >  out.println("Count from scriplet = " + counter.getCount());
>> > %>
>> >
>> > <br>
>> >
>> > Count from jsp:getProperty=
>> >  <jsp:getProperty name="counter" property="count" />
>> >
>> > </body>
>> > </html>
>> >
>> >
>> > ----- Original Message -----
>> > From: "Debashis Ghosh" <[EMAIL PROTECTED]>
>> > To: <[EMAIL PROTECTED]>
>> > Sent: Wednesday, June 13, 2001 9:57 PM
>> > Subject: How can I make tomcat to instantiate a class
>> >
>> > > Hi,
>> > > Can anyone suggest How can I make tomcat to instantiate a class so
>that i
>> >
>> > can
>> >
>> > > access it from my
>> > > jsp or servlet as an application level variable.Basically i want to
>> > > instatiate one connection pool class so
>> > > that i can access it from my servlet to get an connection object out
>of
>> >
>> > it.
>> >
>> > > On Wednesday 13 June 2001 06:47 pm, you wrote:
>> > > > Below is good advice. If the login page does not
>> > > > come up (btw, what happens does it just take you
>> > > > direct to the protected resource?) the first place I would
>> > > > look is the tomcat config files. So basically I would
>> > > > double-check server.xml and the web-xml for your app.
>> > > > If you are sure they are correct and you still have a problem
>> > > > you might want to try posting the relevant sections to the list.
>> > > >
>> > > > If you do get JDBCRealm working with tomcat standalone then
>> > > > to integrate with apache you need to add
>> > > >
>> > > > JkMount /examples/jsp/security/login/j_security_check ajp13
>> > > > (or ajp12 if using mod_jserv) to httpd.conf to tell apache
>> > > > to delegate the handling of this bit of magic to tomcat.
>> > > >
>> > > > andrew
>> > > >
>> > > > On Wed, 13 Jun 2001, you wrote:
>> > > > > > Mark, I appreciate your help.   I have tried
>> > > > > > to adapt the examples and I believe I have everything
>> > > > > > in place.  However, apache just wont bring the login
>> > > > > > form when I try to access a protected resource.
>> > > > > > Would you have any idea where to look at for this problem?
>> > > > >
>> > > > > You might want to check and see if you can get a
>> > > > > JDBCRealm to work with tomcat standalone(i.e. accessing
>> > > > > you site as http://localhost:8080/... directly).
>> > > > > If this doesn't work get this working first and
>> > > > > that's a good place to start from.  Once you have
>> > > > > JDBCRealm working correctly then you can deal with
>> > > > > making sure it works when passed through apache.
>> > > > >
>> > > > >
>> > > > > ---
>> > > > > Michael Wentzel
>> > > > > Software Developer
>> > > > > Software As We Think - http://www.aswethink.com
>

Reply via email to