7 Replies Latest reply on Aug 6, 2002 11:32 PM by winghoe

    Changing ConnectionFactory to another name?

    winghoe

      Hi,
      I'm wondering if it is possible to change the default ConnectionFactory to another name, for example, MyConnectionFactory?

      I have been given some classes that refers to MyConnectionFactory and I can't change it to ConnectionFactory, which JBoss insist on using. I tried using <resource-ref> tag in the deployment descriptor jboss.xml to map it, but it doesn't seem to be working.

      <resource-ref>
      <res-ref-name>MyConnectionFactory</res-ref-name>
      <jndi-name>java:/ConnectionFactory</jndi-name>
      </resource-ref>

      Any thoughts?

      Wing Hoe

        • 1. Re: Changing ConnectionFactory to another name?
          schaefera

          Hi

          In 2.4.x go to jboss.jcml, in 3.0 go to jbossmq-service.xml and look for the NamingAlias MBean.

          You can add now a new NamingAlias and map ConnectionFactory to MyConnectionFactory (like we mapped the QueueConnectionFactory to ConnectionFactory).

          Have fun - Andy

          • 2. Re: Changing ConnectionFactory to another name?
            winghoe

            Andy,
            Are you talking about the example below:


            ConnectionFactory
            QueueConnectionFactory


            I extracted this from jboss.jcml(2.4.4). Can't see it in JBoss 3 though.

            I use the same code in jbossmq-service.xml?

            Wing Hoe

            • 3. Re: Changing ConnectionFactory to another name?
              winghoe

              Andy,
              Are you talking about the example below:


              ConnectionFactory
              QueueConnectionFactory


              I extracted this from jboss.jcml(2.4.4). Can't see it in JBoss 3 though.

              I use the same code in jbossmq-service.xml?

              Wing Hoe

              • 4. Re: Changing ConnectionFactory to another name?
                schaefera

                Hi

                Yes, use the same XML snippet but rename "DefaultDomain" to "jboss.mq".

                Have fun - Andy

                • 5. Re: Changing ConnectionFactory to another name?
                  winghoe

                  I was reading the QuickDraft. In the Naming chapter, it seems like it's possible to do the following:

                  ejb-jar.xml
                  ---------------------------------
                  <resource-ref>

                  <res-ref-name>SGConnectionFactory</res-ref-name>
                  <res-type>javax.jms.QueueConnectionFactory</res-type>
                  <res-auth>Container</res-auth>
                  </resource-ref>

                  jboss.xml
                  ---------------------------------
                  <resource-ref>
                  <res-ref-name>SGConnectionFactory</res-ref-name>
                  <jndi-name>ConnectionFactory</jndi-name>
                  </resource-ref>

                  From QuickDraft, it seems like I'm able to create such association, so I supposedly can match the SGConnectionFactory in my MDB to JBoss's default ConnectionFactory.

                  However, it doesn't seem to work that way when I tried to deploy it over JBoss 3. Is it possible actually? Or do I still have to use the AliasNaming stuff?

                  Wing Hoe

                  • 6. Re: Changing ConnectionFactory to another name?
                    schaefera

                    Hi

                    Resource References are local JNDI name mapping which are specific to an EJB. So you could avoid naming conflicts when the deployer has to rename the JNDI name for whatever reason. So the EJB can use the same local JNDI name even when the actual JNDI name changes later on.
                    But with a Resource Ref the JNDI name starts with a certain prefix: "java:/comp/env".

                    Have fun - Andy

                    • 7. Re: Changing ConnectionFactory to another name?
                      winghoe

                      You mean, the <res-ref-name> tag must have the prefix of java:/comp/env followed by the JNDI name that I use?

                      Anyway, the NamingAlias stuff is working, for both the ConnectionFactory and the Queue.

                      Thanks for the tip, Andy.

                      Wing Hoe