Hello,
before using Seam managed session in my application and jboss microcontainer i 
was used to specify my datasource in file context.xml in the META-INF Directory 
in my app. This way, after deployment one can edit this file in the desired 
tomcatfolder (Tomcat/conf/Catalina/localhost/.xml) to change the database.

I followed the instructions to set up seam and hibernate on Tomcat(chapter 9.6 
of the seam manual).
So now I have to supply a jboss-bean.xml file. This file is packaged in the war 
and can not easily edited at runtime.

My question are: Is it possible to achieve to change the database at runtime? 
What have i to do?

By now, for every targetsystem i do this:
 1. edit jboss-bean.xml 
 2. deploy the app
 3.  copy the resulting war to the right system

But what i need is:
 1. deploy the app
 2.  copy the war to all target systems
 3. configure the right database into the app after deployment


The jndiName should be the same for all instances but the connectionUrl and the 
userName should change.

jboss-beans.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  |             xsi:schemaLocation="urn:jboss:bean-deployer 
bean-deployer_1_0.xsd"
  |             xmlns="urn:jboss:bean-deployer">
  |             
  |    <bean name="Naming" class="org.jnp.server.SingletonNamingServer"/>
  | 
  |    <bean name="TransactionManagerFactory" 
class="org.jboss.seam.microcontainer.TransactionManagerFactory"/>
  |    <bean name="TransactionManager" class="java.lang.Object">
  |       <constructor factoryMethod="getTransactionManager">
  |          <factory bean="TransactionManagerFactory"/>
  |       </constructor>
  |    </bean>
  | 
  |      <bean name="bazDatasourceFactory" 
class="org.jboss.seam.microcontainer.DataSourceFactory">
  |       <property name="driverClass">com.mysql.jdbc.Driver</property>
  |       <property 
name="connectionUrl">jdbc:mysql://localhost:3306/bazseam</property>
  |       <property name="userName">root</property>
  |       <property name="jndiName">java:/hibernateDatasource</property>
  |       <property name="minSize">0</property>
  |       <property name="maxSize">10</property>
  |       <property name="blockingTimeout">1000</property>
  |       <property name="idleTimeout">100000</property>
  |       <property name="transactionManager"><inject 
bean="TransactionManager"/></property>
  |    </bean>
  | 
  |    <bean name="bazDatasource" class="java.lang.Object">
  |       <constructor factoryMethod="getDataSource">
  |          <factory bean="bazDatasourceFactory"/>
  |       </constructor>
  |    </bean>
  |    
  |    <bean name="bazDatabaseFactory" 
class="org.jboss.seam.microcontainer.HibernateFactory"/>
  |    <bean name="bazDatabase" class="java.lang.Object">
  |       <constructor factoryMethod="getSessionFactory">
  |          <factory bean="bazDatabaseFactory"/>
  |       </constructor>
  |       <depends>bazDatasource</depends>
  |    </bean>
  | 
  | 
  | </deployment>
I hope that your answer is not: change to an applicationserver, there you have 
an xxx-ds.xml file which can be changed at runtime.
I have to stay with tomcat and microcontainer.
Ciao,
Carsten

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3952938#3952938

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3952938

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to