3 Replies Latest reply on Dec 13, 2012 2:27 PM by Ramesh Reddy

    Unable to bound Resource Adapter Connection after creating Connection Definition, using Management API

    Kamran Muhammad Newbie

      Hi Everyone!

      I have been able to create a connection definition using Jboss Management API but it's jndi name is not available until i restart jboss.

      Even i also used the jboss console web application to create resource adapter connection, same problem. 

      Basically it does not bound JCA Connection Factory right after create but it's get created in standalone.xml. Following is the code snippet:

       

      JBoss 7.1.0.Final

       

      ModelNode request = new ModelNode();

                                    request.get("enabled").set("true");

                                    request.get(ClientConstants.OPERATION_HEADERS).get("allow-resource-service-restart").set(Boolean.TRUE);

                                    request.get(ClientConstants.OP).set(ClientConstants.ADD);

                                    request.get(ClientConstants.OP_ADDR).add("subsystem","resource-adapters");

                                    request.get(ClientConstants.OP_ADDR).add("resource-adapter","teiid-connector-file.rar");

                                    request.get(ClientConstants.OP_ADDR).add("connection-definitions","test");

                                    request.get("jndi-name").set("java:/test");

                                    request.get("class-name").set("com.lgc.RS");

                                    request.get("pool-prefill").set(Boolean.FALSE);

                                    request.get("min-pool-size").set(5);

                                    request.get("max-pool-size").set(10);

       

       

                                    client = jbossAdmin.getClient();

                                    ModelNode response = client.execute(new OperationBuilder(request).build());

       

      response :

       

      outcome : success

       

       

      Same is the case with remove, when i remove connection definition, it's jndi name is still registered, it's not unbound, what should i add here:

       

      ModelNode request = new ModelNode();

                                    request.get(ClientConstants.OP).set("remove");

                                    request.get(ClientConstants.OP_ADDR).add("subsystem", "resource-adapters");

                                    request.get(ClientConstants.OP_ADDR).add("resource-adapter", "teiid-connector-file.rar");

                                    request.get(ClientConstants.OP_ADDR).add("connection-definitions","test");

                                    request.get("operation-headers").get("allow-resource-service-restart").set(true);

       

       

                                    client = jbossAdmin.getClient();

                                    client.execute(new OperationBuilder(request).build());

       

       

       

      Anything wrong here?

       

      Please help me in this regard,

       

      Thanks you

        • 1. Re: Unable to bound Resource Adapter Connection after creating Connection Definition, using Management API
          Ramesh Reddy Master

          Kamran,

           

          Take a look at the AdminFactory.java class for a code to create a ConnectionFactory and removing it. As per the issue of not deleting it see https://issues.jboss.org/browse/TEIID-2035

           

          Ramesh..

          • 2. Re: Unable to bound Resource Adapter Connection after creating Connection Definition, using Management API
            Kamran Muhammad Newbie

            Thanks Ramesh .

            i have gone through AdminFactory.java  . but there is no code that activates a connection-defination. only relevant method i could found is activateConnectionFactory.

            However i tried activateConnectionFactory method approach. by running the activate command on my resource adapter.

            Following way. the return model node has success response. however there is error on jboss console. and it does not active the connections.

             

            code is following :

             

             

             

             

             

             

             

            ModelNode refresh =

            new

            ModelNode();

            refresh.get(ClientConstants.OP_ADDR).add("subsystem","resource-adapters"

            );

            refresh.get(ClientConstants.OP_ADDR).add("resource-adapter"

            ,archiveName);

            refresh.get(ClientConstants.OP).set("activate"

            );

             

             

            //client is ModelControllerClient

             

            client = jbossAdmin.getClient();

            //get client

            refreshResponse = client.execute(new OperationBuilder(refresh).build());

             

             

            jbossAdmin.safeClose(client);

             

            error on jboss log is following

             

            22:48:59,611 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC0000
            1: Failed to start service jboss.ra.deployment."insiteconnect.rar_1": org.jboss.
            msc.service.StartException in service jboss.ra.deployment."insiteconnect.rar_1":
            org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: insiteconnect isn't reg
            istered
                    at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeployme
            ntService.start(ResourceAdapterXmlDeploymentService.java:127)
                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
            rviceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
            rollerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
            utor.java:886) [rt.jar:1.6.0_27]
                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
            .java:908) [rt.jar:1.6.0_27]
                    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
            Caused by: org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: insiteconnect
            isn't registered
                    at org.jboss.jca.core.mdr.SimpleMetadataRepository.getResourceAdapter(Si
            mpleMetadataRepository.java:150)
                    at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeployme
            ntService.start(ResourceAdapterXmlDeploymentService.java:87)
                    ... 5 more

            22:48:59,689 INFO  [org.jboss.as.controller] (management-handler-thread - 33) JB
            AS014774: Service status report
            JBAS014777:   Services which failed to start:      service jboss.ra.deployment."
            insiteconnect.rar_1": org.jboss.msc.service.StartException in service jboss.ra.d
            eployment."insiteconnect.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException: I
            J000855: insiteconnect isn't registered

             

            on jboss re-start the resource adapter is available.

            Thanks

            Kamran

            • 3. Re: Unable to bound Resource Adapter Connection after creating Connection Definition, using Management API
              Ramesh Reddy Master

              Kamran,

               

              The AdminFactory code works, as that is used in Teiid Designer for creating the Connection Factories. From your code

               

              resource-adaptor-name != archive name

               

              the code you posted using the "archive name".  Also look at the bug I mentioned, with AS 7.1.1 only one connection factory for the first time can be added, if you want to delete and add it back it fails. It is fixed on AS 7.2 Alpha builds. The deployment-name you give during the resource-adaptor creation is not same once the AS restarts. Yes, it is quite confusing.

               

              Ramesh..