Howdy,
Yeah, it's not good practice to get a connection (or other resource) and in the init 
method hold on it until the destroy method.  Pools make getting a connection quick, so 
you can keep the connection for as little time as possible.

That aside, what tomcat version are you using?

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Edson Alves Pereira [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, January 20, 2004 8:25 AM
>To: 'Tomcat Users List'
>Subject: RE: Please help, I have a headache .. servlet init troubles
>
>       Right, usually we get a dataSource in doGet or doPost method.
>
>> ----------
>> De:  Allistair Crossley[SMTP:[EMAIL PROTECTED]
>> Responder:   Tomcat Users List
>> Enviada:     terça-feira, 20 de janeiro de 2004 9:22
>> Para:        Tomcat Users List
>> Assunto:     RE: Please help, I have a headache .. servlet init troubles
>>
>> I have solved the JNDI resource by removing the call to the Context out
>of
>> the init method and into the classes that wish to connect. And yes I do
>> use a JNDI properly as my application is working using
>> dataSource.getConnection(). The only time my dataSource.getConnection
>does
>> not work is when I try to get the JNDI resource in the servlet init
>> method.
>>
>>
>>
>> -----Original Message-----
>> From: Edson Alves Pereira [mailto:[EMAIL PROTECTED]
>> Sent: 20 January 2004 13:07
>> To: 'Tomcat Users List'
>> Subject: RE: Please help, I have a headache .. servlet init troubles
>>
>>
>>      Tell us, if you use these parameters for a simple connection, do you
>> really connect to SQLServer?  I think that your real problem is to create
>> a
>> JNDI datasource.
>>
>> > ----------
>> > De:        Allistair Crossley[SMTP:[EMAIL PROTECTED]
>> > Responder:         Tomcat Users List
>> > Enviada:   segunda-feira, 19 de janeiro de 2004 13:35
>> > Para:      Tomcat Users List
>> > Assunto:   RE: Please help, I have a headache .. servlet init
>troubles
>> >
>> > Hi,
>> >
>> > Yes I have the jdbc driver in common/lib - like I say ... it "does"
>> > connect but I do not know why it gives this error!
>> >
>> > I just removed trying to get the JNDI data source in my controller
>> servlet
>> > init() and moved it to the classes that need a connection. There are
>now
>> > no errors. Therefore it seems almost that init() is too quick to try
>and
>> > get the JNDI resource before it has managed to load the servlet.xml??
>> >
>> > Do you know why my servlet initalises twice? That's my remaining
>issue..
>> >
>> > Cheers, ADC
>> >
>> > -----Original Message-----
>> > From: Edson Alves Pereira [mailto:[EMAIL PROTECTED]
>> > Sent: 19 January 2004 17:22
>> > To: 'Tomcat Users List'
>> > Subject: RE: Please help, I have a headache .. servlet init troubles
>> >
>> >
>> >    To solve your problem with JDBC Driver, you must put the JDBC driver
>> > inside $TOMCAT_HOME/common/lib, try this first the other errors we will
>> > see
>> > if happens again.
>> >
>> > > ----------
>> > > De:      Allistair Crossley[SMTP:[EMAIL PROTECTED]
>> > > Responder:       Tomcat Users List
>> > > Enviada:         segunda-feira, 19 de janeiro de 2004 12:56
>> > > Para:    TOMCAT USER (E-mail)
>> > > Assunto:         Please help, I have a headache .. servlet init troubles
>> > >
>> > > I am having the biggest headache ever with this. When I start Tomcat
>> > >
>> > > 1) Why is my controller servlet always initialised twice?? That is,
>as
>> > > soon as all my logging has finished for one init, it all comes out
>> again
>> > a
>> > > second time!
>> > >
>> > > 2) In the init I get the following error when it tries to look at my
>> > JNDI
>> > > datasource...
>> > >
>> > > 2004-01-19 15:35:28,764 INFO
>> > > com.qas.newmedia.intranet.iq.IQActionServlet.init(Unknown Source) :
>> > > dataSource: done
>> > >
>> > > 2004-01-19 15:35:28,764 ERROR
>> > > com.qas.newmedia.intranet.iq.IQActionServlet.init(Unknown Source) :
>> Init
>> > > could not acquire connection from DataSource:
>> > > org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
>> of
>> > > class '' for connect URL 'null', cause: null Cannot create JDBC
>driver
>> > of
>> > > class '' for connect URL 'null'
>> > >
>> > > Yet shortly after it seems to have found my datasource perfectly ok
>> > > because calls work...
>> > >
>> > > 2004-01-19 15:36:44,828 DEBUG
>> > >
>> >
>>
>com.qas.newmedia.intranet.iq.base.navigation.NavigationManager.init(Unknow
>> > > n Source) : CONNECTIOINIT
>> > > [EMAIL PROTECTED]
>> > >
>> > > My JNDI resouce is below (clearly a URL DOES exist).
>> > >
>> > > Thank you all! ADC
>> > >
>> > > -- snip --
>> > >
>> > >
>> > >                  <Resource name="jdbc/iqdb" auth="Container"
>> > > type="javax.sql.DataSource"/>
>> > >
>> > >                  <ResourceParams name="jdbc/iqdb">
>> > >                          <parameter>
>> > >                            <name>factory</name>
>> > >
>> > > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>> >
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                                  <name>driverClassName</name>
>> > >
>> > >
>> > > <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
>>
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                                  <name>url</name>
>> > >
>> > > <value>jdbc:microsoft:sqlserver://server:1433</value>
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                                  <name>username</name>
>> > >                                  <value>sa</value>
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                                  <name>password</name>
>> > >                                  <value>pass</value>
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                                  <name>maxActive</name>
>> > >                                  <value>50</value>
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                             <name>maxIdle</name>
>> > >                             <value>10</value>
>> > >                          </parameter>
>> > >                          <parameter>
>> > >                             <name>maxWait</name>
>> > >                             <value>10000</value>
>> > >                          </parameter>
>> > >                                 <parameter>
>> > >                                   <name>validationQuery</name>
>> > >                                   <value>SELECT 1 + 1</value>
>> > >                                 </parameter>
>> > >
>> > > <parameter><name>logAbandoned</name><value>true</value></parameter>
>> > >
>> > >
><parameter><name>removeAbandoned</name><value>true</value></parameter>
>> > >
>> > >
>> > > <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE>
>> > > -------------------------------------------------------
>> > > QAS Ltd.
>> > > Developers of QuickAddress Software
>> > > <a href="http://www.qas.com";>www.qas.com</a>
>> > > Registered in England: No 2582055
>> > > Registered in Australia: No 082 851 474
>> > > -------------------------------------------------------
>> > > </FONT>
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > 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]
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to