14 Replies Latest reply on Jun 8, 2007 10:48 AM by Peter Johnson

    failed to add topic in JBM 1.3

    John Karr Newbie

      Add a topic in destination-service.xml and got NameNotFoundException for that topic. It was working with 1.2 and I can also find all pre-configured destinations. I set up JBM in Jboss AS 4.2.0.GA. Is there any change about destination configuration in 1.3? Or I missed anything. Thansks

        • 1. Re: failed to add topic in JBM 1.3
          Peter Johnson Master

          Have you used the list method of the jboss:service=JNDIView MBean within jmxconsole (or twiddle) to determine if the the topic was registered as you expected?

          • 2. Re: failed to add topic in JBM 1.3
            John Karr Newbie

            Thanks Peter, I did look at the Global JNDI Namespace in JNDIView, my topic is not there. My understanding is that by adding a destination in destination-service.xml, name service should be able pick it up in JNDI space.

            • 3. Re: failed to add topic in JBM 1.3
              Peter Johnson Master

              Which version of JBoss are you using? Did you restart the server?

              • 4. Re: failed to add topic in JBM 1.3
                John Karr Newbie

                Sorry, my mistake. My topic does show up in JNDI view but cannot find by jndi.lookup.

                • 5. Re: failed to add topic in JBM 1.3
                  John Karr Newbie

                  I am using JBoss AS 4.2.0.GA. Yes I started server every time I made change on any of config files.

                  • 6. Re: failed to add topic in JBM 1.3
                    Tim Fox Master

                    You certainly don't need to restart the server every time you deploy/undeploy a destination.

                    • 7. Re: failed to add topic in JBM 1.3
                      Peter Johnson Master

                      If it is in JNDIView, you should be able to look it up. Please post the excerpt from the destinations xml file that declares your topic, the code you use to lookup the topic, and the jndi,properties file you are using (if any).

                      • 8. Re: failed to add topic in JBM 1.3
                        John Karr Newbie

                        Here is what I see in JNDIView:

                         +- topic (class: org.jnp.interfaces.NamingContext)
                         | +- testDurableTopic (class: org.jboss.jms.destination.JBossTopic)
                         | +- TopicWithOwnRedeliveryDelay (class: org.jboss.jms.destination.JBossTopic)
                         | +- xCacheInvalidationTopic (class: org.jboss.jms.destination.JBossTopic)
                         | +- testTopic (class: org.jboss.jms.destination.JBossTopic)
                         | +- ServerCacheInvalidationTopic (class: org.jboss.jms.destination.JBossTopic)
                         | +- testDistributedTopic (class: org.jboss.jms.destination.JBossTopic)
                         | +- TopicWithOwnDLQAndExpiryQueue (class: org.jboss.jms.destination.JBossTopic)
                         | +- securedTopic (class: org.jboss.jms.destination.JBossTopic)
                        



                        Here is Java code to look up topic topic/xCacheValidationTopic:
                         jndi = new InitialContext();
                        
                         TopicConnectionFactory connFactory = (TopicConnectionFactory)jndi.lookup("ConnectionFactory");
                        
                         if (connFactory == null) {
                         throw new NullPointerException("The TopicConnectionFactory for JMS cache invalidation was NULL");
                         }
                        
                         connection = connFactory.createTopicConnection();
                         if (connection == null) {
                         throw new NullPointerException("The TopicConnection for JMS cache invalidation was NULL!");
                         }
                        
                         jmsSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                         if (jmsSession == null) {
                         throw new NullPointerException("The TopicSession for JMS cache invalidation was null");
                         }
                        
                         topic = (Topic)jndi.lookup(topicName);
                        


                        MBean in destination-service.xml:
                         <mbean code="org.jboss.jms.server.destination.TopicService"
                         name="jboss.messaging.destination:service=Topic,name=CacheInvalidationTopic"
                         xmbean-dd="xmdesc/Topic-xmbean.xml">
                         <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
                         <depends>jboss.messaging:service=PostOffice</depends>
                         <attribute name="Clustered">true</attribute>
                         </mbean>
                        


                        Exception:
                        javax.naming.NameNotFoundException: topic/xCacheInvalidationTopic
                         at org.jboss.ha.jndi.TreeHead.lookup(TreeHead.java:242)
                         at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:155)
                         at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                         at java.lang.reflect.Method.invoke(Unknown Source)
                         at org.jboss.ha.framework.server.HARMIServerImpl.invoke(HARMIServerImpl.java:209)
                         at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                         at java.lang.reflect.Method.invoke(Unknown Source)
                         at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
                         at sun.rmi.transport.Transport$1.run(Unknown Source)
                         at java.security.AccessController.doPrivileged(Native Method)
                         at sun.rmi.transport.Transport.serviceCall(Unknown Source)
                         at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
                         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
                         at java.lang.Thread.run(Unknown Source)
                         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
                         at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
                         at sun.rmi.server.UnicastRef.invoke(Unknown Source)
                         at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
                         at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:172)
                         at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:267)
                         at $Proxy0.lookup(Unknown Source)
                         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:626)
                         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
                         at javax.naming.InitialContext.lookup(Unknown Source)
                        

                        Thanks.

                        • 9. Re: failed to add topic in JBM 1.3
                          John Karr Newbie

                          Sorry mbean should look like:

                           <mbean code="org.jboss.jms.server.destination.TopicService"
                           name="jboss.messaging.destination:service=Topic,name=xCacheInvalidationTopic"
                           xmbean-dd="xmdesc/Topic-xmbean.xml">
                           <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
                           <depends>jboss.messaging:service=PostOffice</depends>
                           <attribute name="Clustered">true</attribute>
                           </mbean>
                          


                          • 10. Re: failed to add topic in JBM 1.3
                            Peter Johnson Master

                            I would be interested to see how topicName is set in your Java code. One thing that is bugging me is the name not found exception usually lists only the specific name (e.g., topic or xCacheInvalidationTopic), I do not recall every seeing a full name (e.g., topic/xCacheInvalidationTopic) in the error message. This tells me that perhaps the '/' in the name is not the character whose ASCII code is 2F.

                            • 11. Re: failed to add topic in JBM 1.3
                              Peter Johnson Master

                              I guess I should also ask, where is your client running? Within the application server? If not, I need to see the jndi.properties file because the code that obtains the initial context is not setting any properties.

                              • 12. Re: failed to add topic in JBM 1.3
                                John Karr Newbie

                                Hi Peter,
                                I should point out all the configuration works with messaging 1.2 in JBoss 4.0.5.
                                The client code is stand alone. It call lookup all pre-configured destination coming with the package of 1.3.
                                The topicName was passed as an arguement to the method, which was set as a static field in the calling code as

                                private static final String TOPIC_NAME = "/topic/xCacheInvalidationTopic";
                                


                                the jndi.properties looks like:
                                ### JBossNS properties LOCAL env
                                java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                                java.naming.provider.url=jnp://hagler.m80apps.com:1099,fraizer.m80apps.com:1099
                                java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                                
                                


                                • 13. Re: failed to add topic in JBM 1.3
                                  Tim Fox Master

                                  The way to deal with this is to first find a destination lookup that works for you.

                                  E.g. try looking up one of the example destinations e.g. queue/testQueue that is shipped with JBM.

                                  Once you have done that and are satisified that lookups do, in general work (you can also run the examples for examples of working lookups), you should then start looking at how that example destination differs from your problematic destination.

                                  You could then start changing the working destination's name (maybe slowly character by character) into the name of the problematic destination. At each time step of the way ensure the lookup still works. At some point you will have a destination with the name you desire that works, and you will know what was wrong with your original config.

                                  • 14. Re: failed to add topic in JBM 1.3
                                    Peter Johnson Master

                                    I would also try looking up just "topic" and once I had that namespace, I would print out the names of all objects in the namespace. Looking at the set of returned names might give you a clue as to what is going on. For example, you might find the the URL for JNDI is incorrect ad you have been looking at the wrong server.