-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Two datasource, two aplications one problem
PostPosted: Tue May 20, 2008 2:59 pm 
Newbie

Joined: Sat Jul 22, 2006 3:08 pm
Posts: 6
I have on line store administration application written in JSF with hibernate
and MySQL database. It all works on Tomcat 5.5.
I lately moved from Windows platform to Linux Fedora.
It's still working but I have a problem that I can't figure out on my own.

hibernate.datasource problem.

I always have two versions of the application deployed: Production and development.
I have two JNDI data sources created jdbc/biusciaste2 and jdbc/biusciaste4.
I select which one I use in application's hibernate properties file:
hibernate.connection.datasource = java:/comp/env/jdbc/biusciaste4
#hibernate.connection.datasource = java:/comp/env/jdbc/biusciaste2
Selecting the right one as needed.

Now a strange thing happens. I restart tomcat , launch one of the application, and it's working but later when I launch another application it uses the same datasource that the first one did. It doesn't seam to check application's hibernate.properties file again.
It was working correctly on windows !!!

Important is that it is working. Aplications are running just on the same database. Productio or development depending whcich aplication I start firts after tomcat restart.

What could this be? Any ideas. Mayby someone knows something.

hibernate.properties:

Code:
hibernate.bytecode.use_reflection_optimizer=false

hibernate.connection.datasource = java:/comp/env/jdbc/biusciaste4
#hibernate.connection.datasource = java:/comp/env/jdbc/biusciaste2

hibernate.dialect = org.hibernate.dialect.MySQLInnoDBDialect
hibernate.current_session_context_class = thread

hibernate.format_sql=true


tomcat's context.xml:
Code:
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

<Resource  name="jdbc/biusciaste2"  auth="Container"
                type="javax.sql.DataSource"
                maxActive="10"
                maxIdle="5"
                validationQuery="SELECT 1"
                testOnBorrow="true"
                testWhileIdle="true"
                timeBetweenEvictionRunsMillis="100000"
                minEvictableIdleTimeMillis="600000"
                username="biusciaste" password="XXXXXXX"
                driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://XXXXXX:3306/biusciaste?autoReconnect=true"/>

<Resource  name="jdbc/biusciaste4"  auth="Container"
                type="javax.sql.DataSource"
                maxActive="10"
                maxIdle="5"
                validationQuery="SELECT 1"
                testOnBorrow="true"
                testWhileIdle="true"
                timeBetweenEvictionRunsMillis="100000"
                minEvictableIdleTimeMillis="600000"
                username="alek" password="XXXXXXX"
                driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://XXXXX:3306/axmar?autoReconnect=true"/>

</Context>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.