0 Replies Latest reply on Feb 9, 2011 1:34 AM by Phil Krasko

    How to override providerAdapterJNDI in @MessageDriven bean? Naming alias?

    Phil Krasko Newbie

      JBoss 4.2.3GA

       

      I have an application that needs to connect to a remote JMS topic (another JBoss box).

      For the deployment of this application I have a *-ds.xml file to specify the remote JMS provider ("RemoteJmsProvider").

      The MDB is using annotations and I have specified one @ActivationConfigProperty that sets the "providerAdapterJNDI" to java:/RemoteJmsProvider.

       

      Everything works perfect as of now.

       

      The question is how do I reconfigure this when I deploy the application on the same JBoss instance that is hosting the topic that I need to connect to?  In this scenario a remote jms provider should no longer be required.

       

      I've attempted to create a naming alias to map the java:/RemoteJmsProvider to the local DefaultJmsProvider.  I'm not sure if this will work, but I've always ending up with a javax.naming.NameNotFoundException: RemoteJmsProvider not bound.

       

      Here is the naming alias I created in a *-service.xml file within my deploy directory:

       

      <mbean code="org.jboss.naming.NamingAlias"

               name="jboss.mq:service=NamingAlias,fromName=RemoteJmsProvider">

          <attribute name="FromName">RemoteJmsProvider</attribute>

          <attribute name="ToName">DefaultJMSProvider</attribute>

      </mbean>

       

      Is this a valid use of the naming alias? 

      Has anyone encountered similar issues?