1 2 Previous Next 15 Replies Latest reply on Jul 7, 2015 10:06 AM by Martin Wortner

    How to deploy JCA connector wrapped in ear

    Martin Wortner Newbie

      I need to be able to deploy .ear file containing .rar resource adapter to jboss/wildfly. It has been working previously for GF. Problem is that in my .war file (which is also part of the .ear) I have this web.xml

          

         <resource-ref>

            <res-ref-name>eis/host</res-ref-name>

            <res-type>javax.resource.cci.ConnectionFactory</res-type>

            <res-auth>Container</res-auth>

            <res-sharing-scope>Shareable</res-sharing-scope>

          </resource-ref>

       

       

      and jboss cannot find the resource

       

       

       

          Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"HostConnector-ear-1.17-SNAPSHOT\".\"HostConnector-war-1.17-SNAPSHOT\".env.eis.host is missing          [jboss.naming.context.java.jboss.resources.eis.host]"]}

       

       

      I have created element in standalone.xml, but seams the naming is wrong or what

         

          <subsystem xmlns="urn:jboss:domain:resource-adapters:2.0">

                  <resource-adapters>

                      <resource-adapter id="Host-ra">

                          <archive>

                              HostConnector-1.17-SNAPSHOT-local#HostConnector-rar-1.17-SNAPSHOT.rar

                          </archive>

                          <connection-definitions>

                              <connection-definition class-name=".....jca.spi.HostManagedConnectionFactory" jndi-name="java:/env/eis/host-somehost" enabled="true" use-java-context="false" pool-name="java:jboss/env/eis/host-somehost"/>

                          </connection-definitions>

                      </resource-adapter>

                  </resource-adapters>

              </subsystem>

       

       

      I don't get what exactly I need to setup. I tried jboss-web.xml with resource-ref defined, but inside of .ear it is ignored. Now I'm experimenting with application.xml again to no avail.

      Can anybody please help with this.

        • 1. Re: How to deploy JCA connector wrapped in ear
          jaikiran pai Master

          Which exact version of JBoss AS7/WildFly is this? Do you have any jboss-web.xml? If yes, what does it look like?

          • 2. Re: How to deploy JCA connector wrapped in ear
            Martin Wortner Newbie

            It is 8.0.0

            I tried with this jboss-web.xml file(but this file is ignored if it is packaged inside .ear isn't it?)

            <!DOCTYPE jboss-web PUBLIC
              "-//JBoss//DTD Web Application 5.0//EN"
              "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
            <jboss-web>
              <context-root>/host</context-root>
              <resource-ref>
              <res-ref-name>eis/host</res-ref-name>
              <jndi-name>java:jboss/eis/host-somehost</jndi-name>
              </resource-ref>
            </jboss-web>

             

            Note: I don't know how to properly name it the error shown below made me think it should be java:/env/eis/host-somehost

            I suppose the .war file needs the resource-ref to be able to reference the connector, do I really need to have some configuration in standalone.xml.

            I'd like to just deploy the .ear without configuring always the name of the .rar.

            • 3. Re: How to deploy JCA connector wrapped in ear
              jaikiran pai Master

              You have to place that jboss-web.xml in the WEB-INF folder of the .war (which is within the .ear). Which means, just beside where your web.xml is currently is.

               

              But in this case, since Java EE 6 (or was it 5) you can just have your resource-ref in the web.xml to have a lookup-name element to point to the (container specific) JNDI name. So try updating your web.xml to contain this:

               

              <resource-ref>

                    <res-ref-name>eis/host</res-ref-name>

                    <res-type>javax.resource.cci.ConnectionFactory</res-type>

                    <res-auth>Container</res-auth>

                    <res-sharing-scope>Shareable</res-sharing-scope>

                    <!-- This should match the jndi-name in the subsystem configuration -->

                    <lookup-name>java:/env/eis/host-somehost</lookup-name>

              </resource-ref>

              • 4. Re: How to deploy JCA connector wrapped in ear
                Martin Wortner Newbie

                That should help(trying it out), however I'm not really clear about the naming. The lookup-name should refer to configuration in standalone.xml?. Is there a way how can I see my resource adapter in WF admin console?

                • 5. Re: How to deploy JCA connector wrapped in ear
                  jaikiran pai Master

                  The way, the resource-ref (and other portable ENC names) works is that it sets up a portable JNDI name within the application's environment naming context (ENC) to point to server specific resources. So the resource-ref-name is the ENC namespace relative portable JNDI name ( java:comp/env/eis/host) and for the server to be able to point to the right resource, it needs certain hints. Using the lookup-name is one such hint to point to an already existing JNDI resource within the server and that JNDI name is potentially application server specific (like in this case java:/env/eis/host-somehost that you have setup in the standalone.xml)

                   

                  Martin Wortner wrote:

                   

                  Is there a way how can I see my resource adapter in WF admin console?

                  This, I don't know because I rarely use the admin console.

                  • 6. Re: How to deploy JCA connector wrapped in ear
                    Martin Wortner Newbie

                    Hi, now I have in my standalone.xml JNDI name java:jboss/eis/some-host in my web.xml I have

                    <resource-ref>

                        <res-ref-name>eis/host</res-ref-name>

                        <res-type>javax.resource.cci.ConnectionFactory</res-type>

                        <res-auth>Container</res-auth>

                        <res-sharing-scope>Shareable</res-sharing-scope>

                        <lookup-name>java:jboss/eis/some-host</lookup-name>

                      </resource-ref>


                    And it is still not working

                    • 7. Re: How to deploy JCA connector wrapped in ear
                      jaikiran pai Master

                      Martin Wortner wrote:

                       

                          <lookup-name>java:jboss/eis/some-host</lookup-name>

                        </resource-ref>

                      And it is still not working

                      That value doesn't look right. Please see a previous post of mine in this thread, where I have used a different value for this element. If that still doesn't work, please post the (new) entire exception stacktrace.

                      • 8. Re: How to deploy JCA connector wrapped in ear
                        Martin Wortner Newbie

                        I'm lost just trying out the names randomly. Why is the name wrong ? Should it be java:global/eis/some-host? or java:global/env/eis/some-host(this is using ENC and I don't need it right)? Note: I'm trying all the day all possible combination nothing seams to work.

                         

                        Can you confirm that lookup-name in web.xml and jndi-name in connection-definition from standalone.xml must much.

                         

                        Thanks

                        • 9. Re: How to deploy JCA connector wrapped in ear
                          jaikiran pai Master

                          Here's the snippet that I posted earlier:

                           

                          <resource-ref>

                                <res-ref-name>eis/host</res-ref-name>

                                <res-type>javax.resource.cci.ConnectionFactory</res-type>

                                <res-auth>Container</res-auth>

                                <res-sharing-scope>Shareable</res-sharing-scope>

                                <!-- This should match the jndi-name in the subsystem configuration -->

                                <lookup-name>java:/env/eis/host-somehost</lookup-name>

                          </resource-ref>

                           

                           

                          Use that same value for lookup-name element. Like I noted in my comment there, it should match teh jndi-name attribute that you have used in the subsystem configuration which is (based on your earlier post):

                           

                          <connection-definition class-name=".....jca.spi.HostManagedConnectionFactory" jndi-name="java:/env/eis/host-somehost" ......

                          • 10. Re: How to deploy JCA connector wrapped in ear
                            Martin Wortner Newbie

                            08:35:51,122 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "HostConnector-ear-1.17

                            -SNAPSHOT-local.ear")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"HostConnector-ear-1.17-SNAPSHOT-loc

                            al\".\"HostConnector-war-1.17-SNAPSHOT\".env.eis.host is missing [jboss.naming.context.java.env.eis.host-somehost]"]}

                             

                            standalone.xml

                                    <subsystem xmlns="urn:jboss:domain:resource-adapters:2.0">

                                        <resource-adapters>

                                            <resource-adapter id="ra">

                                                <archive>

                                                    HostConnector-1.17-SNAPSHOT-local#HostConnector-rar-1.17-SNAPSHOT.rar

                                                </archive>

                                                <connection-definitions>

                                                    <connection-definition class-name="......jca.spi.ManagedConnectionFactory" jndi-name="java:/env/eis/host-somehost" enabled="true" use-java-context="false" pool-name="SomePool"/>

                                                </connection-definitions>

                                            </resource-adapter>

                                        </resource-adapters>

                                    </subsystem>

                             

                            web.xml

                              <resource-ref>

                                <res-ref-name>eis/host</res-ref-name>

                                <res-type>javax.resource.cci.ConnectionFactory</res-type>

                                <res-auth>Container</res-auth>

                                <res-sharing-scope>Shareable</res-sharing-scope>

                                <lookup-name>java:/env/eis/host-somehost</lookup-name>

                              </resource-ref>


                            • 11. Re: How to deploy JCA connector wrapped in ear
                              jaikiran pai Master

                              At this point, I can only guess that the JNDI name specified in the subsystem configuration isn't being bound to. Why that's happening, I don't know. Maybe you are having that config in some different standalone/domain xml than the one you are using to bootup the server? If you have a reproducible application to reproduce this, please attach it to this thread. Someone might take a look. You should probably even attach the complete server.log from the time you boot the server till you notice this exception.

                              • 12. Re: How to deploy JCA connector wrapped in ear
                                Martin Wortner Newbie

                                I can see the resource adapter in console with following JNDI name java:/env/eis/isohost-localcsas. Isn't it possible thath I must use java:global for the resource adapter to be globally visible?

                                • 13. Re: How to deploy JCA connector wrapped in ear
                                  jaikiran pai Master

                                  The java:global is just a EE (portable) namespace. The java:/ namespace too is a server level "global" namespace accessible to all applications. So it doesn't actually matter whether you use java:global namespace in this case.

                                  • 14. Re: How to deploy JCA connector wrapped in ear
                                    Martin Wortner Newbie

                                    No success still, I'm blind shooting. I guess the best will be to get some working example with .rar embedded in .ear file, but so far I have found nothing useful.

                                    1 2 Previous Next