8 Replies Latest reply on Sep 12, 2003 8:34 AM by Sanjay

    javax.naming.NotContextException

    Sanjay Newbie

      Hi,

      I would like to name JMS topics in JBoss in a hierarchical fashion: i.e. I have 3 topics named a, a/b, and a/b/c respectively. I can successfuly do a context.lookup("a"). When I try to do a context.lookup on "a/b" or "a/b/c", I get a javax.naming.NotContextException. Am I doing something wrong or does JBoss simply not allow this type of naming scheme?

      Thanks in advance.


        • 1. Re: javax.naming.NotContextException
          Stephane Nicoll Master

          topic should be under the "topic' domain as far as i know

          topic/a
          topic/a/b
          topic/a/b/c

          should be ok

          • 2. Re: javax.naming.NotContextException
            Sanjay Newbie

            This is exactly the case that doesn't work for me. I should have also mentioned that on startup, JBoss complains when trying to create the topics. It looks liek there is a problem setting the jndi name of the topic. Here is a blurb:

            2003-09-11 10:24:49,142 INFO [org.jboss.mq.server.jmx.Topic.a] Starting
            2003-09-11 10:24:49,142 INFO [org.jboss.mq.server.jmx.Topic.a] Bound to JNDI name: topic/a
            2003-09-11 10:24:49,142 INFO [org.jboss.mq.server.jmx.Topic.a] Started
            2003-09-11 10:24:49,142 INFO [org.jboss.mq.server.jmx.Topic.a/b] Starting
            2003-09-11 10:24:49,152 ERROR [org.jboss.mq.server.jmx.Topic.a/b] Starting failed
            java.lang.ClassCastException
            at org.jboss.naming.Util.createSubcontext(Util.java:49)
            at org.jboss.naming.Util.rebind(Util.java:107)
            at org.jboss.naming.Util.rebind(Util.java:95)
            at org.jboss.mq.server.jmx.DestinationMBeanSupport.setJNDIName(DestinationMBeanSupport.java:155)
            at org.jboss.mq.server.jmx.Topic.startService(Topic.java:68)
            at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:165)
            at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)

            • 3. Re: javax.naming.NotContextException
              Stephane Nicoll Master

              Post the definition of your queues

              Regards,

              Stephane

              • 4. Re: javax.naming.NotContextException
                Adrian Brock Master

                There is a separate attribute if you want to change the jndi name.


                somewhere/else <!-- HERE -->
                <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
                <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager










                Regards,
                Adrian

                • 5. Re: javax.naming.NotContextException
                  Sanjay Newbie

                  Here are the definitions for the topics. I removed the SecurityManager in my definitions to make it as simple as possible.



                  <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager



                  <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager



                  <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager


                  • 6. Re: javax.naming.NotContextException
                    Stephane Nicoll Master

                    I don't understand, normally it should be ok

                    • 7. Re: javax.naming.NotContextException
                      Adrian Brock Master

                      You have bound a topic at
                      topic/a

                      You then try to bind a topic at topic/a/b
                      but a is not a subcontext it is a topic.

                      Regards,
                      Adrian

                      • 8. Re: javax.naming.NotContextException
                        Sanjay Newbie

                        It seems like I can still keep my logical addressing and use the JNDIName attribute to map the queues/topics to physical names that don't use '/' as the delimiter. Thanks for all your help.

                        Regards,

                        Sanjay