4 Replies Latest reply on Nov 15, 2002 4:58 PM by Don Lind

    blah-service.xml deployment  questions

    Don Lind Newbie

      I have three questions at the end of this... But first, the background information:

      I have created a JCA adapter, myJCA.rar, that is really for an EIS (as opposed to a wrapper for a JDBC driver). It supports XA transactions.

      I did my initial development under the Sun reference implementation J2EE App Server where, via their "deploytool", I gave my adapter the JNDI Name of "myEIS". My JCA adapter's ra.xml file includes the basic connection configuration like serverName and portNumber.

      Things generally worked ok under the reference implementation.

      This same RAR deploys under JBoss 3.0.4 (on Windows 2000), but isn't accessible because JBoss never registers a JNDI Name for the adapter (I know... 'cause I hadn't yet told it the JNDI name to use).

      After having deployed my myJCA.rar into JBoss, the jmx console shows me this:

      MBean View

      MBean Name: Domain Name: jboss.jca
      service: RARDeployment
      name: My JCA Adapter
      MBean Java Class: org.jboss.resource.RARDeployment

      MBean description:
      Description of a deployed Resource Adapter

      List of MBean Attributes:
      DisplayName = My JCA Adapter
      ManagedConnectionFactoryClass =
      TransactionSupport = 2
      AuthMechType = BasicPassword
      ReauthenticationSupport = false
      ServerName = Don
      Password = asecret
      PortNumber = 1099
      UserName = SysAdmin
      ConnectionURL = vwrouter

      No operations are listed for the RAR mbean.

      The above MBean attributes come directly from the ra.xml file that is part of the RAR deployment information for myJCA.rar.

      After some reading, I decided that I needed to create a myJCA-service.xml file to supply the JNDI Name (for my adapter) to JBoss so that it would register the name for me.

      After *lots* of reading and trial and error, I finally got things to pretty much work with the following myJCA-service.xml file.

      <?xml version="1.0" encoding="UTF-8"?>

      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=My JCA Adapter

      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->

      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports

      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager
      <!--make the rar deploy! hack till better deployment-->

      I basically plagarized the above file from other *-service.xml files. I have not found much information on the *semantics* of the contents of this xml file, so there is probably some unnecessary stuff in there. I made many attempts with simpler versions of this file, leaving out stuff that didn't look important to me or didn't seem pertinent to my JCA adapter. Ha. :-) That always resulted in significant flames and other explosions. But the above file seems to work.

      I kind of expected that my myJCA-service.xml file would somehow just hook a JNDI name onto my resource adapter. Silly me. :-)

      Putting the above xml file into the deploy directory causes JBoss to create another MBean that, in the jmx console, looks like this:

      MBean View

      MBean Name: Domain Name: jboss.jca
      service: XATxDS
      name: My JCA Adapter
      MBean Java Class: org.jboss.resource.connectionmanager.RARDeployment

      MBean description:
      Management Bean.

      List of MBean attributes:
      JndiName = myEIS
      DisplayName = My JCA Adapter
      ManagedConnectionFactoryClass =
      OldRarDeployment =
      jboss.jca:service=RARDeployment,name=My JCA Adapter

      List of MBean operations:

      This MBean has the JndiName that my bean looks up to find my adapter.
      The OldRarDeployment seems to be pointing to the "real" RAR that "is" my JCA Adapter.
      All other MBean attributes for this guy are null.

      At this point, my bean can successfully look up and use my myJCA adapter... things basically seem to work.

      My questions:

      1. Am I staggering down a reasonably correct path for JBoss deployment? Is it expected that I'd have two MBeans for my adapter?

      2. In my myJCA-service.xml file, the embedded bean is specified with name="jboss.jca:service=XATxDS,name=My JCA Adapter". Is XATxDS the right thing for my adapter? I'm not wrapping a JDBC Driver. And the XATxDS name might be implying a "DataSource" of some sort (pure guessing on my part). Am I ok with XATxDS? It seems to work, at least so far...

      3. Why doesn't JBoss call my resource adapter's setServerName and setPortNumber methods and tell me about the server name and port number values specified in the ra.xml file? Sun's reference implementation calls my adapter with that info. JBoss obviously sees the attributes (they're visible the RAR's "deployment MBean"). Do I need to "re-specify" them as attributes within my myJCA-service.xml file? Or is there some way to configure the adapter's "Management Bean" get the info from the adapter's "Deployment Bean"? I just hate to specify that kind of information in two separate places...



        • 1. Re: blah-service.xml deployment  questions
          David Jencks Master

          Good work! You did everything right, and I don't see anything excess in your *-service.xml file.

          1) My idea is that the .rar and ra.xml say "here's a driver, use it how you will", and the first mbean you get by deploying the .rar indicates that the driver is available and what the capabilities are (thus the contents of the ra.xml are visible as mbean attributes, but it doesn't do anything).

          Then, if you want to hook up to an EIS instance, you have to supply more specific info, especially the jndi name, pooling info, usually some info on where the EIS is, etc. This goes in the *-service.xml file, in the config for the 3 mbeans. If you want to connect to 2 EIS instances, you still only need one copy of the .rar: the config info is separate, in the mbean configurations.

          Opinions may differ on the wisdom of this scheme, but it is how it works now.

          2) The "DS" in the mbean name is completely arbitrary: the only requirement is that mbean names be unique in an mbean server. In particular, the "DS" part of that mbean name was not a very appropriate choice... MCF would be better.

          3) The config-property values in the ra.xml are used as defaults, if present. If you want to supply a different value, include an e.g.

          <config-property name="ServerPort" type="java.lang.Integer">1111</config-property> (I think I got it right, check an example) element after the jndi-name element. Generally I'd recommend not specifying deployment-specific values as defaults in the ra.xml.

          Hope this answers your questions. BTW I follow the mailing lists much more often than this forum.

          • 2. Re: blah-service.xml deployment  questions
            Don Lind Newbie


            I'm not sure I understand the #3 answer completely... my ra.xml includes some config properties, for example:
            My EIS Port Number

            And, under Sun's reference app server, the app server calls my adapter's setPortNumber method with the value "9876" to give my adapter some configuration info.

            But, under JBoss, my adapter isn't getting that call.

            You said that the ra.xml values were "defaults, if present." Does that mean that the person doing the deployment should adjust the myEIS-service.xml contents based on the ra.xml contents to manually move "the defaults" over if he wants them? 'cause it doesn't seem to be happening automatically.

            If that's "as intended," that's OK... But if the "config" values in my ra.xml are supposed to somehow automatically propagated as defaults for the "deployment mbean" so that JBoss tells my adapter about them, that's not happening (far as I can see).

            I understand your point that it might be better to let the -service.xml file do the specific configuration for an adapter. But we have some configurable info that is very likely to not be changing much, and it might be nice to put it out at the ra.xml level and let it default that way (if it can be done). If that isn't how things generally work, we can live with that.

            Again, THANKS for your help.


            • 3. Re: blah-service.xml deployment  questions
              David Jencks Master

              The values from ra.xml should be used if no value is supplied in the *-service.xml file. I thought this was working fine. Could you double check and file a bug assigned to me?

              david jencks

              • 4. Re: blah-service.xml deployment  questions
                Don Lind Newbie

                I verfied that if I put my values into my *-service.xml file, that JBoss called my adapter, but if the values were only in the ra.xml file, I got no calls. Both JBoss 3.0.2 and 3.0.4 seem to be... uhhh... challenged in this respect. :-)

                See bug 639102.

                Again, David: *THANKS* for your help... I'm off and running again...