Hi,
I'm not an exper at all, but I try to put my 2 cents.
The fact that your app can connect successfully after the server restart,
suggests that you should have your app's context.xml (or whatever it is
called) not in the server.xml but in the correct location inside your app
directories. I seem to have read, the correct location being under the
META-INF directory and that Tomcat tries first to look for context in this
dir and then  use that one under server.xml.
I hope expert user, will comfirm in one way or the other this understanding
of your problem.

On 3/2/06, Lucas Bee <[EMAIL PROTECTED]> wrote:
>
> Hello Fellow Users,
>
>
>
> My question is relatively simple.  It has 3 parts.
>
>
>
> 1.      Database:
>
> *         MySQL 4.1
>
>
>
> 2.      Tomcat:
>
> *         Apache Tomcat/5.0.28
>
>
>
> 3.      Hibernate:
>
> *         2.1.8
>
>
>
> I have my app which uses Hibernate and connects to a MySQL database and
> uses
> Tomcat as the app server.  Everything works just fine except for when I
> need
> to redeploy an app.  I go into Tomcat Manager and stop the app and then
> undeploy the app.  Everything works here as well, however, when I try to
> redeploy the app it redeploys but my app can't connect to the database
> until
> after I restart Tomcat.  This is a problem when you are redeploying to the
> production server.   This might be more of a hibernate setting question
> but
> I thought it could be beneficial to post here as well since the Hibernate
> Forum is not providing any results.
>
>
>
> Code:
>
>
>
> Tomcat Server.xml
>
>
>
> <Context path="/Cohorts" docBase="Cohorts" reloadable="true"
> crossContext="true">
>
>
>
>     <Resource name="jdbc/dbus5" scope="Shareable"
> type="javax.sql.DataSource"/>
>
>
>
>     <ResourceParams name="jdbc/dbus5">
>
>
>
>         <parameter>
>
>             <name>factory</name>
>
>             <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>
>         </parameter>
>
>
>
>         <!-- DBCP database connection settings -->
>
>         <parameter>
>
>             <name>url</name>
>
>
>             <value>jdbc:mysql://localhost:3306/us?autoReconnect=true</value>
>
>         </parameter>
>
>         <parameter>
>
>             <name>driverClassName</name><value>com.mysql.jdbc.Driver
> </value>
>
>         </parameter>
>
>
>
>            .....
>
>
>
>         <!-- DBCP connection pooling options -->
>
>            .....
>
>     </ResourceParams>
>
> </Context>
>
>
>
> Hibernate.cfg.xml
>
>
>
> <property name="connection.datasource">java:comp/env/jdbc/dbus5</property>
>
>       <property name="dialect">org.hibernate.dialect.MySQLDialect
> </property>
>
>
>
> That's it!  Is there some setting I'm missing in my server.xml file?  I
> really don't know.  I've searched every place I can think of.
>
>
>
> Any feedback would be great!
>
>
>
> Thanks.
>
>
>
> -Lucas
>
>
>
>
>

Reply via email to