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>