The tomcat version is 6.0.30.

Can we still use Hibernate in our Spring application if we configure the
Data Source through a context.xml? We are not using a context.xml right
now, can I use the context.xml in $TOMCAT_HOME/conf?

Our server.xml, the config is as follows:

                        <Host name="www.oursite.com" appBase="/ourpath"
                                unpackWARs="true" autoDeploy="true">
                                <Context path="" docBase=""
reloadable="true" />

Thanks,
Charles



On Tue, Mar 4, 2014 at 2:57 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Charles,
>
> On 3/4/14, 1:03 PM, Charles Richard wrote:
> > Hi,
> >
> > I am testing the jdbc pool to replace the c3p0 pool we were using
> > for our Tomcat connection pool. We are also using Spring 2.0 and
> > Hibernate (and Tomcat 6).
> >
> > When I put this in my hibernate-context.xml, our application is
> > using the jdbc pool and appears to work:
> >
> > <bean id="dataSource"
> > class="org.apache.tomcat.jdbc.pool.DataSource"
> > destroy-method="close"> <property name="driverClassName"
> > value="com.mysql.jdbc.Driver" /> <property name="url"
> > value="jdbc:mysql://${db.host}/${db.name}" /> <property
> > name="username" value="${db.user}" /> <property name="password"
> > value="${db.pwd}" /> <property name="initialSize" value="15" />
> > <property name="maxActive" value="150" /> <property
> > name="removeAbandoned" value="true" /> <property
> > name="removeAbandonedTimeout" value="1800" /> <property
> > name="logAbandoned" value="true" /> <property name="jmxEnabled"
> > value="true" /> <property name="jdbcInterceptors"
> >
> value="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx(threshold=10000)"
> >
> >
> />
> > </bean>
> >
> > However, when using jmx locally, I don't see any beans that I can
> > use to monitor the connections used in the pool. I tried doing as
> > per this article:
> >
> >
> http://stackoverflow.com/questions/3865445/cant-see-jmx-entries-in-jconsole-when-using-tomcat-jdbc-connection-pool
> >
> >  This doesn't work for me.
> >
> > Any suggestions on what I'm missing here?
>
> Tomcat version? (be specific)
>
> If you are using Hibernate to create the DataSource, then it will not
> likely be registered with the JMX server. If you use a DataSource
> <Resource> configured in your webapp's context.xml, then all will be
> well and you should be able to discover your DataSource via JMX. Just
> tell Hibernate what the JNDI DataSource's name is and it should work fine.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJTFiIXAAoJEBzwKT+lPKRYbyMQAMjNMVExzKobz/IiRDJGZq7Q
> uxik9/v05jmTUBuOU9eA3F/qCT/nFcObp+B9AsaUaI9FxuIQVJSV2lD6BjDSEoId
> Hzkf6d2uYMy+6bGS717T/4vbZn6x02CmeSHSlJjW11C5UJjYcn/GPjv35Jf8bXE4
> bnALGdMUhLxRGCCNTLgU5WycYNTaXB/5H4wZf4Q3rldMVB5oqQEQ+9j1tnroU1fC
> YN+/K9sEER8EYDYjX3c10Ag1PIh35akdeJQYTGO30dEXo2zLRF7Xy1tayOkhBHfZ
> e2bZsheUaTbcnC3W82kkLm+WbSZ7SKIP1GvP7GQBwisdQfEYs7XprYwYituhn0nQ
> 2lgWXe/f+e1HN7ySkLA9o/AL8szpU4SHUYHYeDaPn3VbkM6Wqx4lPuhIIChzHwiD
> 3h4Hin+cQl1JzuBvmp4pBE3cAY9sco0T6t9BTGf9U2xwjyhwQ94njyGdIRwksNKG
> OIC4BpmYXzHXdss5XXU/Ci7woX0iGdOTMXy5dLACo1TOjoHBsE/y3Xg1LsZygXfi
> 19zZ2XRsOwnGmgXZBbM+tkuWF7uMUK/ViVkHEwfgu7IQ5QK3OZuorMTVDAgowvzm
> 74AV6MS3e69/TWVsALtI4mcOjVBFtz4b5pFhJgjCqGrSacoj1tAqVxi4jCA/bD0/
> 1XVnQ/pn5O9wsmycn0y/
> =Fg28
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to