The JBossAS Admin Console has the requirement to enable users to create/update 
datasources within JBoss AS without restarting the actual instance. My question 
is to what extent are these operations feasible in the current 3.2.x/4.0.x 
JBoss AS architecture? 

Virtually every reference I've found says that the driver .jar file should be 
put in server/xxx/lib and then the -ds.xml file in the server/xxx/deploy. This 
clearly is not suitable in this case since JBoss AS needs to be restarted to 
see the .jar in server/xxx/lib. 

Scott refered to a possible solution while talking on a slightly different 
topic at http://sourceforge.net/mailarchive/message.php?msg_id=6481814. I 
tested this approach in 3.2.6 using a full -service.xml config file, rather 
than a -ds.xml file, with an included  element pointing to the driver .jar 
file. See below:

<?xml version="1.0"?>
  | <server>
  |   <classpath codebase="deploy/datasources" 
archives="mysql-connector-java-3.1.0-alpha-bin.jar"/>
  |   <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager" 
display-name="ConnectionManager for DataSource MySQLDS" 
name="jboss.jca:service=LocalTxCM,name=mysql">
  |     <attribute name="TrackConnectionByTx">true</attribute>
  |     <attribute name="LocalTransactions">true</attribute>
  |  
  |     <depends optional-attribute-name="ManagedConnectionPool">
  |       <mbean 
code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"  
name="jboss.jca:service=LocalTxPool,name=MySLQDS">
  |       <depends optional-attribute-name="ManagedConnectionFactoryName">
  |         <mbean code="org.jboss.resource.connectionmanager.RARDeployment" 
name="jboss.jca:service=LocalTxPF,name=MySQLDS">
  |               <depends 
optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss
 LocalTransaction JDBC Wrapper</depends>
  |           <attribute name="ManagedConnectionFactoryProperties">             
    
  |             <properties>
  |                   <config-property name="ConnectionURL" 
type="java.lang.String">jdbc:mysql://localhost:3306/mysql</config-property>
  |               <config-property name="DriverClass" 
type="java.lang.String">com.mysql.jdbc.Driver</config-property>
  |                   <config-property name="UserName" 
type="java.lang.String">root</config-property>
  |               <config-property name="Password" 
type="java.lang.String">blah</config-property>      
  |                </properties>
  |           </attribute>
  |         </mbean>
  |       </depends>
  |       <attribute name="MinSize">0</attribute>
  |       <attribute name="MaxSize">50</attribute>
  |       <attribute name="BlockingTimeoutMillis">5000</attribute>
  |       <attribute name="IdleTimeoutMinutes">1</attribute>
  |       <attribute name="Criteria">ByNothing</attribute>
  |       </mbean>
  |     </depends>
  |     
  |     <attribute name="JndiName">MySQLDS</attribute>
  |     <depends 
optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
  |     <depends 
optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
  |   </mbean>
  | </server>
  | 

This enabled a new datasource, referencing 
server/xxx/deploy/datasources/mysql-connector-java-3.1.0-alpha-bin.jar, to be 
created dynamically in the JBoss AS. No JBoss AS restart, nor jars in 
server/xxx/lib required. Updates can also obviously be made to the -service.xml 
without any need to restart the instance. However, on Windows at least, a lock 
is kept to the driver .jar file preventing it from being moved or deleted until 
JBoss AS is stopped. 

Does anyone know of an alternative approach which does not cause the file lock? 
Obviously updating the driver .jar being used could be managed by updating the 
classpath element and specifying a new driver file name, but I was just 
wondering if there was a way to avoid the lock.

Thanks
Charles


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

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


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to