4 Replies Latest reply on Oct 8, 2003 1:35 PM by kabirkhan

    Errors using resource adapter

    kabirkhan

      Hi,

      I am having great problems configuring a resource adapter for accessing Tamino.

      At Startup it seems to get bound fine
      INFO [ExMan] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=XATxCM,name=ExMan to JNDI name 'java:/ExMan'
      INFO [TxConnectionManager] Started
      INFO [NoTxConnectionManager] Starting
      [NonTransactional] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=NoTxCM,name=NonTransactional to JNDI name 'java:/NonTransactional'
      [NoTxConnectionManager] Started
      [TxConnectionManager] Starting
      [TaminoEmc] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=TaminoEmc to JNDI name 'java:/TaminoEmc'

      My tamino-ds.xml file is as follows:

      <local-tx-datasource>
      <!-- Needs Opta2000.jar -->
      <jndi-name>TaminoEmc</jndi-name>
      <connection-url>http://localhost/tamino/EMC</connection-url>
      <driver-class>com.softwareag.tamino.db.api.connector.spi.TaminoLocalTxManagedConnectionFactory</driver-class>
      <user-name>kab</user-name>
      welcome1
      </local-tx-datasource>


      My ejb-jar contains the following:

      <ejb-name>MenuStructureBean</ejb-name>
      :
      <resource-ref>
      <res-ref-name>eis/EmcDS</res-ref-name>
      <res-type>com.softwareag.tamino.db.api.connector.TaminoDataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      My jboss.xml contains this

      <ejb-name>MenuStructureBean</ejb-name>
      <resource-ref>
      <res-ref-name>eis/EmcDS</res-ref-name>
      <jndi-name>java:/TaminoEmc</jndi-name>
      </resource-ref>


      And finally here is my lookup code
      String resRefName = "java:comp/env/eis/EmcDS";
      InitialContext ic = new InitialContext();
      TaminoDataSource tds = (TaminoDataSource) ic.lookup(resRefName);
      connection = tds.getConnection();

      I get different errors depending on what I pass in:
      1) Looking up "java:comp/env/eis/EmcDS": I get a classcast exception saying a org.jboss.resource.adapter.jdbc.WrapperDataSource was actually returned
      2) Looking up "java:/eis/EmcDS": I get a NamingException saying "eis not bound"
      3) Looking up "java:/eis/EmcDS": I get a NamingException saying "eis not bound"

      From this I guess that 1) is the correct way of looking it up since it actually returns something. But why is it returning a WrapperDataSource, when I have set the res-type to be a TaminoDataSource?

      Thanks,

      Kab









        • 1. Re: Errors using resource adapter

          You should set it to
          javax.sql.DataSource

          Regards,
          Adrian

          • 2. Re: Errors using resource adapter
            kabirkhan

            Thanks, I tried that but am still getting the same error. Tamino comes with a sample tamino-service.xml file for use with JBoss 3.0. However, I understand the way of defining resource adapters has been changed in JBoss 3.2.1 (superseeded by -ds.xml files for RAR deployment?).

            I tried the supplied tamino-service.xml file

            <?xml version="1.0" encoding="UTF-8"?>

            <!-- ==================================================================== -->
            <!-- New ConnectionManager setup for Tamino -->
            <!-- ==================================================================== -->



            <depends optional-attribute-name="ManagedConnectionFactoryName">
            <!--embedded mbean-->


            MyTaminoLocalTxConnector


            <config-property name="TaminoURL" type="java.lang.String">http://localhost/tamino/mydb</config-property>
            <config-property name="UserName" type="java.lang.String">ejb</config-property>
            <config-property name="Password" type="java.lang.String">xxx</config-property>



            <!--Below here are advanced properties -->
            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Tamino Resource Adapter for local transactions



            <depends optional-attribute-name="ManagedConnectionPool">
            <!--embedded mbean-->


            0
            50
            5000
            15
            <!--criteria indicates if Subject (from security domain) or app supplied
            parameters (such as from getConnection(user, pw)) are used to distinguish
            connections in the pool. Choices are
            ByContainerAndApplication (use both),
            ByContainer (use Subject),
            ByApplication (use app supplied params only),
            ByNothing (all connections are equivalent, usually if adapter supports
            reauthentication)-->
            ByContainer



            <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

            <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

            java:/TransactionManager

            <!--make the rar deploy! hack till better deployment-->
            jboss.jca:service=RARDeployer




            this fails on start-up in 3.2.1, and I can't for the life of me figure out what is going on.

            The errors I get on startup are:
            22:15:31,609 INFO [ServiceConfigurator] Problem configuring service jboss.jca:service=LocalTxDS,name=MyTaminoLocalTxConnector
            org.jboss.deployment.DeploymentException: No Attribute found with name: JndiName

            at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:332)
            at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
            at org.jboss.system.ServiceConfigurator.processDependency(ServiceConfigurator.java:437)
            at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:350)
            at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
            at org.jboss.system.ServiceController.install(ServiceController.java:225)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy5.install(Unknown Source)
            at org.jboss.deployment.SARDeployer.create(SARDeployer.java:183)
            :
            :

            22:15:31,629 INFO [ServiceConfigurator] Problem configuring service jboss.jca:service=LocalTxCM,name=MyTaminoLocalTxConnector
            org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute: name=ManagedConnectionFactoryName value=jboss.jca:service=LocalTxDS,name=MyTaminoLocalTxConnector on mbean jboss.jca:service=LocalTxCM,name=MyTaminoLocalTxConnector; - nested throwable: (javax.management.AttributeNotFoundException: Writable attribute 'ManagedConnectionFactoryName' not found)
            at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:472)
            at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:357)
            at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
            at org.jboss.system.ServiceController.install(ServiceController.java:225)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy5.install(Unknown Source)
            at org.jboss.deployment.SARDeployer.create(SARDeployer.java:183)
            :
            :
            + nested throwable:
            javax.management.AttributeNotFoundException: Writable attribute 'ManagedConnectionFactoryName' not found
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.setAttribute(ReflectedMBeanDispatcher.java:190)
            at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:503)
            at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:468)
            at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:357)
            at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
            at org.jboss.system.ServiceController.install(ServiceController.java:225)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
            at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
            at $Proxy5.install(Unknown Source)
            at org.jboss.deployment.SARDeployer.create(SARDeployer.java:183)
            :
            :

            If somebody has encountered something similar I would be grateful if they could share their experiences. Should I be using a tamino-ds.xml file or a tamino-service.xml file? From what I can see I should be using a -ds.xml file as that invokes the RARDeployer rather than the SARDeployer? Or could it be that the RAR supplied by Tamino is only compatible with JBoss 3.0 and not 3.2.1 (I don't think this sounds very likely though)? Are there any guidelines for "translating" configurations of -service.xml files to -ds.xml files?

            Thanks

            • 3. Re: Errors using resource adapter

              Copy a -ds.xml and fill in the fields.
              e.g. Connection url, Driver class, jndi name, user, password.

              When you have it working, can you post it for others to use.

              Regards,
              Adrian

              • 4. Re: Errors using resource adapter
                kabirkhan

                I modified the tamino-service.xml file, so it now works with JBoss 3.2.1:

                <?xml version="1.0" encoding="UTF-8"?>

                <!-- ==================================================================== -->
                <!-- New ConnectionManager setup for Tamino -->
                <!-- ==================================================================== -->

                TaminoEmc


                <depends optional-attribute-name="ManagedConnectionPool">
                <!--embedded mbean-->


                0
                50
                5000
                15
                <!--criteria indicates if Subject (from security domain) or app supplied
                parameters (such as from getConnection(user, pw)) are used to distinguish
                connections in the pool. Choices are
                ByContainerAndApplication (use both),
                ByContainer (use Subject),
                ByApplication (use app supplied params only),
                ByNothing (all connections are equivalent, usually if adapter supports
                reauthentication)-->
                ByContainer

                <depends optional-attribute-name="ManagedConnectionFactoryName">
                <!--embedded mbean-->




                <config-property name="TaminoURL" type="java.lang.String">http://localhost/tamino/EMC</config-property>
                <config-property name="UserName" type="java.lang.String">kab</config-property>
                <config-property name="Password" type="java.lang.String">welcome1</config-property>



                <!--Below here are advanced properties -->
                <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Tamino Resource Adapter for local transactions





                <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

                <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

                <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager

                <!--make the rar deploy! hack till better deployment-->
                jboss.jca:service=RARDeployer




                Out of curiosity, how would I make this into a tamino-ds.xml file?