It's not a secret anymore!*
The moose likes JBoss/WildFly and the fly likes Deploying DS using MBeanServer and MainDeployer on the fly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Deploying DS using MBeanServer and MainDeployer on the fly" Watch "Deploying DS using MBeanServer and MainDeployer on the fly" New topic
Author

Deploying DS using MBeanServer and MainDeployer on the fly

Austin Adamson
Greenhorn

Joined: Feb 09, 2004
Posts: 2
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

Joined: Jul 21, 2003
Posts: 367
Are you naming it "ds.xml" or "somename-ds.xml" The "something-" is important.
Austin Adamson
Greenhorn

Joined: Feb 09, 2004
Posts: 2
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Deploying DS using MBeanServer and MainDeployer on the fly
 
Similar Threads
Could not enlist in transaction on entering meta-aware object
Connection Pooling
SessionFactory: javax.naming.NameNotFoundException: hibernate not bound
JBOSS startup error
Canot find the data sourcse OracleDs ?