1 Reply Latest reply on Jun 16, 2006 7:47 AM by nigelwhite

    Creating a DataSource definition file on the fly

    nigelwhite

      I'm trying to create a DataSource on demand in my web app according to a submitted form.

      I'm creating an XML file in the deploy directory. The syntax looks fine to me, this is what it looks like:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>foobarDS</jndi-name>
       <connection-url>jdbc:mysql://delta:3306/greenfield</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>steve</user-name>
       <exception-sorter-class-name>
       org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
       </exception-sorter-class-name>
       <metadata>
       <type-mapping>mySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>


      A second or so later, when the JBoss deployer sees it, I get this:

      09:10:25,421 WARN [MainDeployer] undeploy 'file:/C:/jboss/server/default/deploy/foobarDS.xml' : package not deployed
      09:10:25,437 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      
      --- Packages waiting for a deployer ---
      org.jboss.deployment.DeploymentInfo@6954536f { url=file:/C:/jboss/server/default/deploy/foobarDS.xml }
       deployer: null
       status: null
       state: INIT_WAITING_DEPLOYER
       watch: file:/C:/jboss/server/default/deploy/foobarDS.xml
       altDD: null
       lastDeployed: 1150447131296
       lastModified: 1150447131296
       mbeans:
      
      --- Incompletely deployed packages ---
      org.jboss.deployment.DeploymentInfo@6954536f { url=file:/C:/jboss/server/default/deploy/foobarDS.xml }
       deployer: null
       status: null
       state: INIT_WAITING_DEPLOYER
       watch: file:/C:/jboss/server/default/deploy/foobarDS.xml
       altDD: null
       lastDeployed: 1150447131296
       lastModified: 1150447131296
       mbeans:
      
      --- MBeans waiting for other MBeans ---
      ObjectName: persistence.units:ear=GF.ear.ear,unitName=RWF
       State: NOTYETINSTALLED
       I Depend On:
       jboss.jca:name=RWFDS,service=ManagedConnectionFactory
      
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss.jca:name=RWFDS,service=ManagedConnectionFactory
       State: NOTYETINSTALLED
       Depends On Me:
       persistence.units:ear=GF.ear.ear,unitName=RWF
      


      The code is exactly the same as other DataSource definition files I have in there (apart from the name, and URL), so what's causing it to barf on this one?

      I'm going to need to do this. Our installation process is an JBoss app which creates all the necessary externals (DataSource definition file, supplied database tables), and then drops a packaged EAR from within itself into the deploy directory. If successful, it deletes its own EAR.