8 Replies Latest reply on Dec 8, 2006 8:01 AM by chaitanya

    where do i need to specify the JNP port which is used for cr

    phani Newbie

      Initially we are using jbossMQ , but now we shifted to jbossMessaging.
      As my AS Jboss is 4.0.x so to uninstall jbossMQ ,and installing Messaging i have downloaded file and done as specifed in Jboss messaging users guide and validated it.

      my AppServer and JMS server are running on same machine

      when deployed my ear file what ever the code i have written for Connection factory lookup is throwing CommunicationException.

      earlier code :

      ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");
      Hashtable hst = new Hashtable();
      hst.put(Context.INITIAL_CONTEXT_FACTORY,bundle.getString("jmsContextFactory"));
      hst.put(Context.URL_PKG_PREFIXES,bundle.getString("jmsPrefixes"));
      hst.put(Context.PROVIDER_URL,bundle.getString("jmsProviderUrl"));
      Context context = new InitialContext(hst);

      in properties file I mentioned the keys as

      jmsProviderUrl = jnp\://localhost\:1099
      jmsPrefixes = org.jboss.naming:org.jnp.interfaces
      jmsContextFactory = org.jnp.interfaces.NamingContextFactory

      and now when the following code is execute i am getting exception

      QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup("/ConnectionFactory");

      but if i have replaced the above code wtih

      Context context = new InitialContext();

      QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup("/ConnectionFactory");

      its working fine.

      my doubt is suppose jms server is runnig on some remote server.. and my applicaton server is runnig local , then where do i need to mention the remote jms sever jnp port... and how can i create ConnectionFactory.

      or do i need to make any changes in my remoting-service.xml.

      I hope i will get some reply...





        • 1. Re: where do i need to specify the JNP port which is used fo
          David Howe Newbie

          Here is the code that we use to connect to a remote JBoss Messaging server:

          Hashtable properties1 = new Hashtable();
          properties1.put(Context.INITIAL_CONTEXT_FACTORY,
           "org.jnp.interfaces.NamingContextFactory");
          properties1.put(Context.URL_PKG_PREFIXES,
           "org.jboss.naming:org.jnp.interfaces");
          properties1.put(Context.PROVIDER_URL, "jnp://remoteserver:1099");
          properties1.put(Context.SECURITY_PRINCIPAL, "admin");
          properties1.put(Context.SECURITY_CREDENTIALS, "admin");
          
          ConnectionFactory connectionFactory1 = null;
          
          try {
           Context context1 = new InitialContext(properties1);
           connectionFactory1 = (ConnectionFactory) context1
           .lookup("ConnectionFactory");
          } catch (NamingException ne) {
           throw new RuntimeException(ne);
          }
          


          You should replace remoteserver in the above example with your server name or IP address.

          • 2. Re: where do i need to specify the JNP port which is used fo
            phani Newbie

            I have tried using the below code, but i was unable to create connection , i am getting the Communication exception

            Hashtable properties1 = new Hashtable();
            properties1.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            properties1.put(Context.URL_PKG_PREFIXES,
            "org.jboss.naming:org.jnp.interfaces");
            properties1.put(Context.PROVIDER_URL, "jnp://localhost:1099");

            ConnectionFactory connectionFactory1 = null;

            try {
            Context context1 = new InitialContext(properties1);
            connectionFactory1 = (ConnectionFactory) context1
            .lookup("ConnectionFactory");
            } catch (NamingException ne) {
            throw new RuntimeException(ne);
            }


            can any one specify what should be my provider url ...

            • 3. Re: where do i need to specify the JNP port which is used fo
              David Howe Newbie

              Can you post the exception and stack trace that you are getting.

              • 4. Re: where do i need to specify the JNP port which is used fo
                phani Newbie

                hi Davidrh

                this is the exception i am getting


                javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.jms.client.JBossConnectionFactory (no security manager: RMI class loader disabled)]
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
                at javax.naming.InitialContext.lookup(InitialContext.java:351)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
                at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
                at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
                at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130)
                at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
                at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
                at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
                at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
                at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
                at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
                at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
                at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
                at org.jboss.ejb.Container.invoke(Container.java:873)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
                at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
                at org.jboss.invocation.InvokerInterceptor.invokeMarshalled(InvokerInterceptor.java:201)
                at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:35)
                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
                at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
                at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
                at $Proxy110.callJMSService(Unknown Source)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
                at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
                at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
                at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
                at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:595)

                Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.jboss.jms.client.JBossConnectionFactory (no security manager: RMI class loader disabled)
                at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
                at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
                at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
                at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:79)
                at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
                at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
                at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
                at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
                at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
                at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
                at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
                at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:57)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:637)

                can u please specify do i need to change any thing in XML's related to jboss-messaging.sar

                • 5. Re: where do i need to specify the JNP port which is used fo
                  Weston M. Price Master

                  The exception is telling you that the JBossMessaging classes cannot be found in the client classpath. Check your classpath settings on the client and make sure you have the appropriate client jars added.

                  Which version of JBossMessaging are you using?

                  • 6. Re: where do i need to specify the JNP port which is used fo
                    phani Newbie

                    HI prince ,

                    i agree with you that there may be some class files missing at clientside.

                    my doubt is

                    i have my APPS sever and jms server running on same system...in that case i have used the following code to lookup

                    Context context = new InitialContext();
                    QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup("/ConnectionFactory");

                    then i did not got any exceptions...

                    but when changed my lookup code to

                    hst.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                    hst.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
                    hst.put(Context.PROVIDER_URL,"jnp://localhost:1099");
                    Context context = new InitialContext(hst);

                    QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup("/ConnectionFactory");


                    i could not find much difference , in both cases i had my JMS,APPS server running on same system.

                    if i am wrong with my statement, pls clarify it..

                    • 7. Re: where do i need to specify the JNP port which is used fo
                      phani Newbie

                      hi Feodorov.

                      I have made the necessary changes to my EAR as specified at jboss WIKIpage given below..

                      http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMessagingUser_Deploying_a_scoped_MDB_container


                      I could solve the communication exception but still facing some errors like invalid destination exception.

                      I have added jar files to my EAR at client side and used the following code to lookup

                      Hashtable hst = new Hashtable();
                      hst.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
                      hst.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
                      hst.put(Context.PROVIDER_URL,"jnp://remotehost:1099");
                      Context context = new InitialContext(hst);

                      QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup("java:JmsXA");

                      queueConnection = queueConnectionFactory.createQueueConnection();

                      queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                      Queue queue = (Queue) context.lookup("queue/testQueue");


                      next when the below gets executed I am getting invalid Destination Exception.

                      QueueSender queueSender = queueSession.createSender(queue);

                      Following is the list of jar files added to ear at client side as specified in WIKI page

                      javassist.jar
                      jboss-aop.jar
                      jboss-common-softvaluehashmap.jar
                      jboss-messaging.jar
                      jboss-remoting.jar
                      trove.jar
                      jboss-serialization.jar

                      and i have placed jboss-messaging-client.jar at following path in server

                      jboss-4.0.2\server\messaging\lib


                      Is it manadatory to add all the above files to Ear while lookig for a jboss Remote messaging instance.
                      can you tell me the steps or procedure what I am following is correct or not?

                      I have downloaded jboss-messaging-1.0.1.GA.zip and used it as specified
                      in jboss messaging user guide.