1 Reply Latest reply on Mar 1, 2005 6:12 AM by Amit Bhayani

    Accessing Database from MBean

    Ingo Hackl Newbie

      Hello,

      I have a problem accessing a database from an MBean.

      When my MBean is deployed I get the following error:


      8:19:44,526 [main] INFO STDOUT user:service=WorkflowEngineBean: fullpath = RepoPath: RepoObjectOwner: lzmpa234 host<180> RepoObjectOwner: lzmpa88 cust<200> RepoObjectOwner: syex syex<300> RepoObjectOwner: syst syst<400>
      08:19:45,416 [main] ERROR gf.conn.ServerJDBCConnectionManager user:service=WorkflowEngineBean:
      at.co.systema.gf.util.AssertionException: NO JNDI DataSource found: DBInfo: techName='LZMPA88', driverName='oracle.jdbc.driver.OracleDriver', jarName='oracle901/classes12.zip', (FULL jarName='jdbcdriver/oracle901/classes12.zip'), url='jdbc:oracle:thin:@lzmpa88:1521:ORCL', user='mpa', password='kis', metaDataClassName='at.co.systema.gf.rdi.OracleDBMetaData', mapperClassName='at.co.systema.gf.rdi.OracleJDBCJDBC2JavaMapper
      at at.co.systema.gf.util.Assert.FAIL(Assert.java:627)
      at at.co.systema.gf.util.Assert.FAIL(Assert.java:590)
      at at.co.systema.gf.conn.ServerJDBCConnectionManager._createDriverConnection(ServerJDBCConnectionManager.java:128)
      at at.co.systema.gf.conn.ServerJDBCConnectionManager.createDriverConnection(ServerJDBCConnectionManager.java:65)
      at at.co.systema.gf.conn.JDBCConnectionManager._createConnectionForDBInfo(JDBCConnectionManager.java:320)
      at at.co.systema.gf.conn.JDBCConnectionManager.createConnectionForDBInfo(JDBCConnectionManager.java:98)
      at at.co.systema.gf.conn.ConnectionManager._createRDIConnectionForTechName(ConnectionManager.java:253)
      at at.co.systema.gf.conn.ConnectionManager._createDataStoreConnectionForDataStore(ConnectionManager.java:151)
      at at.co.systema.gf.conn.ConnectionManager.getConnectionForDataStore(ConnectionManager.java:208)
      at at.co.systema.gf.conn.ConnectionManager.getConnectionForDataStore(ConnectionManager.java:216)
      at at.co.systema.gf.omgr.UDIRecordIOSupport.getConnection(UDIRecordIOSupport.java:31)

      My datasource configuration file looks like this (mpa-ds.xml)

      <?xml version="1.0" encoding="ISO-8859-1"?>

      <local-tx-datasource>
      <jndi-name>LZMPA88</jndi-name>
      <connection-url>jdbc:mpa:statement caching:statementCacheSize=50;realDriver=oracle.jdbc.driver.OracleDriver;realURL=jdbc:oracle:thin:@lzmpa88:1521:ORCL</connection-url>
      <driver-class>at.co.systema.jdbc.sc.StatementCachingDriver</driver-class>
      <user-name>mpa</user-name>
      kis
      </local-tx-datasource>
      <local-tx-datasource>
      <jndi-name>MPA_KAV</jndi-name>
      <connection-url>jdbc:odbc:KAV_IGV_VIEWS</connection-url>
      <driver-class>at.co.systema.jdbc.odbc.JdbcOdbcDriver</driver-class>
      <user-name/>

      </local-tx-datasource>
      <local-tx-datasource>
      <jndi-name>repo</jndi-name>
      <connection-url>jdbc:mpa:statement caching:statementCacheSize=50;realDriver=oracle.jdbc.driver.OracleDriver;realURL=jdbc:oracle:thin:@lzmpa88:1521:ORCL</connection-url>
      <driver-class>at.co.systema.jdbc.sc.StatementCachingDriver</driver-class>
      <user-name>mpa</user-name>
      kis
      </local-tx-datasource>


      I have tried to specify a dependency to the datasource in my MBean:

      user:service=JBossStartupBean
      jboss.jca:name=LZMPA88,service=DataSourceBinding


      but then I get the following error:

      Depends On Me: , ObjectName: user:service=WorkflowEngineBean
      state: CONFIGURED
      I Depend On: user:service=JBossStartupBean
      jboss.jca:name=LZMPA88,service=DataSourceBinding

      Depends On Me: ]
      at org.jboss.deployment.MainDeployer.checkIncompleteDeployments(MainDeployer.java:1135)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:589)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        • 1. Re: Accessing Database from MBean
          Amit Bhayani Newbie

          This exception is because your database connection pool isn't created. There is some problem in your *-ds.xml. The one that I can figure out is 'kis' after <user-name>mpa</user-name> tag. Is this password? It should come in tag. Also I would suggest you to make use of <check-valid-connection-sql> tag to make sure that connection is established.

          Amit.