Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deploying DS using MBeanServer and MainDeployer on the fly

 
Austin Adamson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I'm trying to deploy a temp datasource in JBoss 3.2.1 using the Main deployer and invoking it from the the MBeanServer. I have an MBean in a SAR that drops the ds.xml in the deploy directory, and then the MBean trys to deploy it.
The only problem that I am running into is that when I try to do this with a ds.xml file JBoss doesn't think that it has a deployer to deploy the datasource. Thus, the JNDI name for the resource is never bound and I can't get the connection I need.
The code making the call to deploy is the following:
fileName = (String)files.get(i);
log.info("Deploying: '" + fileName + "'");
server.invoke(mainDeployer, "deploy", new Object[] {fileName}, new String[] {String.class.getName()});

ds.xml below:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<!--FBManager can be used to create and drop databases.
Drop is especially useful during testing, since it
assures a clean start next time.
<mbean code="org.firebirdsql.management.FBManager" name="jboss.jca:service=FirebirdManager">
<attribute name="FileName">C:/jboss/server/default/db/admin.gdb</attribute>
<attribute name="UserName">sysdba</attribute>
<attribute name="Password">masterkey</attribute>
<attribute name="CreateOnStart">true</attribute>
<attribute name="DropOnStop">false</attribute>
</mbean>
-->
<local-tx-datasource>
<jndi-name>single_ipac_admin</jndi-name>
<connection-url>jdbc:firebirdsql://localhost:3050/C:/jboss/server/default/data/admin.gdb</connection-url>
<driver-class>org.firebirdsql.jdbc.FBDriver</driver-class>
<user-name>user</user-name>
<password>password</password>
<min-pool-size>1</min-pool-size>
<max-pool-size>1</max-pool-size>
</local-tx-datasource>
</datasources>
Any help would be appreciated.
Thanks in advance
Austin
 
norman richards
Author
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you naming it "ds.xml" or "somename-ds.xml" The "something-" is important.
 
Austin Adamson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes it is somename-ds.xml. Since I only needed this as a temporary config I just read the connection info from the existing -ds.xml, undeployed the existing pool (-ds.xml) and created a single connection in the mbean and used that.
It worked fine that way for what I was doing. Kind of goes against letting JBoss manage the connections but it works.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic