3 Replies Latest reply on Nov 2, 2005 1:09 PM by sxgray

    Dependency between XMBean and Datasource

    redcar

      Hallo,

      I have a xmBean which needs access to a defined oracle datasource. I trieed to configure the dependency into the jboss-service.xml file of the xmBean, but the bean is allways started before the datasource can be connected. I tried it as below, but it seems not working.

      What is the correct solution for this problem?

      --- jboss-service.xml ---

      [?xml version="1.0" encoding="iso-8859-1"?]
      [!DOCTYPE server
      PUBLIC "-//JBoss//DTD MBean Service 4.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd"]
      [server]
      [mbean code="com.gevas.service.xmbean.meld.MXBMeldCache"
      name="GEVAS:name=MXBMeldCache,type=XMBean"
      xmbean-dd=""]
      [depends]jboss.jca:service=LocalTxCM,name=OracleDS[/depends]
      [xmbean]
      [description]DataCache for MeldeSystem[/description]
      [class]com.gevas.service.xmbean.meld.MXBMeldCache[/class]
      [operation]
      [description]Print Info about MXBMeldCache[/description]
      [name]getInfo[/name]
      [return-type]java.lang.String[/return-type]
      [/operation]
      [operation]
      [description]Refresh Data for MeldungsMonitor[/description]
      [name]refreshData[/name]
      [parameter]
      [description]ContainerRequest request : enthaelt Infos ueber upzudatenden DatenContainer[/description]
      [name]request[/name]
      [type]com.gevas.meld.data.request.ContainerRequest[/type]
      [/parameter]
      [return-type]com.gevas.meld.data.MOMTableData[/return-type]
      [/operation]
      [/xmbean]
      [depends]GEVAS:name=MXBMeldCache,type=XMBean[/depends]
      [/mbean]
      [/server]


      --- datasource ---
      [datasources]
      [local-tx-datasource]
      [jndi-name]OracleDS[/jndi-name]
      [connection-url]jdbc:oracle:thin:@dbserver:1521:komk[/connection-url]
      [driver-class]oracle.jdbc.driver.OracleDriver[/driver-class]
      [user-name]gerhard[/user-name]
      [password]freytag[/password]
      [exception-sorter-class-name]org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter[/exception-sorter-class-name]
      [metadata]
      [type-mapping]Oracle9i - MeldungsManagement[/type-mapping]
      [/metadata]
      [/local-tx-datasource]

      [/datasources]


      Thank you,
      Werner Hofmann

        • 1. Re: Dependency between XMBean and Datasource
          starksm64
          • 2. Re: Dependency between XMBean and Datasource
            redcar

            Hallo Scott,

            thank you for the tip. I thought something similar before it.
            I am using a <local-tx-datasource> so I used the clause:

            [depends]jboss.jca:service=LocalTxCM,name=OracleDS[/depends]

            OracleDS is my <jndi-name>

            In my jboss-service.xml file I tried this:

            [server]
            [mbean code="com.gevas.service.xmbean.meld.MXBMeldCache"
            name="GEVAS:name=MXBMeldCache,type=XMBean"
            xmbean-dd=""]
            [depends]jboss.jca:service=LocalTxCM,name=OracleDS[/depends]
            [xmbean]


            But in the logfile I can read, that the WrapperDataSourceService has bound the JNDI-Names of my Datasource after the start() Method of my XMBean.

            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,204 INFO [STDOUT] ### (GEVAS.MXBMeldCache):create() ####
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,329 INFO [STDOUT] ### (GEVAS.MXBMeldCache):start() ####
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,391 INFO [STDOUT] (GEVAS.INFO):MessageUpdater.updateData
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,391 INFO [STDOUT] (GEVAS.INFO): ##### MessageUpdater.updateData
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 ERROR [STDERR] 11.08.2005 07:34:48 com.gevas.database.util.DataSourceLocator getDataSource
            INFO | jvm 1 | 2005/08/11 07:34:48 | INFO: GEVAS - DataSourceLocator.getDataSource.lookup: java:OracleDS
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] java.sql.SQLException: Naming Exception: OracleDS not bound
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.database.util.DataSourceLocator.getDataSource(DataSourceLocator.java:64)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.service.meld.MDB.Table_MOM.readMOM(Table_MOM.java:125)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.service.meld.MDB.MessageUpdater.updateData(MessageUpdater.java:107)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.service.meld.MDB.MessageUpdater.run(MessageUpdater.java:123)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] ##### Start executeQuery: CONTAINER BUILD READY
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] java.sql.SQLException: (GEVAS.SQL-EXCEPTION):MOM.readMESSAGEs() :: Naming Exception: OracleDS not bound
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.service.meld.MDB.Table_MOM.readMOM(Table_MOM.java:187)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.service.meld.MDB.MessageUpdater.updateData(MessageUpdater.java:107)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at com.gevas.service.meld.MDB.MessageUpdater.run(MessageUpdater.java:123)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,438 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
            INFO | jvm 1 | 2005/08/11 07:34:48 | 07:34:48,563 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=OracleDS to JNDI name 'java:OracleDS'
            INFO | jvm 1 | 2005/08/11 07:34:50 | 07:34:50,266 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS to JNDI name 'java:DefaultDS'



            Is there an error in my jboss-service.xml file?

            • 3. Re: Dependency between XMBean and Datasource
              sxgray

              In case you're still having problems, a more direct answer...

              http://wiki.jboss.org/wiki/Wiki.jsp?page=DependOnDataSource

              When moving to JBoss 4.0.3 from 3.2.6, I had to add the DataSourceBinding dependency. With 3.2.6, I had just the LocalTxCM dependency.

              jboss.jca:service=DataSourceBinding,name=OracleDS
              jboss.jca:service=LocalTxCM,name=OracleDS