8 Replies Latest reply on Feb 6, 2014 5:54 AM by ankitceo2

    AS7 JCA Resource Adapter JNDI Not Binding

    bob_alam

      Hi,

      I have noticed that if my resource adapter is within a ear, the ear is deployed, but the rar is not deploying correctly. The same rar deploys correctly if it is outside the ear. This is a legacy application that works correctly in AS6/AS61

       

      I added proper declaration for the resource-adapter in standalone-full.xml, e.g.:

       

                         <resource-adapter>

                            <archive>

                              myapp.ear#myrar.rar

                          </archive>

                          <transaction-support>

                              NoTransaction

                          </transaction-support>

                          <connection-definitions>

                              <connection-definition class-name="com.test.connector.HelloWorldManagedConnectionFactory" jndi-name="java:/HelloWorldConnectionFactory" enabled="true" use-java-context="true" pool-name="HelloWorldConnectionFactory" use-ccm="true">

                                  <pool>

                                      <prefill>

                                          false

                                      </prefill>

                                      <use-strict-min>

                                          false

                                      </use-strict-min>

                                      <flush-strategy>

                                          FailingConnectionOnly

                                      </flush-strategy>

                                  </pool>

                                  <security>

                                      <application/>

                                  </security>

                                  <validation>

                                      <background-validation>

                                          false

                                      </background-validation>

                                      <use-fast-fail>

                                          false

                                      </use-fast-fail>

                                  </validation>

                              </connection-definition>

                          </connection-definitions>

                      </resource-adapter>

       

      However, after the server starts, the archive entry is changes to something like this:

                <resource-adapter> 

                            <archive>

                              myapp.ear

                          </archive>

                          .....

                          .....

                </resource-adapter> 

       

       

      Obviously this is incorrect.

       

      I experimented and found that if I pulled the rar out of the ear, (using appropriate archive value change for the resource-adapter), then I am able to successfully deploy both the rar and the ear. In that case, I see a message logged like the one below and my application works correctly.

       

      16:46:02,315 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-2) JBAS010401: Bound JCA ConnectionFactory [java:/HelloWorldConnectionFactory]

       

       

      Tried build #524 from Feb3. The error is there as well.

       

      Is this a known issue?

       

      Thanks in advance!

        • 1. Re: AS7 JCA Resource Adapter JNDI Not Binding
          r.reimann

          Yes, there is a recently closed issue concerning rar deployments inside an ear.

           

          https://community.jboss.org/message/714045#714045

          https://issues.jboss.org/browse/AS7-3560

           

          I did not yet verify the fix but i will do so on monday.

          • 2. Re: AS7 JCA Resource Adapter JNDI Not Binding
            r.reimann
            1 of 1 people found this helpful
            • 3. Re: AS7 JCA Resource Adapter JNDI Not Binding
              bob_alam

              Tried build #548. The issue of rar deployment inside an ear is fixed there. However, it looks like it regressed elsewhere. The rar outside the ear won't deploy any longer.

               

              09:51:48,344 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."helloworld.rar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."helloworld.rar".PARSE: Failed to process phase PARSE of deployment "helloworld.rar"
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]
              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_20]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_20]
              at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_20]
              Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: IJ010061: Unexpected element: connection-factories
              at org.jboss.as.connector.deployers.processors.DsXmlDeploymentParsingProcessor.deploy(DsXmlDeploymentParsingProcessor.java:85)
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]
              ... 5 more
              Caused by: org.jboss.jca.common.metadata.ParserException: IJ010061: Unexpected element: connection-factories
              at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:123)
              at org.jboss.jca.common.metadata.ds.DsParser.parse(DsParser.java:82)
              at org.jboss.as.connector.deployers.processors.DsXmlDeploymentParsingProcessor.deploy(DsXmlDeploymentParsingProcessor.java:80)
              ... 6 more

              09:51:48,360 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015871: Deploy of deployment "myapp.ear" was rolled back with no failure message

              • 4. Re: AS7 JCA Resource Adapter JNDI Not Binding
                jesper.pedersen

                Remove your -ds.xml file

                • 5. Re: AS7 JCA Resource Adapter JNDI Not Binding
                  bob_alam

                  Cool, that worked!!!

                   

                  As info with this build my legacy resource adapters was not deploying until I implemented hashCode() and equal() methods. This information might help someone. server.log had this information:

                   

                  Severity: ERROR
                  Section: 19.4.2
                  Description: A ResourceAdapter must implement a "public int hashCode()" method.
                  Code: com.test.connector.ResourceAdapterImpl

                  Severity: ERROR
                  Section: 19.4.2
                  Description: A ResourceAdapter must implement a "public boolean equals(Object)" method.
                  Code: com.test.connector.ResourceAdapterImpl

                  • 6. Re: AS7 JCA Resource Adapter JNDI Not Binding
                    ankitceo2

                    Hi Jesper,

                                  I too had the same problem and It also worked for me.But the thing I am worried about is that if we need to scrap this xml file completely then how and where are we gonna make those changes ,done in -ds.xml file? I mean how will I take care of the settings provided in -ds.xml in case the file -ds.xml requires the removal.

                     

                    Thanks

                    Ankit

                    • 7. Re: AS7 JCA Resource Adapter JNDI Not Binding
                      jesper.pedersen

                      There is no -ds.xml file for resource adapter deployments -- use the :resource-adapters: subsystem for configuration.

                      • 8. Re: AS7 JCA Resource Adapter JNDI Not Binding
                        ankitceo2

                        Hi Jesper,

                                      I made the changes to standalone.xml for   :resource-adapters but when I tried to deploy ear file, I can not see the the message "Bound JCA Connector" which kind of verifies that JCA connector has not become usable now. So when I try to look that up from within a bean , I am getting  NameNot found exception for JNDI.

                        Is there any other configuration I need to do for this JCA connector get bound during deployment time and it is usable for jndi lookup.

                         

                        Thanks

                        Ankit