1 2 Previous Next 20 Replies Latest reply on Dec 8, 2006 7:19 PM by cypnsv

    namenotfound exception in JMS Client

    cypnsv

      I need help very urgent

      I have configured the connection factory in jms-ds.xml as below

      <tx-connection-factory>
       <jndi-name>AlarmMgrConnectionFactory</jndi-name>
       <xa-transaction/>
       <rar-name>jms-ra.rar</rar-name>
       <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
       <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
       <max-pool-size>20</max-pool-size>
       </tx-connection-factory>
      
      
      
       <tx-connection-factory>
       <jndi-name>EventConnectionFactory</jndi-name>
       <xa-transaction/>
       <rar-name>jms-ra.rar</rar-name>
       <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
       <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
       <max-pool-size>20</max-pool-size>
       <security-domain-and-application>JmsXARealm</security-domain-and-application>
       </tx-connection-factory>
      


      When i try to lookup for the conection factory from the lookup i get the Namenotbound exception, Below is the lines from JMS Client program

      Properties properties = new Properties();
       properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
       properties.put(Context.PROVIDER_URL, "localhost:3099");
       InitialContext ctx = new InitialContext(properties);
       Object obj = ctx.lookup("java:AlarmMgrConnectionFactory");


      Please please help

        • 1. Re: namenotfound exception in JMS Client
          cypnsv

          Sorry the exception is AlarmMgrConnectionFactory not bound

          • 2. Re: namenotfound exception in JMS Client
            cypnsv

            need help urgently

            Please let me know where i am doing wrong

            • 3. Re: namenotfound exception in JMS Client
              weston.price

              You cannot access JCA resources outside of JBoss. The reason your code is failing is that the java: namespace is not available. *-ds.xml definitions are only for resources that are targeted to be used in the EE container. If you simply want to post to destination outside of JBoss, create the destination and use the JNDI lookup

              Properties properties = new Properties();
               properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
               properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
               properties.put(Context.PROVIDER_URL, "localhost:3099");
               InitialContext ctx = new InitialContext(properties);
               Object obj = ctx.lookup("ConnectionFactory");
              


              From there you can create a connection and begin producing messages.



              • 4. Re: namenotfound exception in JMS Client
                cypnsv

                thanks thanks for the quickest response,




                So you mean to say that i need to create my own -ds.xml file, for example project-ds.xml and have the connection factory in this file and put this file into server\default\deploy directory

                is that right?

                [/img]

                • 5. Re: namenotfound exception in JMS Client
                  cypnsv

                  sorry misunderstood,

                  i tried without java: but still it doe not work, i get the same error
                  AlarmMgrConnectionFactory not bound

                  please see the below code

                  Properties properties = new Properties();
                   properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                   properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
                   properties.put(Context.PROVIDER_URL, "localhost:3099");
                   InitialContext ctx = new InitialContext(properties);
                   Object obj = ctx.lookup("AlarmMgrConnectionFactory");


                  But in the server log file i see that AlarmMgrConnectionFactory jndiname is java:AlarmMgrConnectionFactory

                  below are the lines from the log file

                  2006-12-09 03:18:37,501 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Binding object 'org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl@c8f0a4' into JNDI at 'java:AlarmMgrConnectionFactory'
                  2006-12-09 03:18:37,501 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory' to JNDI name 'java:AlarmMgrConnectionFactory'
                  2006-12-09 03:18:37,501 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Started jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory
                  2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] Starting dependent components for: jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory dependent components: []
                  2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] starting service jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory
                  2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] Ignoring start request for service: jboss.jca:service=ConnectionFactoryBinding,name=AlarmMgrConnectionFactory
                  2006-12-09 03:18:37,501 DEBUG [org.jboss.system.ServiceController] starting service jboss.jca:service=TxCM,name=EventConnectionFactory


                  • 6. Re: namenotfound exception in JMS Client
                    cypnsv

                    Please advice, where i am going wrong

                    Please please...

                    • 7. Re: namenotfound exception in JMS Client
                      cypnsv

                      please help

                      • 8. Re: namenotfound exception in JMS Client
                        cypnsv

                        i am still getting the same error

                        Please help

                        • 9. Re: namenotfound exception in JMS Client
                          cypnsv

                          Somebody please help

                          • 10. Re: namenotfound exception in JMS Client
                            weston.price

                            Again, you cannot lookup a resource bound into JNDI in JBoss in a client outside of JBoss.

                            Change your code to

                            
                            Properties properties = new Properties();
                             properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                             properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
                             properties.put(Context.PROVIDER_URL, "localhost:3099");
                             InitialContext ctx = new InitialContext(properties);
                             ConnectionFactory cf = (ConnectionFactory)ctx.lookup("ConnectionFactory");
                            


                            From this factory you can create a connection and from there a session etc. Also, you will have to look up your destinations from JNDI as well.



                            • 11. Re: namenotfound exception in JMS Client
                              cypnsv

                              i did the same

                              Now i get this error

                              Exception in thread "main" javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
                               java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)]
                               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
                               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
                               at javax.naming.InitialContext.lookup(Unknown Source)
                               at Client.main(Client.java:33)


                              • 12. Re: namenotfound exception in JMS Client
                                weston.price

                                Which means you have missing jars in your classpath. How are you running this?

                                • 13. Re: namenotfound exception in JMS Client
                                  cypnsv

                                  i am running the JMSCLIENT program from the ECLIPSE

                                  Whuch jar file am i missing?

                                  • 14. Re: namenotfound exception in JMS Client
                                    weston.price

                                    It looks like you don't have jbossall-client.jar

                                    This can be found in your JBOSS_HOME/client directory


                                    1 2 Previous Next