db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <Fisc...@seitenbau.net>
Subject Re: Torque using Tomcat
Date Thu, 23 Dec 2004 10:47:37 GMT




Hi,

Do you think your change in JndiDataSourceFactory is general enough to be
included in future releases of Torque ?
If yes, can you please open a ticket in Scarab

http://nagoya.apache.org/scarab/issues

open a bug report and attach your patch ?

  Thanks a lot,

     Thomas

"Wieger Uffink [Us Media]" <wieger@usmedia.nl> schrieb am 23.12.2004
10:40:34:

> Hi,
>
> I can confirm the behaviour Sean's having. I've been seeing it since we
> upgraded to torque 3.1.1. which uses commons-configuration-1.0.
>
> I think what happens is that when torque initialises it tries to find
> your datasource through JNDI which you have configured in
> Torque.properties, and after it also tries to initialise a datasource
> and bind it to your context which you actually have not configured in
> your properties file.
> Previously the commons-configuration package would give a null object
> when no subconfiguration for the datasource was found in the properties
> file, but since 1.0 it returns an empty subconfiguration object (which
> is not null), and that is what 'breaks' the code.
> The second time you load your app this causes an
> NameAlreadyBoundException, causing torque initialisation to fail.
>
> Ive recompiled torque source with a small patch in the
> JndiDataSourceFactory and this solves the problem.
>
> Recompiling Torque 3.1.1 with and older version of commons-configuration
> also does the trick.
>
> I have also found an elaborate post on the same problem in the archives:
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=torque-
> user@db.apache.org&msgId=1440765
>
> Hope this helps,
>
> Grtz
> Wieger
>
> On Wed, 2004-12-22 at 18:30 -0800, M. Sean Gilligan wrote:
> > Hi Henning,
> >
> > Thanks again for your help.  (I got sidetracked for a few days.)
> >
> > >"M. Sean Gilligan" <Sean_Gilligan@catalla.com> writes:
> > >
> > >>>"M. Sean Gilligan" <Sean_Gilligan@catalla.com> writes:
> > >>>
> > >>>>I'm using Torque 3.1.1 with Tomcat 5.0.28 and MySQL.  In a
> Tomcat context.xml file I've defined a JNDI DataSource and in
> torque.prorperties the JndiDataSourceFactory factory is being used.
> The webapp works fine until the webapp is realoaded.  The first
> database access after a reload gives this stack trace:
> > >>>
> > >>>I remember this from a dim and distant past. It was some
serialization
> > >>>issue. Can you please look into your catalina.out and maybe look
into the
> > >>>list archives?
> > >
> > >>Hi Henning.
> > >
> > >>Thanks for your response.
> > >
> > >>What do you mean by a "serialization issue"?
> > >
> > >Your container probably tries to save the existing session on a
> > >restart (because reloading your webapp is nothing but a restart of
> > >your application) and falls over its feets. When it comes up again,
> > >its session information is incomplete and you get strange errors.
> >
> > What would Torque have to do with the Http session?  I don't
> understand the connection here.
> >
> > >
> > >Try the following thing. I assume now, that you use Tomcat5:
> > >
> > >- open your tomcat/conf/server.xml file
> > >
> > >- look for the <Context> element for your application.
> > >
> > >- if you don't have one, you must create one. The result should look
like
> > >  this:
> > >
> > ><Context path="/your-app-here" reloadable="true">
> > >   <Manager className="org.apache.catalina.session.StandardManager"
> > >            distributable="false" pathname="" />
> > ></Context>
> > >
> > >Important is the 'pathname=""'
> > >
> > >Stop Tomcat. Nuke the contents of the work/ and the temp/
> > >directory. Start again. See if the problem vanishes. If yes, you have
> > >a serialization issue with Torque.
> >
> > I did what you said and the problem did not go away.  To be clear:
> the problem is fixed by a restart of Tomcat and only occurs when you
> reload the webapp after it has been loaded once.  I followed your
> instructions (which included a restart of Tomcat) tried to login
> once and it worked, the restarted the webapp and tried to login
> again and got the same stack trace.
> >
> > One variation from your procedure is that I'm not editing server.
> xml but specifying a Context.xml in the Tomcat <deployment> ANT task.
> >
> > The version I just tested is like this:
> >
> > <?xml version='1.0' encoding='utf-8'?>
> > <Context docBase="/path/to/webapp" path="/my" reloadable="true">
> >   <Manager className="org.apache.catalina.session.StandardManager"
> >            distributable="false" pathname="" />
> >   <Resource auth="Container" name="jdbc/mysqldb" type="javax.sql.
> DataSource"/>
> >   <Resource auth="Container" name="jdbc/pgdb"
type="javax.sql.DataSource"/>
> >   <ResourceParams name="jdbc/mysqldb">
> >     <parameter>
> >       <name>url</name>
> >       <value>jdbc:mysql://localhost/mysqldb</value>
> >     </parameter>
> >     <parameter>
> >       <name>username</name>
> >       <value>xxx</value>
> >     </parameter>
> >     <parameter>
> >       <name>password</name>
> >       <value>xxx</value>
> >     </parameter>
> >     <parameter>
> >       <name>driverClassName</name>
> >       <value>org.gjt.mm.mysql.Driver</value>
> >     </parameter>
> >     <parameter>
> >       <name>maxWait</name>
> >       <value>5000</value>
> >     </parameter>
> >     <parameter>
> >       <name>maxActive</name>
> >       <value>4</value>
> >     </parameter>
> >     <parameter>
> >       <name>maxIdle</name>
> >       <value>2</value>
> >     </parameter>
> >   </ResourceParams>
> >   <ResourceParams name="jdbc/pgdb">
> >     <parameter>
> >       <name>url</name>
> >       <value>jdbc:postgresql: pgdb</value>
> >     </parameter>
> >     <parameter>
> >       <name>username</name>
> >       <value>xxx</value>
> >     </parameter>
> >     <parameter>
> >       <name>password</name>
> >       <value>xxx</value>
> >     </parameter>
> >     <parameter>
> >       <name>driverClassName</name>
> >       <value>org.postgresql.Driver</value>
> >     </parameter>
> >     <parameter>
> >       <name>maxWait</name>
> >       <value>5000</value>
> >     </parameter>
> >     <parameter>
> >       <name>maxActive</name>
> >       <value>4</value>
> >     </parameter>
> >     <parameter>
> >       <name>maxIdle</name>
> >       <value>2</value>
> >     </parameter>
> >   </ResourceParams>
> > </Context>
> >
> > Any further information and/or suggestions would be greatly
appreciated.
> > Thanks,
> >
> > Sean
> >
> --
> ::::::::::::::::::::::::::::::::::::::::
> Us Media B.V.
> Stadhouderskade 115
> 1073 AX Amsterdam
>
> t: +31 (0)20 428 68 68
> f: +31 (0)20 470 69 05
> www.usmedia.nl
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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


Mime
View raw message