11 Replies Latest reply on Nov 7, 2008 4:08 AM by mihirkumar

    JNP message queues through SSH tunnels

    cameronjones

      Hey guys,

      I'm trying to setup remote access to jboss message queues using hermes and putty but for some reason hermes has a problem with it.

      I've setup a tunnel in putty to re-route the jnp service to the same localhost port but hermes keeps complaining with the error "No message, linked exception is null". Without the tunnel setup it times out which leads me to believe that it can connect through the tunnel but that there's some other issue at work. I followed all of the directions in the tuturial at http://www.hermesjms.com/demos/jboss_config.html

      Here's the config i'm using:

      loader jboss
      providerURL jnp://localhost:1099
      initialContextFactory org.jnp.interfaces.NamingContextFactory
      urlPkgPrefixes org.jnp.interfaces:org.jboss.naming
      securityCredentials admin
      securityPrincipal admin

      And here's my jndi.properties config:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

      I should note that the message queues are up and runnning and my app is fully deployed and working so it can't be a problem with the actual configuration of the jms server.

      I'm not sure if this is the right place to ask this question or if i should direct it to the hermes site but since i'm trying to access a jnp resource i thought it could be jboss specific. Has anyone else done this before or can anyone suggest what i should look into to try and get this to work?

      Thanks,
      Cam

        • 1. Re: JNP message queues through SSH tunnels
          timfox

          I am unsure from your post whether you are trying to access JBoss MQ or JBoss Messaging queues on JBoss 4.x using Hermes.

          JBoss MQ and JBoss Messaging are different products.

          AFAIK the instructions on the Hermes site are for accessing JBoss MQ. I don't believe they have integrated Hermes with JBoss Messaging yet.

          • 2. Re: JNP message queues through SSH tunnels
            cameronjones

            Thanks for the quick reply tim!

            I'm using jboss messaging 1.0.1cr3 and i think you're right - the doco for setting up the connection is for MQ. I guess i just expected it to work since all i'm doing right now is trying to lookup the jndi context.

            I thought i saw a post recently where someone was browsing queues using hermes locally...

            • 3. Re: JNP message queues through SSH tunnels
              timfox

              I'm no Hermes expert but I don't imagine it should be too hard to set it up to work with Messaging since we're just providing a standard JMS API.

              It's probably just a matter of making sure Hermes has access to the messaging client jar.

              • 4. Re: JNP message queues through SSH tunnels
                cameronjones

                yeah, i tried that but it keeps giving me the error when accessing the initial context. i might try posting this onto the hemes forum - i'll post back my findings...

                • 5. Re: JNP message queues through SSH tunnels
                  ovidiu.feodorov

                  When you succeed, and if it's not too much of a trouble, you could summarize your conclusions in a short wiki page and link it to http://www.jboss.com/wiki/Wiki.jsp?page=JBossMessaging so others could use your findings.

                  Also, we have a JIRA task on Hermes: http://jira.jboss.org/jira/browse/JBMESSAGING-301. If you get Hermes working with Messaging, I could assign this task to you, and that would make you a Messaging contributor. Free IntelliJ license, in case you care :)

                  Thanks for using Messaging.

                  • 6. Re: JNP message queues through SSH tunnels
                    cameronjones

                    I've investigated a bit more and i think i've found the root of the problem. The lookup to the jnp server is working as expected, returning the correct resource however from the hermes logs it appears that it is then attempting to connect to an internal ip address instead of going through the localhost tunnel. Notice in the logs that it fails while trying to lookup ip address 10.11.64.61

                    I've tested hermes with jboss messaging on my local machine and everything works well - do you have any ideas on how i can get this to work?

                    Ovidiu - I'm more than happy to add to the doco :-)

                    2006-08-24 21:10:38,446 [Hermes ThreadPool-4] ERROR hermes.browser.tasks.HermesBrowserTaskListener - No message, linked exception is : null
                    hermes.HermesException: No message, linked exception is : null
                    at hermes.browser.model.tree.ContextTreeNode.setContext(ContextTreeNode.java:174)
                    at hermes.browser.model.tree.ContextTreeNode.(ContextTreeNode.java:65)
                    at hermes.browser.model.tree.ContextTreeNode.(ContextTreeNode.java:70)
                    at hermes.browser.components.ContextTreeModelFactory.create(ContextTreeModelFactory.java:60)
                    at hermes.browser.tasks.JNDIBrowseTask.invoke(JNDIBrowseTask.java:59)
                    at hermes.browser.tasks.TaskSupport.run(TaskSupport.java:174)
                    at hermes.browser.tasks.ThreadPool.run(ThreadPool.java:182)
                    at java.lang.Thread.run(Thread.java:595)
                    javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 10.11.64.61; nested exception is:
                    java.net.ConnectException: Connection timed out: connect]
                    at org.jnp.interfaces.NamingContext.list(NamingContext.java:812)
                    at org.jnp.interfaces.NamingContext.list(NamingContext.java:786)
                    at javax.naming.InitialContext.list(InitialContext.java:395)
                    at hermes.browser.model.tree.ContextTreeNode.setContext(ContextTreeNode.java:101)
                    at hermes.browser.model.tree.ContextTreeNode.(ContextTreeNode.java:65)
                    at hermes.browser.model.tree.ContextTreeNode.(ContextTreeNode.java:70)
                    at hermes.browser.components.ContextTreeModelFactory.create(ContextTreeModelFactory.java:60)
                    at hermes.browser.tasks.JNDIBrowseTask.invoke(JNDIBrowseTask.java:59)
                    at hermes.browser.tasks.TaskSupport.run(TaskSupport.java:174)
                    at hermes.browser.tasks.ThreadPool.run(ThreadPool.java:182)
                    at java.lang.Thread.run(Thread.java:595)
                    Caused by: java.rmi.ConnectException: Connection refused to host: 10.11.64.61; nested exception is:
                    java.net.ConnectException: Connection timed out: connect
                    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
                    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
                    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
                    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
                    at org.jnp.server.NamingServer_Stub.list(Unknown Source)
                    at org.jnp.interfaces.NamingContext.list(NamingContext.java:800)
                    ... 10 more
                    Caused by: java.net.ConnectException: Connection timed out: connect
                    at java.net.PlainSocketImpl.socketConnect(Native Method)
                    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
                    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
                    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
                    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
                    at java.net.Socket.connect(Socket.java:516)
                    at java.net.Socket.connect(Socket.java:466)
                    at java.net.Socket.(Socket.java:366)
                    at java.net.Socket.(Socket.java:179)
                    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
                    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
                    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
                    ... 15 more

                    • 7. Re: JNP message queues through SSH tunnels
                      ovidiu.feodorov

                      Keep in mind that JNDI server connection is just the first connection attempted by the JMS client. It also needs to go to the server-side Remoting connector:

                       <mbean code="org.jboss.remoting.transport.Connector"
                       name="jboss.messaging:service=Connector,transport=socket"
                       display-name="Socket transport Connector">
                       <attribute name="Configuration">
                       <config>
                       <invoker transport="socket">
                       <attribute name="marshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
                       <attribute name="unmarshaller" isParam="true">org.jboss.jms.server.remoting.JMSWireFormat</attribute>
                       <attribute name="serializationtype" isParam="true">jboss</attribute>
                       <attribute name="dataType" isParam="true">jms</attribute>
                       <attribute name="socket.check_connection" isParam="true">false</attribute>
                       <attribute name="timeout">0</attribute>
                       <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
                       <attribute name="serverBindPort">4457</attribute>
                      
                       ......
                      
                      



                      • 8. Re: JNP message queues through SSH tunnels
                        cameronjones

                        I also tried port forwarding rmi on 1098 onto the same port on localhost, but since it's trying the internal ip address this wouldn't make a differnce. Is there any configuration setting i can change on the server so it returns localhost instead of the ip address? then the port forwarding should work in a sneaky way :-)

                        • 9. Re: JNP message queues through SSH tunnels

                          I don't know hermes at all, so can't speak to that, but do know that is possible to configure the ip and port that clients connect to (when different from the actual network interface that server binds to). More information on how to configure this can be found at http://labs.jboss.com/portal/jbossremoting/docs/guide/ch05.html#d0e1020.

                          Only possible issue to doing this within messaging is related to how messaging creates the invoker locator given to the client. If is the one take from the server invoker, then using this config change will work.

                          • 10. Re: JNP message queues through SSH tunnels
                            ruediger_pape

                            Hi,

                            I have exactly the same problem.

                            Do you have any solution yet? Any help would be appreciated!

                            Thanks

                            • 11. Queue Monitoring
                              mihirkumar

                              Hi,

                              How to know the no of messages currently active in a queue?

                              Thanks
                              M.Kumar