5 Replies Latest reply on Aug 19, 2009 3:43 AM by bjvermeulen

    Connecting to remote JMS: name TopicConnectionFactory not bound

    bjvermeulen

      Dear all,

       

      I'm trying to send messages from and to a remote JMS (activemq) (it is on localhost now for testing purposes). However, I keep getting error messages no matter how I try. The message is:

       

      INFO: [LCDS] [INFO] JMS consumer for JMS destination 'java:comp/env/jmz/topic/flex/simpletopic
                  ' is being removed from the JMS adapter due to the following error: Name TopicConnectionFactory
                   is not bound in this Context

       

      (more logging attached)

       

      My tomcat/conf/server.xml looks as follows:

       

      <Context>

          <WatchedResource>WEB-INF/web.xml</WatchedResource>
          <Manager pathname=""/>


              <Resource name="jms/flex/TopicConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory"
              factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://localhost:61616" brokerName="LocalActiveMQBroker"/>
             
              <Resource name="jmz/topic/flex/simpletopic" auth="Container" type="org.apache.activemq.command.ActiveMQTopic" description="my topic"
              factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="APP.STOCK.MARKETDATA"/>
      </Context>

       

      My messaging config is:

       

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

       

      <service id="message-service"
          class="flex.messaging.services.MessageService">
          <adapters>
              <adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true"/>
              <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/>
             
          </adapters>

       

           <!-- .... another destination cut -->

       

          <destination id="chat-topic-jms">
          <properties>
              <jms>
                  <destination-type>Topic</destination-type>
                  <message-type>javax.jms.TextMessage</message-type>
                  <connection-factory>java:comp/env/jms/flex/TopicConnectionFactory
                  </connection-factory>
                  <destination-jndi-name>java:comp/env/jmz/topic/flex/simpletopic
                  </destination-jndi-name>
                  <destination-name>APP.STOCK.MARKETDATA
                  </destination-name>
                  <delivery-mode>NON_PERSISTENT</delivery-mode>
                  <message-priority>DEFAULT_PRIORITY</message-priority>
                  <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
                  <transacted-sessions>false</transacted-sessions>
        <initial-context-environment>
             <property>
              <name>Context.PROVIDER_URL</name>
              <value>vm://localhost</value>

       

              </property>
            <property>
              <name>Context.INITIAL_CONTEXT_FACTORY</name>
              <!--<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value> -->
              <value>org.apache.naming.java.javaURLContextFactory</value>
             
            </property>
            <property>
              <name>Context.URL_PKG_PREFIXES</name>
              <value>java:org.apache.naming</value>
              </property>
          </initial-context-environment>

       

              </jms>
          </properties>
              <channels>
                  <channel ref="my-rtmp"/>
              </channels>
      <adapter ref="jms"/>
      </destination>

       

      </service>

       

      I have tried removing the part about the initial context factory and using the activemq initital context factory.Further I have tried changing Context.Provider_URL to localhost:61616 and the brokerURL to vm:localhost without results.

       

      Anyone ideas?

       

      Best regards

      Bas

        • 1. Re: Connecting to remote JMS: name TopicConnectionFactory not bound
          Gregor K Level 1

          Curiously enough, I've just been through something very similar!

           

          I think you need to have a <resource-ref> for the topic and factory in your web.xml

           

          Gk.

           

          Gregor Kiddie

          Senior Developer

          INPS

           

          Tel:       01382 564343

           

          Registered address: The Bread Factory, 1a Broughton Street, London SW8 3QJ

           

          Registered Number: 1788577

           

          Registered in the UK

           

          Visit our Internet Web site at www.inps.co.uk

           

          The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact is.helpdesk@inps.co.uk

          • 2. Re: Connecting to remote JMS: name TopicConnectionFactory not bound
            bjvermeulen Level 1

            Thanks Gregor,

             

            My tomcat\webaps\lcds\WEB-INF\web.xml now contains:

             

                    <resource-ref>
                        <description>JMS Connection Factory</description>
                        <res-ref-name>jms/flex/TopicConnectionFactory</res-ref-name>
                        <res-type>org.apache.activemq.ActiveMQConnectionFactory</res-type>
                        <res-auth>Container</res-auth>
                        <res-sharing-scope>Shareable</res-sharing-scope>
                    </resource-ref>
                    <resource-ref>
                        <description>Simple Topic</description>
                        <res-ref-name>jmz/topic/flex/simpletopic</res-ref-name>
                        <res-type>org.apache.activemq.command.ActiveMQTopic</res-type>
                        <res-auth>Container</res-auth>
                        <res-sharing-scope>Shareable</res-sharing-scope>
                    </resource-ref>

             

            The rest of my configuration is unchanged. This change to web.xml seems to have no effect at all :-(

             

            Hope you or someone else has more ideas...

             

            Best regards,

            Bas

            • 3. Re: Connecting to remote JMS: name TopicConnectionFactory not bound
              Gregor K Level 1

              Racking my brains...

               

              Initial Context Factory issues? What port is the JNDI registry available

              on? Is that the right class for Tomcat? (Sorry, I've got mine connected

              up to an OC4J instance, so mine looks a bit different, I use RMI for the

              Initial Conext Factory)

               

              Gk.

               

              Gregor Kiddie

              Senior Developer

              INPS

              • 4. Re: Connecting to remote JMS: name TopicConnectionFactory not bound
                bjvermeulen Level 1

                Hi Gregor,

                 

                I'm not entirely sure about the settings for tomcat. I can't find much information about that. However, when I change the jndi name for the connectionfactory in both context.xml and web.xml in

                 

                jms/flexzzz/TopicConnectionFactory

                 

                Then I get another error:

                 

                INFO: [LCDS] [INFO] JMS consumer for JMS destination 'java:comp/env/jmz/topic/flex/simpletopic
                            ' is being removed from the JMS adapter due to the following error: Name flex is not bound in this Context

                 

                 

                so my conclusion was that lcds is indeed looking in the jndi registry of tomcat. But I'm not a JNDI or tomcat guru so it might be that I'm missing something.

                 

                Thanks for all your efforts!

                 

                Best regards,

                Bas

                • 5. Re: Connecting to remote JMS: name TopicConnectionFactory not bound
                  bjvermeulen Level 1

                  Okay, I have found the solution to this problem.

                   

                  When I installed LCDS I originally selected the option to install LCDS with tomcat included. That seems to have caused the problem. Now I have selected the install web app option and I've installed it under tomcat myself. The issue is now solved. Here's my configuration:

                   

                  In tomcat-5.5.28\conf\context.xml I have:

                   

                  <Context>

                   

                      <!-- Default set of monitored resources -->
                      <WatchedResource>WEB-INF/web.xml</WatchedResource>
                     
                      <!-- Uncomment this to disable session persistence across Tomcat restarts -->
                      <!--
                      <Manager pathname="" />
                      -->
                          <Resource name="jms/flex/TopicConnectionFactory" auth="Container" type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory"
                          factory="org.apache.activemq.jndi.JNDIReferenceFactory" brokerURL="tcp://localhost:61616" brokerName="LocalActiveMQBroker"/>
                         
                          <Resource name="jmz/topic/flex/simpletopic" auth="Container" type="org.apache.activemq.command.ActiveMQTopic" description="my topic"
                          factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="APP.STOCK.MARKETDATA"/>
                  </Context>

                   

                  In webapps\lcds\WEB-INF\flex\messaging-config.xml I have:

                   

                      <destination id="chat-topic-jms">
                      <properties>
                          <jms>
                              <destination-type>Topic</destination-type>
                              <message-type>javax.jms.TextMessage</message-type>
                              <connection-factory>java:comp/env/jms/flex/TopicConnectionFactory
                              </connection-factory>
                              <destination-jndi-name>java:comp/env/jmz/topic/flex/simpletopic
                              </destination-jndi-name>
                              <destination-name>APP.STOCK.MARKETDATA
                              </destination-name>
                              <delivery-mode>NON_PERSISTENT</delivery-mode>
                              <message-priority>DEFAULT_PRIORITY</message-priority>
                              <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
                              <transacted-sessions>false</transacted-sessions>
                    <initial-context-environment>
                         <property>
                          <name>Context.PROVIDER_URL</name>
                          <value>vm://localhost</value>

                   

                          </property>
                        <property>
                          <name>Context.INITIAL_CONTEXT_FACTORY</name>
                          <!-- <value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value> -->
                          <value>org.apache.naming.java.javaURLContextFactory</value>
                         
                        </property>
                        <property>
                          <name>Context.URL_PKG_PREFIXES</name>
                          <value>org.apache.naming</value>
                          </property>
                      </initial-context-environment>

                   

                          </jms>
                      </properties>
                          <channels>
                              <channel ref="my-rtmp"/>
                           <!--   <channel ref="samples-amf-polling"/> -->
                          </channels>
                  <adapter ref="jms"/>
                  </destination>

                   

                  Hope this is of any help to anyone.

                   

                  Best regards,

                  Bas