2 Replies Latest reply on Dec 19, 2003 7:05 AM by Simone Mosciatti

    connecting fierebird with JBOSS (using bean)

    anny_lut Newbie

      I have a problem in using FB connection resource in bean:

      1) I am begginer in JBOSS3

      2) In file /deploy/firebird-ds.xml I describe my resource:
      <tx-connection-factory>
      <jndi-name>BARSDB</jndi-name>
      <xa-transaction/>
      <adapter-display-name>FirebirdDC</adapter-display-name>
      <config-property name="Database"
      type="java.lang.String">firebird_host/3050:D:/KB_BUDG.GDB
      </config-property>
      <user-name>sysdba</user-name>
      masterkey
      <min-pool-size>10</min-pool-size>
      </tx-connection-factory>

      3) All files for FB connection move to /lib
      concurrent.jar
      connector.jar
      jaas.jar
      jmxri.jar
      jta-spec1_0_1.jar
      log4j-core.jar

      4) Using (jmx-console) http://jboss_host/jmx-console/index.jsp
      I see my resource:

      jboss.jca
      ------------
      name=BARSDB,service=ManagedConnectionFactory
      name=BARSDB,service=ManagedConnectionPool
      name=BARSDB,service=TxCM

      5) In my bean I look for resource BARSDB:
      static final String DATASOURCE="java:comp/env/jdbc/BARSDS";
      InitialContext initial = new InitialContext();
      DataSource ds = (DataSource) initial.lookup(DATASOURCE);

      6) In descriptor file "my_bean/resource/ejb-jar.xml" I have
      reference for my resource
      -----------
      <enterprise-beans>
      ....
      <resource-ref>
      BARS DataSource
      <res-ref-name>jdbc/BARSDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      ....
      </enterprise-beans>


      7) In jboss descriptor file "my_bean/resource/jboss.xml"
      I describe my resource "BARSDS" as:
      -----------
      <resource-managers>
      ....
      <resource-manager res-class="java.sql.DataSource">
      <res-name>jdbc/BARSDS</res-name>
      <res-jndi-name>java:/BARSDB</res-jndi-name>
      </resource-manager>
      ....
      <resource-managers>


      8) While entering such command in bean:
      DataSource ds = (DataSource) initial.lookup(DATASOURCE);

      I get an eror:
      2003-12-18 11:13:57,786 ERROR [STDERR] javax.naming.NamingException: Could not dereference object. Root exception is
      2003-12-18 11:13:57,786 ERROR [STDERR] javax.naming.NameNotFoundException: BARSDB not bound


      9) While deploying file firebird-ds.xml
      I have such DEBUG message in server.log
      ......
      2003-12-18 11:12:32,553 DEBUG [org.jboss.management.j2ee.LocalJBossServerDomain] handleNotification: javax.management.Notification[source=jboss.system:service=ServiceDeployer,type=org.jboss.deployment.SubDeployer.start,sequenceNumber=101,timeStamp=1071738752553,message=null,userData=org.jboss.deployment.DeploymentInfo@30254464 { url=file:/D:/java/appsrv/jboss.net/server/all/deploy/firebird-ds.xml }
      deployer: org.jboss.deployment.XSLSubDeployer@114460
      status: Starting
      state: START_DEPLOYER
      watch: file:/D:/java/appsrv/jboss.net/server/all/deploy/firebird-ds.xml
      lastDeployed: 1071738752513
      lastModified: 1071738754000
      mbeans:
      jboss.jca:service=FirebirdManager state: Started
      jboss.jca:service=TxCM,name=BARSDB state: Stopped
      jboss.jca:service=ManagedConnectionPool,name=BARSDB state: Stopped
      jboss.jca:service=ManagedConnectionFactory,name=BARSDB state: Stopped

      2003-12-18 11:12:32,553 DEBUG [org.jboss.management.j2ee.JCAResource] Could not create JSR-77 JCAResource: BARSDB
      java.lang.NullPointerException
      at org.jboss.management.j2ee.J2EEResource.getParentKeys(J2EEResource.java:68)
      at org.jboss.management.j2ee.J2EEManagedObject.(J2EEManagedObject.java:145)
      at org.jboss.management.j2ee.J2EEResource.(J2EEResource.java:52)
      ......


      10) I think the problem in FB resource deployment, because this bean
      correcly works with such resource BARSDB while connecting to
      ORACLE. (I using this resource name NOT simultaneously)
      for ORACLE I have file "oracle-ds.xml"

      <local-tx-datasource>
      <jndi-name>BARSDB</jndi-name>
      <connection-url>
      jdbc:oracle:thin:@oracle_host:1521:SID_NAME
      </connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>user</user-name>
      passwd
      <exception-sorter-class-name>
      org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      </local-tx-datasource>


      What is the problem???

      I'll be glad for any reply!!!!!