Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-17852

Annotations in resource adapter module are not processed

XMLWordPrintable

      When a Resource Adapter is deployed as a JBoss module, and the ResourceAdapter metadata information, Inbound/Outbound connections are defined using the annotations, it fails to get started and activated.

      For example, if the module structure is like:

      [🎩 lgao@lins-p1 basic]$ tree target/modules/
      target/modules/
      └── org
          └── jboss
              └── ironjacamar
                  └── ra16out
                      └── main
                          ├── META-INF
                          │   └── ra.xml
                          ├── module.xml
                          └── ra16out.jar
      

      While, the META-INF/ra.xml file is an in-complete metadata connector:

      <?xml version="1.0" encoding="UTF-8"?>
      <connector xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                 http://java.sun.com/xml/ns/j2ee/connector_1_6.xsd"
                 version="1.6" metadata-complete="false">
      
          <vendor-name>Red Hat Middleware LLC</vendor-name>
          <eis-type>Test RA</eis-type>
          <resourceadapter-version>0.1</resourceadapter-version>
          <resourceadapter />
      
      

      All the connector metadata information are defined using annotations inside the ra16out.jar, like:

      @Connector(description = {"first", "second"}, displayName = {"disp1",
              "disp2"}, smallIcon = {"s1", "", "s3", ""}, largeIcon = {"l1",
              "l2", "", ""}, vendorName = "vendor", eisType = "type", version = "1.a", licenseRequired = true, licenseDescription = {
              "lic1", "lic2"}, reauthenticationSupport = true, transactionSupport = TransactionSupport.TransactionSupportLevel.LocalTransaction, authMechanisms = {
              @AuthenticationMechanism(credentialInterface = CredentialInterface.PasswordCredential),
              @AuthenticationMechanism(credentialInterface = CredentialInterface.GenericCredential, authMechanism = "AuthMechanism", description = {
                      "desc1", "desc2"})}, securityPermissions = {
              @SecurityPermission(permissionSpec = "spec1"),
              @SecurityPermission(permissionSpec = "spec2", description = {"d1",
                      "d2"})}, requiredWorkContexts = {TransactionContext.class,
              HintsContext.class})
      

      Please see: https://github.com/wildfly/wildfly/blob/28.0.0.Beta1/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/annorar/AnnoResourceAdapter.java#L47

      like:

      @ConnectionDefinition(connectionFactory = AnnoConnectionFactory.class, connectionFactoryImpl = AnnoConnectionFactoryImpl.class, connection = AnnoConnection.class, connectionImpl = AnnoConnectionImpl.class)
      

      Please see: https://github.com/wildfly/wildfly/blob/28.0.0.Beta1/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/annorar/AnnoManagedConnectionFactory.java#L44

      With the module set up, if you run the following CLI:

      /subsystem=resource-adapters/resource-adapter=ra:add(transaction-support=NoTransaction,module=org.jboss.ironjacamar.ra16out)
      /subsystem=resource-adapters/resource-adapter=ra/connection-definitions=cd:add(class-name=org.jboss.as.test.integration.jca.annorar.AnnoManagedConnectionFactory, jndi-name=java\:\/eis\/ra16anno)
      /subsystem=resource-adapters/resource-adapter=ra:activate()
      

      It will fail with exception message:

      org.jboss.jca.common.api.validator.ValidateException: IJ010075: The resource adapter metadata must contain either an outbound or inbound configuration
      

              rhn-engineering-lgao Lin Gao
              rhn-engineering-lgao Lin Gao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: