2 Replies Latest reply: Mar 22, 2012 4:36 PM by Frank Langelage RSS

resource-adapter and connection-definition problems

Frank Langelage Master

I'm still struggling a bit with Resource Adapters and Connection Definitions.

 

My standard-full.xml contains the resource adapter without any connections on a clean startup.

            <resource-adapter>
                <archive>controller.rar</archive>
            </resource-adapter>

 

When deploying my app, the cli is used to define a connection definiton using this commands:

connect

/subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev:add(jndi-name="java:/eis/maj2e-langfr-dev/ControllerConnector",class-name="biz.mbisoftware.fn.jca.controllerconnector.ManagedConnectionFactoryImpl",enabled="true")

/subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=ClientService:add(value=JCAClient)

/subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=SocketTimeout:add(value=0)

/subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=Encoding:add(value=ISO-8859-15)

/subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=ServerName:add(value=sb2000)

/subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=PortNumber:add(value=6506)

 

The outcome of all commands is success.

 

After that I can see the connection using the web console. It's there, it's enabled, and all properties are set as requested.

When I shut down JBoss AS7 now, the entry is in standalone-full.xml.

            <resource-adapter>
                <archive>
                    controller.rar
                </archive>
                <connection-definitions>
                    <connection-definition class-name="biz.mbisoftware.fn.jca.controllerconnector.ManagedConnectionFactoryImpl" jndi-name="java:/eis/maj2e-langfr-dev/ControllerConnector" enabled="true" pool-name="maj2e-langfr-dev">
                        <config-property name="ClientService">JCAClient</config-property>
                        <config-property name="SocketTimeout">0</config-property>
                        <config-property name="Encoding">ISO-8859-15</config-property>
                        <config-property name="ServerName">sb2000</config-property>
                        <config-property name="PortNumber">6506</config-property>
                    </connection-definition>
                </connection-definitions>
            </resource-adapter>

 

The jndi lookup of my application fails with NameNotFoundException.

I recognized, I do not see a "bound to jndi" message on console output / file logging like this on restart with the enhanced standalone-full.xml:

22:46:37,517 INFO  [org.jboss.as.deployment.connector#bindConnectionFactory] JBAS010406: Registered connection factory java:/eis/maj2e-langfr-dev/ControllerConnector

22:46:37,566 INFO  [org.jboss.as.deployment.connector#transition] JBAS010401: Bound JCA ConnectionFactory [java:/eis/maj2e-langfr-dev/ControllerConnector]

 

But the weird thing is, that this doe not happen every time.

 

Anyone having similar problems or an idea how to find out what the problem is?

  • 1. Re: resource-adapter and connection-definition problems
    Stefano Maestri Expert

    You are missing the :activate operation as last operation.

     

    /subsystem=resource-adapters/resource-adapter=controller.rar:activate

     

    Since you are creating the connection-definitions via cli (and so probably after rar deployments) you need to call this operation to activate the new configuration against the already deployed rar.

    When you say that is not happen every time I guess it's becasue when you restart the server the config is already there and ready before the rar deployment.

     

    regards

    S.

  • 2. Re: resource-adapter and connection-definition problems
    Frank Langelage Master

    Thanks four your support, but this does not work for me.

    BTW I'm using the current sources from github build myself.

     

    The file now looks like this:

    connect

    /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev:add(jndi-name="java:/eis/maj2e-langfr-dev/ControllerConnector",class-name="biz.mbisoftware.fn.jca.controllerconnector.ManagedConnectionFactoryImpl",enabled="true")

    /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=ClientService:add(value=JCAClient)

    /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=SocketTimeout:add(value=0)

    /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=Encoding:add(value=ISO-8859-15)

    /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=ServerName:add(value=sb2000)

    /subsystem=resource-adapters/resource-adapter=controller.rar/connection-definitions=maj2e-langfr-dev/config-properties=PortNumber:add(value=6506)

    /subsystem=resource-adapters/resource-adapter=controller.rar:activate

     

    I get 7 times {"outcome" => "success"} from jboss-cli.

    But on the console output I see an error message and nothing about the jndi-name bound:

    21:01:31,184 ERROR [org.jboss.msc.service.fail#startFailed] MSC00001: Failed to start service jboss.ra.deployment."controller.rar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."controller.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: controller isn't registered

        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:127)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]

        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

    Caused by: org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: controller isn't registered

        at org.jboss.jca.core.mdr.SimpleMetadataRepository.getResourceAdapter(SimpleMetadataRepository.java:150)

        at org.jboss.as.connector.metadata.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:87)

        ... 5 more

     

    21:01:31,313 INFO  [org.jboss.as.controller#tick] JBAS014774: Service status report

    JBAS014777:   Services which failed to start:      service jboss.ra.deployment."controller.rar_1": org.jboss.msc.service.StartException in service jboss.ra.deployment."controller.rar_1": org.jboss.jca.core.spi.mdr.NotFoundException: IJ000855: controller isn't registered

     

    I attached the controller.rar. controller.rar is in the deployments folder and it's referenced in the standalone-full.xml as mentioned in my first mail. Only resource-adapter, no connection-definitions.

    After startup of jbossas I use

    $JBOSS_HOME/bin/jboss-cli.sh --controller=localhost:9990 --user=xxx --password=xxx --file=maj2e-langfr-dev-cc-ds.xml

    to provide the connections-definition.